查看: 4536|回复: 16

[转载发布] 6R不常见脚本发放,需要的自己拿(转载,常年收集好用)

[复制链接]
梦石
0
星屑
1345
在线时间
378 小时
注册时间
2015-6-16
回帖
526
发表于 2017-7-19 14:49:39 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 300英雄 于 2017-7-19 15:16 编辑

网址
  1. #==============================================================================
  2. # ★ RGSS3_リンク付きクレジット Ver1.1
  3. #==============================================================================
  4. =begin

  5. 作者:tomoaky
  6. webサイト:ひきも記は閉鎖しました。 ([url]http://hikimoki.sakura.ne.jp/[/url])

  7. ブラウザでリンク先のサイトを開く機能をもったクレジットシーンです、
  8. タイトルコマンドに追加されます。

  9. 以下のおまけ機能があります。

  10. イベントコマンド『スクリプト』を使い、任意のサイトをブラウザで開く。
  11.   open_url("http://hikimoki.sakura.ne.jp/")
  12.   
  13. タイトルシーンからGame.exeと同じ場所にある readme.txt を開く。
  14.   
  15. 2014.10.09  Ver1.1
  16.   ・おまけ機能追加

  17. 2014.10.08  Ver1.0
  18.   ・公開

  19. =end

  20. #==============================================================================
  21. # □ 設定項目
  22. #==============================================================================
  23. module TMCREDIT
  24.   # クレジットの設定(["サイト名", "説明", "URL"])
  25.   DATA = [
  26.     ["勇冒的通知", "通知", "http://guangmingmofaling.lofter.com/post/1e3937c2_da6506b"],
  27.     ["勇冒1.9。", "1.9", "http://guangmingmofaling.lofter.com/post/1e3937c2_cfa6f62"],
  28.     ["勇冒2.0。", "2.0", "http://guangmingmofaling.lofter.com/post/1e3937c2_ebbe968"],
  29.     ["勇冒2.1。", "2.1", "http://guangmingmofaling.lofter.com/post/1e3937c2_ed79836"],
  30.     ["勇冒2.2。", "2.2", "http://guangmingmofaling.lofter.com/post/1e3937c2_f281213"],
  31.     ["勇冒2.3。", "2.3", "http://guangmingmofaling.lofter.com/post/1e3937c2_f30b3e3"],
  32.   ]
  33.   
  34.   TITLE_INDEX = 2   # タイトルコマンドの何番目に挿入するか(0 が先頭)
  35.   
  36.   USE_MANUAL_CALL = false  # readme.txt の呼び出し機能を使うか(false で無効)
  37. end

  38. #==============================================================================
  39. # □ コマンド
  40. #==============================================================================
  41. module TMCREDIT
  42. module Commands
  43.   #--------------------------------------------------------------------------
  44.   # ○ ブラウザでサイトを開く
  45.   #--------------------------------------------------------------------------
  46.   def open_url(url)
  47.     a = Win32API.new("shell32", "ShellExecuteA", %w(p p p p p i),"i")
  48.     a.call(0, "open", url, 0, 0, 1)
  49.   end
  50.   module_function :open_url
  51. end
  52. end # module TMCREDIT

  53. #==============================================================================
  54. # ■ Game_Event
  55. #==============================================================================
  56. class Game_Event
  57.   include TMCREDIT::Commands
  58. end

  59. #==============================================================================
  60. # ■ Game_Interpreter
  61. #==============================================================================
  62. class Game_Interpreter
  63.   include TMCREDIT::Commands
  64. end

  65. #==============================================================================
  66. # ■ Window_TitleCommand
  67. #==============================================================================
  68. class Window_TitleCommand < Window_Command
  69.   #--------------------------------------------------------------------------
  70.   # ● コマンドリストの作成
  71.   #--------------------------------------------------------------------------
  72.   alias tmcredit_window_titlecommand_make_command_list make_command_list
  73.   def make_command_list
  74.     tmcredit_window_titlecommand_make_command_list
  75.     @list.insert(TMCREDIT::TITLE_INDEX,
  76.       {:name=>"更新网站", :symbol=>:credit, :enabled=>true, :ext=>nil})
  77.     if TMCREDIT::USE_MANUAL_CALL
  78.       @list.insert(TMCREDIT::TITLE_INDEX + 1,
  79.         {:name=>"説明書", :symbol=>:manual, :enabled=>true, :ext=>nil})
  80.     end
  81.   end
  82. end

  83. #==============================================================================
  84. # ■ Window_Credit
  85. #==============================================================================
  86. class Window_Credit < Window_Selectable
  87.   #--------------------------------------------------------------------------
  88.   # ● オブジェクト初期化
  89.   #--------------------------------------------------------------------------
  90.   def initialize(x, y, width, height)
  91.     @data = TMCREDIT::DATA.clone
  92.     super
  93.     select(0)
  94.     activate
  95.     refresh
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● 項目数の取得
  99.   #--------------------------------------------------------------------------
  100.   def item_max
  101.     @data.size
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● アイテムの取得
  105.   #--------------------------------------------------------------------------
  106.   def item
  107.     @data[index]
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● URLの取得
  111.   #--------------------------------------------------------------------------
  112.   def url
  113.     @data[index][2]
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ● 項目の描画
  117.   #--------------------------------------------------------------------------
  118.   def draw_item(index)
  119.     item = @data[index]
  120.     if item
  121.       rect = item_rect_for_text(index)
  122.       draw_text(rect, sprintf("%s (%s)", item[0], item[2]))
  123.     end
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ● ヘルプテキスト更新
  127.   #--------------------------------------------------------------------------
  128.   def update_help
  129.     text = sprintf("\\C[16]%s\\C[0] %s", item[1], item[0])
  130.     text += "\n\\C[2](确定键进去网址)"
  131.     @help_window.set_text(text)
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ● リフレッシュ
  135.   #--------------------------------------------------------------------------
  136.   def refresh
  137.     create_contents
  138.     draw_all_items
  139.   end
  140. end

  141. #==============================================================================
  142. # ■ Scene_Title
  143. #==============================================================================
  144. class Scene_Title < Scene_Base
  145.   #--------------------------------------------------------------------------
  146.   # ● コマンドウィンドウの作成
  147.   #--------------------------------------------------------------------------
  148.   alias tmcredit_scene_title_create_command_window create_command_window
  149.   def create_command_window
  150.     tmcredit_scene_title_create_command_window
  151.     @command_window.set_handler(:credit, method(:command_credit))
  152.     if TMCREDIT::USE_MANUAL_CALL
  153.       @command_window.set_handler(:manual, method(:command_manual))
  154.     end
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # ○ コマンド[クレジット]
  158.   #--------------------------------------------------------------------------
  159.   def command_credit
  160.     close_command_window
  161.     SceneManager.call(Scene_Credit)
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ○ コマンド[説明書]
  165.   #--------------------------------------------------------------------------
  166.   def command_manual
  167.     @command_window.activate
  168.     TMCREDIT::Commands.open_url("readme.txt")
  169.   end
  170. end

  171. #==============================================================================
  172. # ■ Scene_Credit
  173. #==============================================================================
  174. class Scene_Credit < Scene_MenuBase
  175.   #--------------------------------------------------------------------------
  176.   # ● 開始処理
  177.   #--------------------------------------------------------------------------
  178.   def start
  179.     super
  180.     create_help_window
  181.     create_item_window
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ● クレジットウィンドウの作成
  185.   #--------------------------------------------------------------------------
  186.   def create_item_window
  187.     ww = Graphics.width
  188.     wh = Graphics.height - @help_window.height
  189.     @credit_window = Window_Credit.new(0, @help_window.height, ww, wh)
  190.     @credit_window.help_window = @help_window
  191.     @credit_window.set_handler(:ok,     method(:on_credit_ok))
  192.     @credit_window.set_handler(:cancel, method(:return_scene))
  193.   end
  194.   #--------------------------------------------------------------------------
  195.   # ● クレジット[決定]
  196.   #--------------------------------------------------------------------------
  197.   def on_credit_ok
  198.     TMCREDIT::Commands.open_url(@credit_window.url)
  199.     @credit_window.activate
  200.   end
  201. end
复制代码


复活机制
  1. #encoding:utf-8

  2. =begin
  3. *******************************************************************************************
  4.    * 時間自動復活機制 *
  5.                        for RGSS3
  6.         Ver 1.00   2014.01.29
  7.    原作者:魂(Lctseng),巴哈姆特論壇ID:play123
  8.    替"ace922(容)"撰寫的特製版本
  9.    
  10.    轉載請保留此標籤
  11.    個人小屋連結:[url]http://home.gamer.com.tw/homeindex.php?owner=play123[/url]
  12.    主要功能:
  13.                        一、指定回合數到後角色會自動復活
  14.                        二、若角色身上擁有"無法他人復活"狀態,則他人的復活相關技能將對其沒有作用。
  15.                        
  16.    更新紀錄:
  17.     Ver 1.00 :
  18.     日期:2014.01.29
  19.     摘要:■、最初版本
  20.                 ■、功能:                  
  21.                        一、指定回合數到後角色會自動復活
  22.                        二、若角色身上擁有"無法他人復活"狀態,則他人的復活相關技能將對其沒有作用。
  23.     撰寫摘要:一、此腳本修改或重新定義以下類別:
  24.                            ■ Game_Actor
  25.                           
  26.                         二、此腳本新定義以下類別和模組:
  27.                            ■ Lctseng::AutoRevive
  28.                           
  29. *******************************************************************************************
  30. =end

  31. #encoding:utf-8
  32. #==============================================================================
  33. # ■ Lctseng::AutoRevive
  34. #------------------------------------------------------------------------------
  35. #  自動復活設定模組
  36. #==============================================================================

  37. module Lctseng
  38. module AutoRevive
  39.   #--------------------------------------------------------------------------
  40.   # ● 設定是否顯示Console 紀錄
  41.   #--------------------------------------------------------------------------
  42.   SHOW_CONSOLE_INFO = true
  43.   #--------------------------------------------------------------------------
  44.   # ● 設定復活所需回合數
  45.   #--------------------------------------------------------------------------
  46.   REVIVE_TURN = 10
  47.   #--------------------------------------------------------------------------
  48.   # ● 設定復活時候,HP與MP的恢復計算公式
  49.   #--------------------------------------------------------------------------
  50.   HP_FORMULA =  " rand(10000) "
  51.   MP_FORMULA =  " mat + mdf "
  52.   #--------------------------------------------------------------------------
  53.   # ● 設定相關狀態編號
  54.   #--------------------------------------------------------------------------
  55.   DEAD_STATE = 1 # 死亡的狀態
  56.   NO_REVIVE_STATES = [197] # 禁止復活的狀態數列
  57.   
  58. end
  59. end

  60. #*******************************************************************************************
  61. #
  62. #   請勿修改從這裡以下的程式碼,除非你知道你在做什麼!
  63. #   DO NOT MODIFY UNLESS YOU KNOW WHAT TO DO !
  64. #
  65. #*******************************************************************************************

  66. #--------------------------------------------------------------------------
  67. # ★ 紀錄腳本資訊
  68. #--------------------------------------------------------------------------
  69. if !$lctseng_scripts  
  70.   $lctseng_scripts = {}
  71. end


  72. $lctseng_scripts[:auto_revive] = "1.00"

  73. puts "載入腳本:Lctseng - 時間自動復活機制,版本:#{$lctseng_scripts[:auto_revive]}"

  74. #encoding:utf-8
  75. #==============================================================================
  76. # ■ Game_Actor
  77. #------------------------------------------------------------------------------
  78. #  管理角色的類。
  79. #   本類在 Game_Actors 類 ($game_actors) 的內部使用。
  80. #   具體使用請查看 Game_Party 類 ($game_party) 。
  81. #==============================================================================

  82. class Game_Actor < Game_Battler
  83.   #--------------------------------------------------------------------------
  84.   # ● 回合結束處理
  85.   #--------------------------------------------------------------------------
  86.   def on_turn_end
  87.     super
  88.     #puts "#{self.name}執行回合結束。" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
  89.     if dead?
  90.       if !@dead_turn
  91.         @dead_turn = 0
  92.       end
  93.       puts " #{self.name}已經死了#{@dead_turn}個回合..." if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
  94.       if @dead_turn >= Lctseng::AutoRevive::REVIVE_TURN
  95.         puts " #{self.name}復活!清除死亡回合計數!" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
  96.         revive
  97.         remove_state(Lctseng::AutoRevive::DEAD_STATE,true)
  98.         self.hp += eval_formula(Lctseng::AutoRevive::HP_FORMULA)
  99.         self.mp += eval_formula(Lctseng::AutoRevive::MP_FORMULA)
  100.         @dead_turn = 0
  101.       else
  102.         @dead_turn += 1
  103.       end
  104.     else
  105.       @dead_turn = 0
  106.     end
  107.     if alive?
  108.       ## 還活著,自行解除任何限制復活狀態
  109.       Lctseng::AutoRevive::NO_REVIVE_STATES.each do |state_id|
  110.         if state?(state_id)
  111.           puts " #{self.name}還活著,持有#{$data_states[state_id].name},將自動解除" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
  112.           remove_state(state_id)
  113.         end
  114.       end
  115.     end
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # ● 計算公式
  119.   #--------------------------------------------------------------------------
  120.   def eval_formula(formula)
  121.     eval(formula).round rescue 0
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 計算傷害
  125.   #--------------------------------------------------------------------------
  126.   def make_damage_value(user, item)
  127.     new_item = item
  128.     if dead? && Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id|  state?(state_id) }
  129.       new_item = Marshal.load(Marshal.dump(item))
  130.       new_item.damage.formula = "0"
  131.       puts "#{self.name}已死亡且受到復活限制狀態,恢復HP計算強制歸零" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
  132.     end
  133.     super(user,new_item)
  134.   end
  135.   #--------------------------------------------------------------------------
  136.   # ● 更改 HP
  137.   #--------------------------------------------------------------------------
  138.   def hp=(hp)
  139.     if dead? && Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id|  state?(state_id) }
  140.       hp = 0
  141.       puts "#{self.name}已死亡且受到復活限制狀態,HP強制為0" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
  142.     end
  143.     super(hp)
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 應用“恢復 HP”效果
  147.   #--------------------------------------------------------------------------
  148.   def item_effect_recover_hp(user, item, effect)
  149.     if dead? && Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id|  state?(state_id) }
  150.       puts " #{self.name}有禁止復活的狀態,恢復HP無效。" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
  151.     else
  152.       super
  153.     end
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 應用“狀態解除”效果
  157.   #--------------------------------------------------------------------------
  158.   def item_effect_remove_state(user, item, effect)
  159.     if effect.data_id == Lctseng::AutoRevive::DEAD_STATE
  160.       if !Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id|  state?(state_id) }
  161.         super
  162.         if !state?(effect.data_id)
  163.           @dead_turn = 0
  164.           puts "#{self.name}已經復活!清除死亡回合數。"if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
  165.         end
  166.       end
  167.     else
  168.       super
  169.     end
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● 解除狀態
  173.   #--------------------------------------------------------------------------
  174.   def remove_state(state_id,force = false)
  175.     if state_id == Lctseng::AutoRevive::DEAD_STATE
  176.       if force || !Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id|  state?(state_id) }
  177.         super(state_id)
  178.       end
  179.     else
  180.       super(state_id)
  181.     end
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ● 死亡
  185.   #--------------------------------------------------------------------------
  186.   def die
  187.     @dead_turn = 0
  188.     @hp = 0
  189.     clear_states_except_revive_limit
  190.     clear_buffs
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # ● 清除除了死亡限制以外的狀態
  194.   #--------------------------------------------------------------------------
  195.   def clear_states_except_revive_limit
  196.     ## 先記錄死亡狀態資訊
  197.     states = {}
  198.     Lctseng::AutoRevive::NO_REVIVE_STATES.each do |state_id|
  199.       if @states.include?(state_id)
  200.         states[state_id] = [@state_steps[state_id],@state_turns[state_id]]
  201.       end
  202.     end
  203.     ## 呼叫原始的清除方法
  204.     clear_states
  205.     ## 把剛才紀錄的狀態放回去
  206.     states.each_pair do |state_id,data|
  207.       @states.push(state_id)
  208.       @state_steps[state_id] = data[0]
  209.       @state_turns[state_id] = data[1]
  210.     end
  211.     sort_states
  212.   end
  213.   #--------------------------------------------------------------------------
  214.   # ● 判定狀態是否可以附加
  215.   #--------------------------------------------------------------------------
  216.   def state_addable?(state_id)
  217.     if Lctseng::AutoRevive::NO_REVIVE_STATES.include?(state_id)
  218.       $data_states[state_id] && !state_resist?(state_id) &&
  219.       !state_removed?(state_id) && !state_restrict?(state_id)
  220.     else
  221.       super
  222.     end
  223.   end
  224.   #--------------------------------------------------------------------------
  225.   # ● 測試使用效果
  226.   #--------------------------------------------------------------------------
  227.   def item_effect_test(user, item, effect)
  228.     if effect.code == EFFECT_REMOVE_STATE && effect.data_id == Lctseng::AutoRevive::DEAD_STATE
  229.       state?(effect.data_id) && !Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id|  state?(state_id) }
  230.     else
  231.       super
  232.     end
  233.   end
  234.   
  235. end
复制代码


时间脚本
  1. #==============================================================================
  2. # ■ BMSP 暦システム[KOYOMISYSTEM] Ver1.24 2014/08/09
  3. #------------------------------------------------------------------------------
  4. #  日付,時間の概念を導入します.
  5. #==============================================================================
  6. #------------------------------------------------------------------------------
  7. # ■内容
  8. # ゲームに日付,時間の概念を導入します.
  9. # 自由に暦を設定して任意のタイミングで時間を進めることができます.
  10. # 時間に合わせて画面の色調を自動で変更することも可能です.
  11. #
  12. # 位置:特に指定はありません
  13. #
  14. # ■使用方法
  15. # スクリプトに丸ごと貼り付けていただければ使用できます.
  16. #
  17. # ●暦の設定
  18. # まずは詳細設定にて暦の設定を行って下さい.
  19. #
  20. # ○RANKS:ランクの設定を行います.
  21. # ランクとは秒,分,時,,などのような時間の単位を表します.
  22. # ランクは上から順にランク0,ランク1と呼び,
  23. # あるランクの値が上限を超えると一つ上のランクに繰り上げされます.
  24. # 各ランクは
  25. #   ランク名 => 値の範囲
  26. # のように設定します.
  27. # 例
  28. #   RANKS = {
  29. #     :sec => 0...60,
  30. #     :min => 0...60,
  31. #     :hour => 0...24,
  32. #     :day => 1..30,
  33. #     :mon => 1..12,
  34. #     :year => 1..9999
  35. #   }
  36. # 上記の例ではランクの低い順に秒,分,時,日,月,年を設定しています.
  37. # また,それぞれ取り得る値の範囲も指定しています.
  38. # (一月30日で年は便宜上9999年を上限としています)
  39. # 例えばdayが25のときに7加算され32になると,
  40. # 結果としてdayは2になり,monは1加算されます.
  41. # このようにして基本となる暦を作成します.
  42. # この部分を任意に変えることで自由な暦を設定できます.
  43. #
  44. # ○ SPECIAL_EXP:ランク以外の特別な暦情報を設定します
  45. # 例えば曜日や季節,時間帯などを設定することができます.
  46. # 設定の仕方は以下のフォーマットにしたがってください.
  47. #   SPECIAL_EXP[:%special%] = ->(cal){
  48. #      任意の式
  49. #   }
  50. # %special%に設定する名前を指定し,対応する任意の式を記述します.
  51. # このときcalにより暦オブジェクトが参照できます.
  52. # 例・時間帯の設定
  53. #   SPECIAL_EXP[:timezone] = ->(cal){
  54. #     case cal.hour
  55. #    when 4,5
  56. #       0 # 早朝は0を返す
  57. #     when 6,7,8
  58. #       1 # 朝は1を返す
  59. #     when 9...16
  60. #       2 # 昼は2を返す
  61. #     when 16,17
  62. #       3 # 夕方は3を返す
  63. #     when 18...22
  64. #       4 # 夜は4を返す
  65. #     when 22...24,0...4
  66. #      5 # 深夜は5を返す
  67. #     end
  68. #   }
  69. #
  70. # ○ TRANSFORM:表示変換の設定を行います.
  71. # 暦を文字列として表現する際,整数以外の形式で表示したい場合に使用します.
  72. # また,全く新しい独自の表示形式を指定することも可能
  73. # 例・月の文字列表記
  74. #   TRANSFORM[:mon] = ->(cal){
  75. #     ["Jan", "Fab", "Mar", "Apr", "May", "Jun",
  76. #      "Jul", "Aug", "Seq", "Oct", "Nov", "Dec"][cal.mon]
  77. #   }
  78. #
  79. # ○ INITIAL_CAL:ゲーム開始時の暦を設定します.
  80. # 設定したいランクと対応する値を指定します.
  81. # 指定されなかったランクの初期値は値の範囲のうち最小のものになります.
  82. # 例
  83. #   INITIAL_CAL = {
  84. #     :day => 15,
  85. #     :mon => 12,
  86. #     :year => 2011
  87. #   }
  88. # この例では2011年12月15日0時0分0秒が初期値となります.
  89. #
  90. # ○ MAP_WINDOW:マップで暦ウインドウを表示するかを設定します.
  91. # この設定はゲーム中以下のスクリプトにて切り替え可能です.
  92. #   $game_map.koyomi_display = true/false
  93. #
  94. # ○ MAP_WINDOW_FADE:マップでの暦ウインドウをフェードするか設定します.
  95. # trueのとき一定時間表示したあとフェードアウトします.
  96. # falseのとき暦ウインドウを常に表示します.
  97. #
  98. # ○ HIDE_MAP_WINDOW:マップで暦ウインドウを常に表示するとき,
  99. #                     ウインドウを一時的に消去できるか設定します.
  100. # この設定はゲーム中以下のスクリプトによって切り替え可能です.
  101. #   $game_koyomi.hide_map_window = true/false
  102. # ○ HIDE_KEY:マップで暦ウインドウを一時的に消去するボタンです.
  103. #              もう一度押すと再び表示します.
  104. # また,次のスクリプトをマップ上で実行するとイベント側から暦ウインドウの
  105. # 一時消去および再表示を行うことができます.
  106. #   $game_map.hide_koyomi_window = true/false
  107. #
  108. # ○ MAP_WINDOW_FORMAT:マップでの暦ウインドウの表示内容を設定します.
  109. # 配列でフォーマットを指定します.一つの要素につき一行となります.
  110. # フォーマットについては後述のメソッドstrftimeを参照してください.
  111. #
  112. # ○ MENU_WINDOW:メニューで暦ウインドウを表示するかを設定します.
  113. #
  114. # ○ MENU_WINDOW_FORAMT:メニューでの暦ウインドウの表示内容を設定します.
  115. # 設定の仕方はMAP_WINDOW_FORMATと同様です.
  116. #
  117. # ○ AUTO_TONE:暦による画面の色調の自動変更を設定します.
  118. # trueの時時間によって画面の色調が自動で変更されます.
  119. # また,イベントコマンドによる画面の色調変更は機能しなくなります.
  120. # ただし,後述する色調固定マップでは機能します.
  121. # この設定はゲーム中以下のスクリプトにて切り替え可能です.
  122. #   $game_koyomi.auto_tone = true/false
  123. #
  124. # ○ AUTO_TONE_DURATION:デフォルトの色調変更時間の設定です.
  125. # 色調変更の条件で色調変更時間が指定されない場合はこの値が適用されます.
  126. #
  127. # ○ AUTO_TONE_COND:色調変更の条件を設定します.
  128. # 色調を変更する条件となる時間とそれに対応する色調(Tone)を指定します.
  129. # 上にある条件ほど優先的にマッチします.
  130. # 条件の指定方法は条件に設定したいrankをキーにして対応する値を直接指定するか
  131. # 値の範囲で指定します.22..4(22...24かつ0..4)のような指定も可能です.
  132. # 範囲に関しては(0...3)の場合0から2まで,0...3の場合0から3までを表します.
  133. # また,対応する色調は以下で指定します.
  134. #   Tone.new(赤(-255~255),緑(-255~255),青(-255~255),グレー(0~255))
  135. # 例・時間帯によって色調を変える
  136. # AUTO_TONE_COND = {
  137. #   {:hour => 16...18} => Tone.new(68,-34,-34,0),
  138. #   {:hour => 18...22} => Tone.new(-34,-34,0,34),
  139. #   {:hour => 22...4} => Tone.new(-68,-68,0,68),
  140. #   {:hour => 4...6} => Tone.new(-34,-34,-34,34),
  141. #   {:hour => 6...9} => Tone.new(34,34,34,34)
  142. # }
  143. #
  144. # ○ FIX_TONE_ON_BATTLE:バトル画面では画面の色調を変更しない設定にできます.
  145. # trueの場合マップで色調が自動変更されている場合でも画面の色調はデフォルト(0,0,0,0)になります.
  146. # また,色調固定マップの場合でもデフォルトの色調になります.
  147. #
  148. # ○ AUTO_TIME_PASS:時間が自動経過するかを設定します.
  149. # この設定はゲーム中以下のスクリプトによって切り替え可能です.
  150. #   $game_koyomi.auto_time_pass = true/false
  151. #
  152. # ○ AUTO_TIME_PASS_DURATION:時間の自動経過間隔を設定します.
  153. # 指定したフレームが経過するごとにTIME_PASSINGで指定した分の時間が経過します.
  154. #
  155. # ○ TIME_PASSING:時間の自動経過量を設定します.
  156. # 加算したいランクと対応する加算量を指定してください.
  157. # 例・1分30秒ずつ加算する
  158. #   TIME_PASSING = {:min => 1, :sec => 30}
  159. #
  160. # ○ STOP_ON_EVENT:イベント中は時間の自動経過を停止するか設定します.
  161. # この設定はゲーム中以下のスクリプトによって切り替え可能です.
  162. #   $game_koyomi.stop_auto_time_pass_on_event = true/false
  163. #
  164. # ○ STOP_ON_BATTLE:バトル中は時間の自動経過を停止するか設定します.
  165. # この設定はゲーム中以下のスクリプトによって切り替え可能です.
  166. #   $game_koyomi.stop_auto_time_pass_on_battle = true/false
  167. #
  168. # ○ MOVE_TIME_PASS:場所移動による時間経過を設定します.
  169. # 「場所移動」が行われる度に時間を経過させることができます.
  170. # 加算したいランクと対応する加算量を指定してください.
  171. # 場所移動により加算したくない場合は空のハッシュを指定してください.
  172. #
  173. # ○ BATTLE_START_TIME_PASS:戦闘開始による時間経過を設定します.
  174. # 戦闘開始時に時間を経過させることができます.
  175. # 加算したいランクと対応する加算量を指定してください.
  176. # 加算したくない場合は空のハッシュを指定してください.
  177. #
  178. # ○ BATTLE_END_TIME_PASS:戦闘終了による時間経過を設定します.
  179. # 戦闘終了時に時間を経過させることができます.
  180. # 加算したいランクと対応する加算量を指定してください.
  181. # 加算したくない場合は空のハッシュを指定してください.
  182. #
  183. # ●暦の操作
  184. # ゲーム中は基本的にスクリプトコマンドから$game_koyomiにアクセスすることで暦を操作できます.
  185. # 以下は$game_koyomiからできる主な操作一覧です.
  186. # ○ $game_koyomi.auto_tone = true/false
  187. # 時間による画面色調の自動変更をするかどうか設定できます.
  188. #
  189. # ○ $game_koyomi.tone_temp_duration = int
  190. # これを設定した次の画面色調自動変更時のみ指定した時間で色調が変化します.
  191. # イベント等で時間を進めた際早く色調を切り替えたいときなどに利用します.
  192. #
  193. # ○ $game_koyomi.move_temp_time_pass = {:rank => value, ...}
  194. # これを指定した次の場所移動時のみ指定した分だけ時間が経過します.
  195. #
  196. # ○ $game_koyomi.battle_start_temp_time_pass = {:rank => value, ...}
  197. # これを指定した次の戦闘開始時のみ指定した分だけ時間が経過します.
  198. #
  199. # ○ $game_koyomi.battle_end_temp_time_pass = {:rank => value, ...}
  200. # これを指定した次の戦闘終了時時のみ指定した分だけ時間が経過します.
  201. #
  202. # ○ $game_koyomi.auto_time_pass = true/false
  203. # 自動で時間を経過させるか設定できます.
  204. #
  205. # ○ $game_koyomi.stop_auto_time_pass_on_event = true/false
  206. # 自動で時間が経過するとき,イベント中は時間経過を停止するか設定できます.
  207. #
  208. # ○ $game_koyomi.stop_auto_time_pass_on_battlet = true/false
  209. # 自動で時間が経過するとき,バトル中は時間経過を停止するか設定できます.
  210. #
  211. # ○ $game_koyomi.rank
  212. # 設定した各ランクの値を取得できます.
  213. # 例・現在の月を取得
  214. #   $game_koyomi.mon
  215. #
  216. # ○ $game_koyomi.rank = value
  217. # 設定した各ランクの値を変更できます.
  218. # 例・現在の月を3に設定
  219. #   $game_koyomi.mon = 3
  220. # 例・3時間進める
  221. #   $game_koyomi.hour += 3
  222. #
  223. # ○ $game_koyomi.special
  224. # 設定した各特殊表現の値を取得できます.
  225. # 例・現在の時間帯を取得
  226. #   $game_koyomi.timezone
  227. #
  228. # ○ $game_koyomi.set(init)
  229. # 暦をセットします.
  230. # initは各ランクと対応する値のハッシュか,後述する起算時からのランク0からみた経過時間
  231. # を指定します.
  232. # 例・ハッシュで暦をセット
  233. #   $game_koyomi.set(year: 2011, mon: 12. day: 15)
  234. # 例・ある暦から得た起算時からの経過時間で暦をセット
  235. #   $game_koyomi.set(koyomi.to_i)
  236. #
  237. # ○ $game_koyomi.time_pass(amount)
  238. # amountに各ランクと対応する値のハッシュを指定して,その分だけ時間を経過させます.
  239. # 例・1月と3時間だけ時間をすすめる
  240. #   $game_koyomi.time_pass(mon: 1, hour: 3)
  241. #
  242. # ○ $game_koyomi.to_i
  243. # 起算時からのランク0からみた経過時間を取得します.
  244. # この結果を変数などに保存することで容易に暦を復元できます.
  245. # 例・暦を整数にして保存・復元する
  246. #   koyomi = $game_koyomi.to_i
  247. #   $game_koyomi.set(koyomi)
  248. #
  249. # ○ $game_koyomi.strftime(format)
  250. # formatに変換文字列を指定して現在の暦を文字列にします.
  251. # format中には以下の二つの特別な文字列を記述することで暦の値を置き換えることができます.
  252. #   <<表示桁#rank>>
  253. # 表示桁は先頭に - または 0 を付けた数字と置き換えます.
  254. # rankは設定したランクのいずれかと置き換えます.
  255. # ランクの値が指定した数字の桁分の幅の文字列と置換されます.
  256. # 先頭に 0 をつけると余った桁0で埋められます.
  257. # 先頭に - をつけると右寄せとなります.
  258. #   <<label>>
  259. # labelはTRANSFORMで指定した変換ラベルと置き換えます.
  260. # TRANSFORMで設定した内容に従って文字列に置換されます.
  261. # 例・2011年12月15日4時00分00秒の暦のとき
  262. #   $game_koyomi.strftime("<<4#year>>-<<4#mon>>-<<04#day>>")
  263. #   #=> 2011-  12-0015
  264. #   $game_koyomi.strftime("<<mon>>-<<-4#day>>:<<timezone>>")
  265. #   #=> Dec-15  :早朝
  266. #
  267. # ●マップの個別設定
  268. # マップのメモ欄に以下を記述することでマップごとに設定を行うことができます.
  269. #   ==暦非表示==
  270. # マップで暦ウインドウを表示する場合でもこの記述があるマップは暦ウインドウを表示しません.
  271. #
  272. #   ==暦停止==
  273. # 自動で時間が経過する場合でもこの記述があるマップは自動で時間が経過しません.
  274. #
  275. #   ==色調固定[r,g,b,gray]==
  276. # 自動で画面色調が変更される場合でもこの記述があるマップは指定した色調になります.
  277. # 屋内マップなどで利用します.薄暗い洞窟等も表現可能です.
  278. # r,g,b,grayはそれぞれ色調(トーン)を指定する値です.
  279. # 例・時間にかかわらず薄暗い洞窟
  280. #   ==色調固定[-34,-34,-34,34]==
  281. #
  282. # ■注意
  283. # このスクリプトでは
  284. # 「RPG::Map」「Game_Map」「Scene_Menu」「Scene_Map」
  285. # 「Game_Screen」「Game_Troop」「Scene_Battle」
  286. # のメソッドを改変しています.
  287. # ■情報
  288. # このスクリプトはgentlawkによって作られたものです.
  289. # 利用規約は[url]http://blueredzone.com[/url]をご覧ください.
  290. #------------------------------------------------------------------------------
  291. module BMSP
  292.   @@includes ||= {}
  293.   @@includes[:KoyomiSystem] = 1.24
  294.   module KoyomiSystem
  295.     #▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽
  296.     #詳細設定
  297.     # ランクの設定
  298.     RANKS = {
  299.       :sec => 0...60,
  300.       :min => 0...60,
  301.       :hour => 0...24,
  302.       :day => 1..30,
  303.       :mon => 1..12,
  304.       :year => 1..9999
  305.     }
  306.     #------------------------------------------------------------
  307.     # ランク以外の暦情報の設定
  308.     SPECIAL_EXP = {}
  309.     SPECIAL_EXP[:timezone] = ->(cal){
  310.       case cal.hour
  311.       when 4,5
  312.         0 # 早朝は0を返す
  313.       when 6,7,8
  314.         1 # 朝は1を返す
  315.       when 9...16
  316.         2 # 昼は2を返す
  317.       when 16,17
  318.         3 # 夕方は3を返す
  319.       when 18...22
  320.         4 # 夜は4を返す
  321.       when 22...24,0...4
  322.         5 # 深夜は5を返す
  323.       end
  324.     }
  325.     #------------------------------------------------------------
  326.     # 表示変換の設定
  327.     TRANSFORM = {}
  328.     TRANSFORM[:mon] = ->(cal){
  329.       ["一月", "二月", "三月", "四月", "五月", "六月",
  330.        "七月", "八月", "九月", "十月", "十一月", "十二月"][cal.mon]
  331.     }
  332.     TRANSFORM[:timezone] = ->(cal){
  333.       case cal.timezone # 上で設定した時間帯で条件分岐
  334.       when 0
  335.         "早朝"
  336.       when 1
  337.         "朝"
  338.       when 2
  339.         "昼"
  340.       when 3
  341.         "夕方"
  342.       when 4
  343.         "夜"
  344.       when 5
  345.         "深夜"
  346.       end
  347.     }
  348.     #------------------------------------------------------------
  349.     # ゲーム開始時の暦
  350.     INITIAL_CAL = {
  351.       :sec => 0,
  352.       :min => 0,
  353.       :hour => 0,
  354.       :day => 7,
  355.       :mon => 5,
  356.       :year => 2017
  357.     }
  358.     #------------------------------------------------------------
  359.     # マップで暦ウインドウを表示するか
  360.     MAP_WINDOW = true
  361.     # マップでの暦ウインドウをフェードするか(falseで常に表示)
  362.     MAP_WINDOW_FADE = false
  363.     # マップでの暦ウインドウの一時消去を許可するか(trueで許可)
  364.     HIDE_MAP_WINDOW = true
  365.     # マップでの暦ウインドウの一時消去ボタン
  366.     # (:DOWN,:UP,:LEFT,:RIGHT,:A,:B,:C,:X,:Y,:Z,:L,:R,:SHIFT,:CTRL,:ALT)
  367.     HIDE_KEY = :L
  368.     # マップでの暦ウインドウの表示内容
  369.     MAP_WINDOW_FORMAT = [
  370.       "<<4#year>>年<<2#mon>>月<<2#day>>日",
  371.       "<<02#hour>>:<<02#min>>:<<02#sec>> [<<timezone>>]"
  372.     ]
  373.     # メニューで暦ウインドウを表示するか
  374.     MENU_WINDOW = true
  375.     # メニューでの暦ウインドウの表示内容
  376.     MENU_WINDOW_FORMAT = [
  377.       "<<4#year>>年<<2#mon>>月<<2#day>>日",
  378.       "<<02#hour>>:<<02#min>>:<<02#sec>>"
  379.     ]
  380.     #------------------------------------------------------------
  381.     # 暦による画面の色調の自動変更
  382.     AUTO_TONE = true
  383.     # デフォルト色調変更時間
  384.     AUTO_TONE_DURATION = 120
  385.     # 色調変更の条件
  386.     AUTO_TONE_COND = {
  387.       {:hour => 16...18} => Tone.new(68,-34,-34,0),
  388.       {:hour => 18...22} => Tone.new(-34,-34,0,34),
  389.       {:hour => 22...4} => Tone.new(-68,-68,0,68),
  390.       {:hour => 4...6} => Tone.new(-34,-34,-34,34),
  391.       {:hour => 6...9} => Tone.new(34,34,34,34)
  392.     }
  393.     # バトル画面では色調を変更しない
  394.     FIX_TONE_ON_BATTLE = false
  395.     #------------------------------------------------------------
  396.     # 時間が自動経過するか
  397.     AUTO_TIME_PASS = true
  398.     # 時間の自動経過間隔
  399.     AUTO_TIME_PASS_DURATION = 15
  400.     # 時間の自動経過量
  401.     TIME_PASSING = {:min => 5}
  402.     # イベント中は自動経過を停止するか
  403.     STOP_ON_EVENT = true
  404.     # バトル中は自動経過を停止するか
  405.     STOP_ON_BATTLE = false
  406.     #------------------------------------------------------------
  407.     # 場所移動による時間経過
  408.     MOVE_TIME_PASS = {:min => 20}
  409.     # 戦闘開始による時間経過
  410.     BATTLE_START_TIME_PASS = {}
  411.     # 戦闘終了による時間経過
  412.     BATTLE_END_TIME_PASS = {}
  413.     #▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽
  414.   end
  415.   #--------------------------------------------------------------------------
  416.   # ● 導入スクリプトのチェック
  417.   #--------------------------------------------------------------------------
  418.   class << self
  419.     if method_defined?(:check_script)
  420.       alias koyomisystem_check_script check_script
  421.     end
  422.   end
  423.   def self.check_script(script, version)
  424.     if methods.include?(:koyomisystem_check_script)
  425.       koyomisystem_check_script(script, version)
  426.     end
  427.     @@includes[script] && @@includes[script] >= version
  428.   end
  429. end
  430. #==============================================================================
  431. # ■ RPG::Map
  432. #==============================================================================
  433. class RPG::Map
  434.   #--------------------------------------------------------------------------
  435.   # ● 暦ウインドウ表示のマップか
  436.   #--------------------------------------------------------------------------
  437.   def bmsp_koyomisystem_display_koyomi_on_map?
  438.     return @bmsp_koyomi_display if @bmsp_koyomi_display
  439.     @bmsp_koyomi_display = !self.note.include?('==暦非表示==')
  440.   end
  441.   #--------------------------------------------------------------------------
  442.   # ● 色調固定
  443.   #--------------------------------------------------------------------------
  444.   def bmsp_koyomisystem_fix_tone
  445.     return @bmsp_fix_tone unless @bmsp_fix_tone.nil?
  446.     if self.note =~ /==色調固定\[([+-]?\d+),([+-]?\d+),([+-]?\d+),([+-]?\d+)\]==/
  447.       r,g,b,gray = $1.to_i,$2.to_i,$3.to_i,$4.to_i
  448.       @bmsp_fix_tone = Tone.new(r,g,b,gray)
  449.     else
  450.       @bmsp_fix_tone = false
  451.     end
  452.   end
  453.   #--------------------------------------------------------------------------
  454.   # ● 暦停止のマップか
  455.   #--------------------------------------------------------------------------
  456.   def bmsp_koyomisystem_koyomi_stop?
  457.     return @bmsp_koyomi_stop if @bmsp_koyomi_stop
  458.     @bmsp_koyomi_stop = self.note.include?('==暦停止==')
  459.   end
  460. end
  461. #==============================================================================
  462. # ■ Game_Koyomi
  463. #==============================================================================
  464. class Game_Koyomi
  465.   #============================================================================
  466.   # ■ Ranks
  467.   #============================================================================
  468.   module Ranks
  469.     #--------------------------------------------------------------------------
  470.     # ● モジュール変数
  471.     #--------------------------------------------------------------------------
  472.     @@ranks = BMSP::KoyomiSystem::RANKS
  473.     @@transform = BMSP::KoyomiSystem::TRANSFORM
  474.     #--------------------------------------------------------------------------
  475.     # ● ランクの取得
  476.     #--------------------------------------------------------------------------
  477.     def self.ranks
  478.       @@ranks
  479.     end
  480.     #--------------------------------------------------------------------------
  481.     # ● 表示変換
  482.     #--------------------------------------------------------------------------
  483.     def self.transform(label)
  484.       @@transform[label]
  485.     end
  486.     #--------------------------------------------------------------------------
  487.     # ● ランクの取得(順位指定)
  488.     #--------------------------------------------------------------------------
  489.     def self.rank(i)
  490.       r = @@ranks.to_a[i]
  491.       return nil if r.nil?
  492.       r.first
  493.     end
  494.     #--------------------------------------------------------------------------
  495.     # ● ノーマライズ
  496.     #--------------------------------------------------------------------------
  497.     def self.normalize(i, rank)
  498.       i - @@ranks[rank].min
  499.     end
  500.     #--------------------------------------------------------------------------
  501.     # ● 指定した範囲の値か
  502.     #--------------------------------------------------------------------------
  503.     def self.include_range?(rank, range, value)
  504.       rank_min = @@ranks[rank].min
  505.       rank_max = @@ranks[rank].max
  506.       range_min = range.min
  507.       range_max = range.max
  508.       unless range_min.nil? || range_max.nil? # 有効なRange
  509.         min = [[range_min, rank_min].max, rank_max].min
  510.         max = [[range_max, rank_min].max, rank_max].min
  511.         (min..max).include?(value)
  512.       else # 無効なRange
  513.         first = range.first
  514.         last = range.last
  515.         nf = [[first, rank_min].max, rank_max].min
  516.         nl = [[last, rank_min].max, rank_max].min
  517.         range1 = (nf..rank_max)
  518.         range2 = nl <= last && range.exclude_end? ? (rank_min...nl) : (rank_min..nl)
  519.         range1.include?(value) || range2.include?(value)
  520.       end
  521.     end
  522.     #--------------------------------------------------------------------------
  523.     # ● ランクを一つ進める
  524.     #--------------------------------------------------------------------------
  525.     def self.succ(rank)
  526.       find = false
  527.       @@ranks.each do |r,|
  528.         return r if find
  529.         find = true if r == rank
  530.       end
  531.       return nil
  532.     end
  533.   end
  534.   #============================================================================
  535.   #--------------------------------------------------------------------------
  536.   # ● 公開インスタンス変数
  537.   #--------------------------------------------------------------------------
  538.   attr_accessor :auto_tone # 画面の色調自動変更フラグ
  539.   attr_accessor :tone_temp_duration # 画面の色調時間一時変更フラグ
  540.   attr_accessor :move_temp_time_pass # 場所移動による時間経過一時変更フラグ
  541.   attr_accessor :battle_start_temp_time_pass # 戦闘開始による時間経過一時変更フラグ
  542.   attr_accessor :battle_end_temp_time_pass # 戦闘終了による時間経過一時変更フラグ
  543.   attr_accessor :auto_time_pass # 時間自動経過フラグ
  544.   attr_accessor :stop_auto_time_pass_on_event # イベント中時間自動経過停止フラグ
  545.   attr_accessor :stop_auto_time_pass_on_battle # バトル中時間自動経過停止フラグ
  546.   attr_reader :fix_tone_on_battle # バトル画面色調固定フラグ
  547.   attr_accessor :hide_map_window # 暦ウインドウ一時消去許可フラグ
  548.   #--------------------------------------------------------------------------
  549.   # ● ランクアクセサの定義
  550.   #--------------------------------------------------------------------------
  551.   Ranks.ranks.each_key do |rank|
  552.     reader = rank
  553.     writer = :"#{rank}="
  554.     define_method(reader){ @calendar[rank] }
  555.     define_method(writer){ |value| @calendar[rank] = value; fit; value }
  556.   end
  557.   #--------------------------------------------------------------------------
  558.   # ● 特別表現リーダーの定義
  559.   #--------------------------------------------------------------------------
  560.   BMSP::KoyomiSystem::SPECIAL_EXP.each do |special, exp|
  561.     define_method(special){ exp.call(self) }
  562.   end
  563.   #--------------------------------------------------------------------------
  564.   # ● オブジェクト初期化
  565.   #--------------------------------------------------------------------------
  566.   def initialize(init= {})
  567.     # 各種設定の初期化
  568.     @auto_tone = BMSP::KoyomiSystem::AUTO_TONE
  569.     @tone_temp_duration = 0
  570.     @default_tone = Tone.new(0,0,0,0)
  571.     @auto_time_pass = BMSP::KoyomiSystem::AUTO_TIME_PASS
  572.     @auto_time_pass_amount = {
  573.       :duration => BMSP::KoyomiSystem::AUTO_TIME_PASS_DURATION,
  574.       :amount => BMSP::KoyomiSystem::TIME_PASSING
  575.     }
  576.     @move_time_pass = BMSP::KoyomiSystem::MOVE_TIME_PASS
  577.     @battle_start_time_pass = BMSP::KoyomiSystem::BATTLE_START_TIME_PASS
  578.     @battle_end_time_pass = BMSP::KoyomiSystem::BATTLE_END_TIME_PASS
  579.     @stop_auto_time_pass_on_event = BMSP::KoyomiSystem::STOP_ON_EVENT
  580.     @stop_auto_time_pass_on_battle = BMSP::KoyomiSystem::STOP_ON_BATTLE
  581.     @fix_tone_on_battle = BMSP::KoyomiSystem::FIX_TONE_ON_BATTLE
  582.     @hide_map_window = BMSP::KoyomiSystem::HIDE_MAP_WINDOW
  583.     # 暦の初期化
  584.     set(init)
  585.   end
  586.   #--------------------------------------------------------------------------
  587.   # ● 範囲外の暦を修正
  588.   #--------------------------------------------------------------------------
  589.   def fit
  590.     carry = 0
  591.     @calendar.each_key do |rank|
  592.       @calendar[rank] += carry
  593.       value = @calendar[rank]
  594.       if Ranks.ranks[rank].include?(value)
  595.         carry = 0
  596.       else
  597.         n_value = Ranks.normalize(value, rank)
  598.         card = Ranks.ranks[rank].count
  599.         carry = n_value / card
  600.         @calendar[rank] = n_value % card + Ranks.ranks[rank].min
  601.       end
  602.     end
  603.     @int = calc_to_i
  604.   end
  605.   #--------------------------------------------------------------------------
  606.   # ● 暦のセット
  607.   #--------------------------------------------------------------------------
  608.   def set(init)
  609.     @calendar = {}
  610.     ini_h = init.is_a?(Hash) ? init : {}
  611.     Ranks.ranks.each_key do |rank|
  612.       @calendar[rank] =
  613.         ini_h[rank] ? ini_h[rank] : Ranks.ranks[rank].min
  614.     end
  615.     @calendar[Ranks.rank(0)] += init if init.is_a?(Integer)
  616.     fit
  617.   end
  618.   #--------------------------------------------------------------------------
  619.   # ● 時間自動経過の設定
  620.   #--------------------------------------------------------------------------
  621.   def set_auto_time_pass(passing)
  622.     @auto_time_pass_amount[:duration] = passing[:duration] if passing[:duration]
  623.     @auto_time_pass_amount[:amount] = passing[:amount] if passing[:amount]
  624.   end
  625.   #--------------------------------------------------------------------------
  626.   # ● フレーム更新
  627.   #--------------------------------------------------------------------------
  628.   def update(screen)
  629.     update_auto_time_pass
  630.     update_auto_tone(screen)
  631.   end
  632.   #--------------------------------------------------------------------------
  633.   # ● 時間経過
  634.   #--------------------------------------------------------------------------
  635.   def time_pass(amount)
  636.     amount.each do |rank, value|
  637.       next unless @calendar[rank]
  638.       @calendar[rank] += value
  639.     end
  640.     fit
  641.   end
  642.   #--------------------------------------------------------------------------
  643.   # ● イベント中判定
  644.   #--------------------------------------------------------------------------
  645.   def check_event_running?
  646.     if $game_party.in_battle
  647.       $game_troop.interpreter.running?
  648.     elsif !$BTEST
  649.       $game_map.interpreter.running?
  650.     end
  651.   end
  652.   #--------------------------------------------------------------------------
  653.   # ● 時間自動経過
  654.   #--------------------------------------------------------------------------
  655.   def update_auto_time_pass
  656.     return unless @auto_time_pass
  657.     return if @stop_auto_time_pass_on_event && check_event_running?
  658.     return if @stop_auto_time_pass_on_battle && $game_party.in_battle
  659.     return if !$BTEST && $game_map.map.bmsp_koyomisystem_koyomi_stop?
  660.     if @auto_time_pass_amount[:duration] > 0
  661.       return if Graphics.frame_count % @auto_time_pass_amount[:duration] != 0
  662.       time_pass(@auto_time_pass_amount[:amount])
  663.     end
  664.   end
  665.   #--------------------------------------------------------------------------
  666.   # ● 場所移動による時間経過
  667.   #--------------------------------------------------------------------------
  668.   def move_time_pass
  669.     unless @move_temp_time_pass
  670.       time_pass(@move_time_pass)
  671.     else
  672.       time_pass(@move_temp_time_pass)
  673.       @move_temp_time_pass = nil
  674.     end
  675.   end
  676.   #--------------------------------------------------------------------------
  677.   # ● 戦闘開始による時間経過
  678.   #--------------------------------------------------------------------------
  679.   def battle_start_time_pass
  680.     unless @battle_start_temp_time_pass
  681.       time_pass(@battle_start_time_pass)
  682.     else
  683.       time_pass(@battler_start_temp_time_pass)
  684.       @battle_start_temp_time_pass = nil
  685.     end
  686.   end
  687.   #--------------------------------------------------------------------------
  688.   # ● 戦闘終了による時間経過
  689.   #--------------------------------------------------------------------------
  690.   def battle_end_time_pass
  691.     unless @battle_end_temp_time_pass
  692.       time_pass(@battle_end_time_pass)
  693.     else
  694.       time_pass(@battler_end_temp_time_pass)
  695.       @battle_end_temp_time_pass = nil
  696.     end
  697.   end
  698.   #--------------------------------------------------------------------------
  699.   # ● 画面の色調自動変更
  700.   #--------------------------------------------------------------------------
  701.   def update_auto_tone(screen)
  702.     return if !@auto_tone || (!$BTEST && $game_map.map.bmsp_koyomisystem_fix_tone)
  703.     return if $game_party.in_battle && @fix_tone_on_battle
  704.     target_tone,duration = get_match_tone
  705.     return if target_tone.nil? || screen.tone_target == target_tone
  706.     # 変更時間の設定
  707.     duration = BMSP::KoyomiSystem::AUTO_TONE_DURATION if duration.nil?
  708.     duration = @tone_temp_duration ? @tone_temp_duration : duration
  709.     @tone_temp_duration = nil
  710.     # 色調変更
  711.     screen.start_tone_change(target_tone, duration)
  712.   end
  713.   #--------------------------------------------------------------------------
  714.   # ● 条件にマッチする色調の取得
  715.   #--------------------------------------------------------------------------
  716.   def get_match_tone
  717.     BMSP::KoyomiSystem::AUTO_TONE_COND.each do |cond, (tone,duration)|
  718.       next unless cond.each { |rank, range|
  719.         case range
  720.         when Range
  721.           break unless Ranks.include_range?(rank, range, @calendar[rank])
  722.         else # それ以外(整数指定)
  723.           break if @calendar[rank] != range
  724.         end
  725.       }
  726.       return tone,duration
  727.     end
  728.     @default_tone
  729.   end
  730.   #--------------------------------------------------------------------------
  731.   # ● 暦を一つ進める
  732.   #--------------------------------------------------------------------------
  733.   def succ
  734.     rank0 = Ranks.rank(0)
  735.     @calendar[rank0] += 1
  736.     fit
  737.   end
  738.   #--------------------------------------------------------------------------
  739.   # ● 文字列フォーマット
  740.   #--------------------------------------------------------------------------
  741.   def strftime(format)
  742.     format = format.dup
  743.     Ranks.ranks.each_key do |rank|
  744.       pattern = /<<(-?)(0?)(\d)#(#{rank.to_s})>>/
  745.       format.gsub!(pattern){
  746.         left,zero,digit,r = $1,$2,$3,$4
  747.         sprintf("%#{left + zero + digit}d", @calendar[rank])
  748.       }
  749.     end
  750.     format.gsub!(/<<(.+?)>>/){
  751.      trans =  Ranks.transform($1.to_sym)
  752.      trans.nil? ? "###" : trans.call(self)
  753.     }
  754.     format
  755.   end
  756.   #--------------------------------------------------------------------------
  757.   # ● オブジェクト複製
  758.   #--------------------------------------------------------------------------
  759.   def dup
  760.     Marshal.load(Marshal.dump self)
  761.   end
  762.   #--------------------------------------------------------------------------
  763.   # ● 起算時からのランク0からみた経過時間の計算
  764.   #--------------------------------------------------------------------------
  765.   def calc_to_i
  766.     @int = @calendar.each.reverse_each.inject(0) { |sum, (rank, value)|
  767.       sum * Ranks.ranks[rank].count + Ranks.normalize(value, rank)
  768.     }
  769.   end
  770.   #--------------------------------------------------------------------------
  771.   # ● 起算時からのランク0からみた経過時間の取得
  772.   #--------------------------------------------------------------------------
  773.   def to_i
  774.     @int
  775.   end
  776.   #--------------------------------------------------------------------------
  777.   # ● 比較演算子
  778.   #--------------------------------------------------------------------------
  779.   def ==(koyomi)
  780.     self.to_i == koyomi.to_i
  781.   end
  782.   def !=(koyomi)
  783.     self.to_i != koyomi.to_i
  784.   end
  785.   def <(koyomi)
  786.     self.to_i < koyomi.to_i
  787.   end
  788.   def <=(koyomi)
  789.     self.to_i <= koyomi.to_i
  790.   end
  791.   def >(koyomi)
  792.     self.to_i > koyomi.to_i
  793.   end
  794.   def >=(koyomi)
  795.     self.to_i >= koyomi.to_i
  796.   end
  797.   def <=>(koyomi)
  798.     self.to_i <=> koyomi.to_i
  799.   end
  800. end
  801. #==============================================================================
  802. # ■ DataManager
  803. #==============================================================================
  804. module DataManager
  805.   #--------------------------------------------------------------------------
  806.   # ● 各種ゲームオブジェクトの作成
  807.   #--------------------------------------------------------------------------
  808.   instance_eval{ alias bmsp_koyomisystem_create_game_objects create_game_objects }
  809.   def self.create_game_objects
  810.     bmsp_koyomisystem_create_game_objects
  811.     $game_koyomi = Game_Koyomi.new(BMSP::KoyomiSystem::INITIAL_CAL)
  812.   end
  813.   #--------------------------------------------------------------------------
  814.   # ● セーブ内容の作成
  815.   #--------------------------------------------------------------------------
  816.   instance_eval{ alias bmsp_koyomisystem_make_save_contents make_save_contents }
  817.   def self.make_save_contents
  818.     contents = bmsp_koyomisystem_make_save_contents
  819.     contents[:koyomi] = $game_koyomi
  820.     contents
  821.   end
  822.   #--------------------------------------------------------------------------
  823.   # ● セーブ内容の展開
  824.   #--------------------------------------------------------------------------
  825.   instance_eval{ alias bmsp_koyomisystem_extract_save_contents extract_save_contents }
  826.   def self.extract_save_contents(contents)
  827.     bmsp_koyomisystem_extract_save_contents(contents)
  828.     $game_koyomi = contents[:koyomi]
  829.   end
  830. end
  831. #==============================================================================
  832. # ■ Game_Map
  833. #==============================================================================
  834. class Game_Map
  835.   #--------------------------------------------------------------------------
  836.   # ● 公開インスタンス変数
  837.   #--------------------------------------------------------------------------
  838.   attr_reader :map # 現在のマップデータ
  839.   attr_accessor :koyomi_display             # 暦表示フラグ
  840.   #--------------------------------------------------------------------------
  841.   # ● オブジェクト初期化
  842.   #--------------------------------------------------------------------------
  843.   alias bmsp_koyomisytem_initialize initialize
  844.   def initialize
  845.     bmsp_koyomisytem_initialize
  846.     @koyomi_display = BMSP::KoyomiSystem::MAP_WINDOW
  847.   end
  848.   #--------------------------------------------------------------------------
  849.   # ● セットアップ
  850.   #--------------------------------------------------------------------------
  851.   alias bmsp_koyomisystem_setup setup
  852.   def setup(map_id)
  853.     bmsp_koyomisystem_setup(map_id)
  854.     # 色調固定処理
  855.     bmsp_koyomisystem_change_fix_tone
  856.   end
  857.   #--------------------------------------------------------------------------
  858.   # ● 色調固定マップの処理
  859.   #--------------------------------------------------------------------------
  860.   def bmsp_koyomisystem_change_fix_tone
  861.     tone = self.map.bmsp_koyomisystem_fix_tone
  862.     if tone # 色調固定
  863.       self.screen.start_tone_change(tone, 0)
  864.     else # それ以外
  865.       if $game_koyomi.auto_tone
  866.         tone,duration = $game_koyomi.get_match_tone
  867.         self.screen.start_tone_change(tone, 0)
  868.       else
  869.         self.screen.start_tone_change(Tone.new(0,0,0,0), 0)
  870.       end
  871.     end
  872.   end
  873.   #--------------------------------------------------------------------------
  874.   # ● 暦ウィンドウの一時消去
  875.   #--------------------------------------------------------------------------
  876.   def hide_koyomi_window=(hidden)
  877.     return unless SceneManager.scene_is?(Scene_Map)
  878.    
  879.     koyomi_window = SceneManager.scene.instance_eval{@bmsp_koyomi_window}
  880.     if $game_map.koyomi_display && !BMSP::KoyomiSystem::MAP_WINDOW_FADE
  881.       if $game_koyomi.hide_map_window
  882.         koyomi_window.hide_window if koyomi_window.hidden != hidden
  883.       end
  884.     end
  885.   end
  886. end
  887. #==============================================================================
  888. # ■ Scene_Menu
  889. #==============================================================================
  890. class Scene_Menu < Scene_MenuBase
  891.   #--------------------------------------------------------------------------
  892.   # ● 開始処理
  893.   #--------------------------------------------------------------------------
  894.   alias bmsp_koyomisystem_start start
  895.   def start
  896.     bmsp_koyomisystem_start
  897.     bmsp_koyomisystem_create_koyomi_window if BMSP::KoyomiSystem::MENU_WINDOW
  898.   end
  899.   #--------------------------------------------------------------------------
  900.   # ● 暦ウィンドウの作成
  901.   #--------------------------------------------------------------------------
  902.   def bmsp_koyomisystem_create_koyomi_window
  903.     @bmsp_koyomi_window = BMSP::KoyomiSystem::Window_MenuKoyomi.new
  904.     @bmsp_koyomi_window.x = 0
  905.     @bmsp_koyomi_window.y = Graphics.height - @gold_window.height - @bmsp_koyomi_window.height
  906.     if BMSP.check_script(:EXPDistribution, 1.00) && BMSP::EXPDistribution::EXP_WINDOW
  907.       @bmsp_koyomi_window.y -= @bmsp_koyomi_window.fitting_height(1)
  908.     end
  909.   end
  910. end
  911. #==============================================================================
  912. # ■ Scene_Map
  913. #==============================================================================
  914. class Scene_Map < Scene_Base
  915.   #--------------------------------------------------------------------------
  916.   # ● 全ウィンドウの作成
  917.   #--------------------------------------------------------------------------
  918.   alias bmsp_koyomisystem_create_all_windows create_all_windows
  919.   def create_all_windows
  920.     bmsp_koyomisystem_create_all_windows
  921.     bmsp_koyomisystem_create_koyomi_window
  922.   end
  923.   #--------------------------------------------------------------------------
  924.   # ● 暦ウィンドウの作成
  925.   #--------------------------------------------------------------------------
  926.   def bmsp_koyomisystem_create_koyomi_window
  927.     @bmsp_koyomi_window = BMSP::KoyomiSystem::Window_MapKoyomi.new
  928.   end
  929.   #--------------------------------------------------------------------------
  930.   # ● 場所移動前の処理
  931.   #--------------------------------------------------------------------------
  932.   alias bmsp_koyomisystem_pre_transfer pre_transfer
  933.   def pre_transfer
  934.     @bmsp_koyomi_window.close
  935.     bmsp_koyomisystem_pre_transfer
  936.     bmsp_koyomisystem_move_time_pass
  937.   end
  938.   #--------------------------------------------------------------------------
  939.   # ● 場所移動後の処理
  940.   #--------------------------------------------------------------------------
  941.   alias bmsp_koyomisystem_post_transfer post_transfer
  942.   def post_transfer
  943.     @bmsp_koyomi_window.open unless BMSP::KoyomiSystem::MAP_WINDOW_FADE
  944.     bmsp_koyomisystem_post_transfer
  945.     @bmsp_koyomi_window.open if BMSP::KoyomiSystem::MAP_WINDOW_FADE
  946.   end
  947.   #--------------------------------------------------------------------------
  948.   # ● 場所移動による時間経過
  949.   #--------------------------------------------------------------------------
  950.   def bmsp_koyomisystem_move_time_pass
  951.     $game_koyomi.move_time_pass
  952.   end
  953. end
  954. #==============================================================================
  955. # ■ BMSP::KoyomiSystem::Window_MenuKoyomi
  956. #==============================================================================
  957. class BMSP::KoyomiSystem::Window_MenuKoyomi < Window_Base
  958.   #--------------------------------------------------------------------------
  959.   # ● オブジェクト初期化
  960.   #--------------------------------------------------------------------------
  961.   def initialize
  962.     line_number = BMSP::KoyomiSystem::MENU_WINDOW_FORMAT.size
  963.     super(0, 0, window_width, fitting_height(line_number))
  964.     @time = $game_koyomi.to_i
  965.     @formats = BMSP::KoyomiSystem::MENU_WINDOW_FORMAT
  966.     refresh
  967.   end
  968.   #--------------------------------------------------------------------------
  969.   # ● ウィンドウ幅の取得
  970.   #--------------------------------------------------------------------------
  971.   def window_width
  972.     return 160
  973.   end
  974.   #--------------------------------------------------------------------------
  975.   # ● フレーム更新
  976.   #--------------------------------------------------------------------------
  977.   def update
  978.     super
  979.     refresh if redraw?
  980.   end
  981.   #--------------------------------------------------------------------------
  982.   # ● 再描画するか
  983.   #--------------------------------------------------------------------------
  984.   def redraw?
  985.     if $game_koyomi.to_i != @time
  986.       @time = $game_koyomi.to_i
  987.       return true
  988.     end
  989.     false
  990.   end
  991.   #--------------------------------------------------------------------------
  992.   # ● リフレッシュ
  993.   #--------------------------------------------------------------------------
  994.   def refresh
  995.     contents.clear
  996.     draw_background(contents.rect)
  997.     rect = contents.rect
  998.     rect.height = line_height
  999.     rect.y = 0
  1000.     @formats.each do |format|
  1001.       draw_text(rect, $game_koyomi.strftime(format), 1)
  1002.       rect.y += line_height
  1003.     end
  1004.   end
  1005.   #--------------------------------------------------------------------------
  1006.   # ● 背景の描画
  1007.   #--------------------------------------------------------------------------
  1008.   def draw_background(rect)
  1009.   end
  1010. end
  1011. #==============================================================================
  1012. # ■ BMSP::KoyomiSystem::Window_MapKoyomi
  1013. #==============================================================================
  1014. class BMSP::KoyomiSystem::Window_MapKoyomi < BMSP::KoyomiSystem::Window_MenuKoyomi
  1015.   #--------------------------------------------------------------------------
  1016.   # ● 公開インスタンス変数
  1017.   #--------------------------------------------------------------------------
  1018.   attr_reader :hidden
  1019.   #--------------------------------------------------------------------------
  1020.   # ● オブジェクト初期化
  1021.   #--------------------------------------------------------------------------
  1022.   def initialize
  1023.     super
  1024.     line_number = BMSP::KoyomiSystem::MAP_WINDOW_FORMAT.size
  1025.     x= Graphics.width - window_width
  1026.     move(x, 0, window_width, fitting_height(line_number))
  1027.     self.opacity = 0
  1028.     if BMSP::KoyomiSystem::MAP_WINDOW_FADE || !$game_map.koyomi_display
  1029.       self.contents_opacity = 0
  1030.     end
  1031.     @show_count = BMSP::KoyomiSystem::MAP_WINDOW_FADE ? 0 : 1
  1032.     @time = $game_koyomi.to_i
  1033.     @formats = BMSP::KoyomiSystem::MAP_WINDOW_FORMAT
  1034.     @hidden = false
  1035.     open
  1036.   end
  1037.   #--------------------------------------------------------------------------
  1038.   # ● ウィンドウ幅の取得
  1039.   #--------------------------------------------------------------------------
  1040.   def window_width
  1041.     return 320
  1042.   end
  1043.   #--------------------------------------------------------------------------
  1044.   # ● フレーム更新
  1045.   #--------------------------------------------------------------------------
  1046.   def update
  1047.     super
  1048.     if @show_count > 0 && BMSP::KoyomiSystem::MAP_WINDOW_FADE
  1049.       if $game_map.koyomi_display || self.contents_opacity != 0
  1050.         update_fadein
  1051.         @show_count -= 1
  1052.       end
  1053.     elsif @show_count == 0
  1054.       update_fadeout
  1055.     elsif $game_map.koyomi_display && !BMSP::KoyomiSystem::MAP_WINDOW_FADE
  1056.       if $game_koyomi.hide_map_window
  1057.         hide_window if Input.trigger?(BMSP::KoyomiSystem::HIDE_KEY)
  1058.       else # 一時消去中にウインドウの消去が禁止になった場合は表示する
  1059.         hide_window if @hidden
  1060.       end
  1061.       if @show_count > 1
  1062.         @hidden ? update_fadeout : update_fadein
  1063.         @show_count -= 1
  1064.       end
  1065.     end
  1066.   end
  1067.   #--------------------------------------------------------------------------
  1068.   # ● フェードインの更新
  1069.   #--------------------------------------------------------------------------
  1070.   def update_fadein
  1071.     self.contents_opacity += 16
  1072.   end
  1073.   #--------------------------------------------------------------------------
  1074.   # ● フェードアウトの更新
  1075.   #--------------------------------------------------------------------------
  1076.   def update_fadeout
  1077.     self.contents_opacity -= 16
  1078.   end
  1079.   #--------------------------------------------------------------------------
  1080.   # ● ウインドウの一時消去切り替え
  1081.   #--------------------------------------------------------------------------
  1082.   def hide_window
  1083.     @hidden = !@hidden
  1084.     @show_count = 17
  1085.   end
  1086.   #--------------------------------------------------------------------------
  1087.   # ● ウィンドウを開く
  1088.   #--------------------------------------------------------------------------
  1089.   def open
  1090.     refresh
  1091.     if $game_map.map.bmsp_koyomisystem_display_koyomi_on_map?
  1092.       if !$game_map.koyomi_display
  1093.         @show_count = 0
  1094.         self.contents_opacity = 0
  1095.       elsif BMSP::KoyomiSystem::MAP_WINDOW_FADE
  1096.         @show_count = 150
  1097.         self.contents_opacity = 0
  1098.       else
  1099.         if @hidden # 一時消去中
  1100.           @show_count = 1
  1101.           self.contents_opacity = 0
  1102.         else
  1103.           @show_count = 1
  1104.           self.contents_opacity = 255
  1105.         end
  1106.       end
  1107.     else
  1108.       @show_count = 0
  1109.       self.contents_opacity = 0
  1110.     end
  1111.     self
  1112.   end
  1113.   #--------------------------------------------------------------------------
  1114.   # ● ウィンドウを閉じる
  1115.   #--------------------------------------------------------------------------
  1116.   def close
  1117.     @show_count = 0 if BMSP::KoyomiSystem::MAP_WINDOW_FADE
  1118.     self
  1119.   end
  1120.   #--------------------------------------------------------------------------
  1121.   # ● 背景の描画
  1122.   #--------------------------------------------------------------------------
  1123.   def draw_background(rect)
  1124.     temp_rect = rect.clone
  1125.     temp_rect.width /= 2
  1126.     contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
  1127.     temp_rect.x = temp_rect.width
  1128.     contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
  1129.   end
  1130.   #--------------------------------------------------------------------------
  1131.   # ● 背景色 1 の取得
  1132.   #--------------------------------------------------------------------------
  1133.   def back_color1
  1134.     Color.new(0, 0, 0, 192)
  1135.   end
  1136.   #--------------------------------------------------------------------------
  1137.   # ● 背景色 2 の取得
  1138.   #--------------------------------------------------------------------------
  1139.   def back_color2
  1140.     Color.new(0, 0, 0, 0)
  1141.   end
  1142. end
  1143. #==============================================================================
  1144. # ■ Game_Screen
  1145. #==============================================================================
  1146. class Game_Screen
  1147.   #--------------------------------------------------------------------------
  1148.   # ● 公開インスタンス変数
  1149.   #--------------------------------------------------------------------------
  1150.   attr_reader :tone_target
  1151.   #--------------------------------------------------------------------------
  1152.   # ● フレーム更新
  1153.   #--------------------------------------------------------------------------
  1154.   alias bmsp_koyomisystem_update update
  1155.   def update
  1156.     bmsp_koyomisystem_update
  1157.     bmsp_koyomisystem_update_koyomi
  1158.   end
  1159.   #--------------------------------------------------------------------------
  1160.   # ● 暦の更新
  1161.   #--------------------------------------------------------------------------
  1162.   def bmsp_koyomisystem_update_koyomi
  1163.     $game_koyomi.update(self)
  1164.   end
  1165. end
  1166. #==============================================================================
  1167. # ■ Game_Troop
  1168. #==============================================================================
  1169. class Game_Troop < Game_Unit
  1170.   #--------------------------------------------------------------------------
  1171.   # ● セットアップ
  1172.   #--------------------------------------------------------------------------
  1173.   def setup(troop_id)
  1174.     clear
  1175.     @troop_id = troop_id
  1176.     @enemies = []
  1177.     troop.members.each do |member|
  1178.       next unless $data_enemies[member.enemy_id]
  1179.       enemy = Game_Enemy.new(@enemies.size, member.enemy_id)
  1180.       enemy.hide if member.hidden
  1181.       enemy.screen_x = member.x
  1182.       enemy.screen_y = member.y
  1183.       @enemies.push(enemy)
  1184.     end
  1185.     init_screen_tone
  1186.     make_unique_names
  1187.   end
  1188.   #--------------------------------------------------------------------------
  1189.   # ● 画面の色調を初期化
  1190.   #--------------------------------------------------------------------------
  1191.   alias bmsp_koyomisystem_init_screen_tone init_screen_tone
  1192.   def init_screen_tone
  1193.     bmsp_koyomisystem_init_screen_tone
  1194.     bmsp_koyomisystem_battle_start_time_pass
  1195.     bmsp_koyomisystem_fix_tone_on_battle
  1196.   end
  1197.   #--------------------------------------------------------------------------
  1198.   # ● 戦闘開始による時間経過
  1199.   #--------------------------------------------------------------------------
  1200.   def bmsp_koyomisystem_battle_start_time_pass
  1201.     $game_koyomi.battle_start_time_pass
  1202.     return if !@auto_tone || (!$BTEST && $game_map.map.bmsp_koyomisystem_fix_tone)
  1203.     tone,duration = $game_koyomi.get_match_tone
  1204.     $game_troop.screen.start_tone_change(tone, 0)
  1205.   end
  1206.   #--------------------------------------------------------------------------
  1207.   # ● バトル中の色調固定
  1208.   #--------------------------------------------------------------------------
  1209.   def bmsp_koyomisystem_fix_tone_on_battle
  1210.     return unless $game_koyomi.fix_tone_on_battle
  1211.     $game_troop.screen.start_tone_change(Tone.new(0,0,0,0), 0)
  1212.   end
  1213. end
  1214. #==============================================================================
  1215. # ■ Scene_Battle
  1216. #==============================================================================
  1217. class Scene_Battle < Scene_Base
  1218.   #--------------------------------------------------------------------------
  1219.   # ● 終了処理
  1220.   #--------------------------------------------------------------------------
  1221.   alias bmsp_koyomisystem_terminate terminate
  1222.   def terminate
  1223.     bmsp_koyomisystem_terminate
  1224.     bmsp_koyomisystem_battle_end_time_pass
  1225.   end
  1226.   #--------------------------------------------------------------------------
  1227.   # ● 戦闘終了による時間経過
  1228.   #--------------------------------------------------------------------------
  1229.   def bmsp_koyomisystem_battle_end_time_pass
  1230.     $game_koyomi.battle_end_time_pass
  1231.     return if !$game_koyomi.auto_tone || (!$BTEST && $game_map.map.bmsp_koyomisystem_fix_tone)
  1232.     tone,duration = $game_koyomi.get_match_tone
  1233.     $game_map.screen.start_tone_change(tone, 0)
  1234.   end
  1235. end

  1236.                                                
复制代码


状态感染
  1. #==============================================================================
  2. #
  3. # ¥ Yami Engine Symphony - Infective State
  4. # -- Last Updated: 2012.12.14
  5. # -- Level: Easy
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YES-InfectiveState"] = true

  11. #==============================================================================
  12. # ¥ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.12.14 - Finished Script.
  15. # 2012.12.12 - Started Script.
  16. #
  17. #==============================================================================
  18. # ¥ Introduction
  19. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  20. # This script provides infect feature for specific states.
  21. #
  22. #==============================================================================
  23. # ¥ Instructions
  24. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  25. # To install this script, open up your script editor and copy/paste this script
  26. # to an open slot below ¥ Materials/‘fÞ but above ¥ Main. Remember to save.
  27. #
  28. # -----------------------------------------------------------------------------
  29. # State Notetags - These notetags go in the state notebox in the database.
  30. # -----------------------------------------------------------------------------
  31. # <infect allies x: y, z%>
  32. # Infects all allies with state x after y turns with a chance of z%.
  33. #
  34. # <infect enemies x: y, z%>
  35. # Infects all enemies with state x after y turns with a chance of z%.
  36. #
  37. # <infect n allies x: y, z%>
  38. # Infects n allies with state x after y turns with a chance of z%.
  39. #
  40. # <infect n enemies x: y, z%>
  41. # Infects n enemies with state x after y turns with a chance of z%.
  42. #
  43. #==============================================================================
  44. # ¥ Compatibility
  45. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  46. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  47. # it will run with RPG Maker VX without adjustments.
  48. #
  49. #==============================================================================

  50. #==============================================================================
  51. # ¥ Editting anything past this point may potentially result in causing
  52. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  53. # halitosis so edit at your own risk.
  54. #==============================================================================

  55. #==============================================================================
  56. # ¡ Regular Expression
  57. #==============================================================================

  58. module REGEXP
  59.   module INFECTIVE_STATE
  60.     INFECT_ALLY = /<(?:INFECT ALLIES)[ ](\d+):[ ]*(\d+)(?:,[ ]*(\d+)[%“]?)?>/i
  61.     INFECT_ENEMY  = /<(?:INFECT ENEMIES)[ ](\d+):[ ]*(\d+)(?:,[ ]*(\d+)[%“]?)?>/i
  62.     INFECT_X_ALLY = /<(?:INFECT[ ](\d+)[ ]ALLIES)[ ](\d+):[ ]*(\d+)(?:,[ ]*(\d+)[%“]?)?>/i
  63.     INFECT_X_ENEMY = /<(?:INFECT[ ](\d+)[ ]ENEMIES)[ ](\d+):[ ]*(\d+)(?:,[ ]*(\d+)[%“]?)?>/i
  64.   end # INFECTIVE_STATE
  65. end # REGEXP

  66. #==============================================================================
  67. # ¡ DataManager
  68. #==============================================================================

  69. module DataManager
  70.    
  71.   #--------------------------------------------------------------------------
  72.   # alias method: load_database
  73.   #--------------------------------------------------------------------------
  74.   class <<self; alias load_database_infective_state load_database; end
  75.   def self.load_database
  76.     load_database_infective_state
  77.     initialize_infective_state
  78.   end
  79.   
  80.   #--------------------------------------------------------------------------
  81.   # new method: initialize_infective_state
  82.   #--------------------------------------------------------------------------
  83.   def self.initialize_infective_state
  84.     groups = [$data_states]
  85.     groups.each { |group|
  86.       group.each { |obj|
  87.         next if obj.nil?
  88.         obj.initialize_infective_state
  89.       }
  90.     }
  91.   end
  92.   
  93. end # DataManager

  94. #==============================================================================
  95. # ¡ RPG::BaseItem
  96. #==============================================================================

  97. class RPG::BaseItem
  98.   
  99.   #--------------------------------------------------------------------------
  100.   # * Public Instance Variables
  101.   #--------------------------------------------------------------------------
  102.   attr_accessor :infect_allies
  103.   attr_accessor :infect_enemies

  104.   #--------------------------------------------------------------------------
  105.   # new method: initialize_infective_state
  106.   #--------------------------------------------------------------------------
  107.   def initialize_infective_state
  108.     @infect_allies = {}
  109.     @infect_enemies = {}
  110.     self.note.split(/[\r\n]+/).each { |line|
  111.       case line
  112.       when REGEXP::INFECTIVE_STATE::INFECT_ALLY
  113.         array = [0, $2.to_i, $3.to_i]
  114.         array[2] = 100 if array[2] <= 0
  115.         @infect_allies[$1.to_i] = array if array[1] > 0
  116.       when REGEXP::INFECTIVE_STATE::INFECT_ENEMY
  117.         array = [0, $2.to_i, $3.to_i]
  118.         array[2] = 100 if array[2] <= 0
  119.         @infect_enemies[$1.to_i] = array if array[1] > 0
  120.       when REGEXP::INFECTIVE_STATE::INFECT_X_ALLY
  121.         array = [$1.to_i, $3.to_i, $4.to_i]
  122.         array[2] = 100 if array[2] <= 0
  123.         @infect_allies[$2.to_i] = array if array[1] > 0
  124.       when REGEXP::INFECTIVE_STATE::INFECT_X_ENEMY
  125.         array = [$1.to_i, $3.to_i, $4.to_i]
  126.         array[2] = 100 if array[2] <= 0
  127.         @infect_enemies[$2.to_i] = array if array[1] > 0
  128.       end
  129.     }
  130.   end
  131.   
  132. end # RPG::BaseItem

  133. #==============================================================================
  134. # ¡ Game_Battler
  135. #==============================================================================

  136. class Game_Battler < Game_BattlerBase
  137.   
  138.   #--------------------------------------------------------------------------
  139.   # new method: infective_states
  140.   #--------------------------------------------------------------------------
  141.   def infective_states
  142.     states.select { |state|
  143.       state.infect_allies.size + state.infect_enemies.size > 0
  144.     }
  145.   end
  146.   
  147.   #--------------------------------------------------------------------------
  148.   # new method: infective_allies
  149.   #--------------------------------------------------------------------------
  150.   def infective_allies
  151.     states.select { |state|
  152.       state.infect_allies.size > 0
  153.     }
  154.   end
  155.   
  156.   #--------------------------------------------------------------------------
  157.   # new method: infective_enemies
  158.   #--------------------------------------------------------------------------
  159.   def infective_enemies
  160.     states.select { |state|
  161.       state.infect_enemies.size > 0
  162.     }
  163.   end
  164.   
  165.   #--------------------------------------------------------------------------
  166.   # new method: infect_allies_include?
  167.   #--------------------------------------------------------------------------
  168.   def infect_allies_include?(id)
  169.     infective_allies.any? { |state| state.infect_allies.keys.include?(id) }
  170.   end
  171.   
  172.   #--------------------------------------------------------------------------
  173.   # new method: infect_enemies_include?
  174.   #--------------------------------------------------------------------------
  175.   def infect_enemies_include?(id)
  176.     infective_enemies.any? { |state| state.infect_enemies.keys.include?(id) }
  177.   end
  178.   
  179.   #--------------------------------------------------------------------------
  180.   # new method: infective_calc
  181.   #--------------------------------------------------------------------------
  182.   def update_infective
  183.     @infect_allies ||= {}
  184.     @infect_enemies ||= {}
  185.     #---
  186.     infective_allies.each { |state|
  187.       state.infect_allies.each { |id, hash|
  188.         @infect_allies[id] = hash[1] if @infect_allies[id].nil? || @infect_allies[id] <= 0
  189.         @infect_allies[id] -= 1
  190.       }
  191.     }
  192.     #---
  193.     infective_enemies.each { |state|
  194.       state.infect_enemies.each { |id, hash|
  195.         @infect_enemies[id] = hash[1] if @infect_enemies[id].nil? || @infect_enemies[id] <= 0
  196.         @infect_enemies[id] -= 1
  197.       }
  198.     }
  199.     #---
  200.     infective_allies.each { |state|
  201.       state.infect_allies.each { |id, hash|
  202.         next if @infect_allies[id] > 0
  203.         if self.actor?
  204.           battlers = $game_party.battle_members
  205.         else
  206.           battlers = $game_troop.members
  207.         end
  208.         if hash[0] <= 0
  209.           if rand(100) < hash[2]
  210.             battlers.each { |battler| battler.add_state(id) }
  211.           end
  212.         else
  213.           count = hash[0]
  214.           battlers = battlers.shuffle
  215.           battlers.each { |battler|
  216.             if battler && battler.alive? && !battler.state?(id)
  217.               if rand(100) > hash[2]
  218.                 battler.add_state(id)
  219.                 count -= 1
  220.               end
  221.             end
  222.             break if count <= 0
  223.           }
  224.         end
  225.       }
  226.     }
  227.     #---
  228.     infective_enemies.each { |state|
  229.       state.infect_enemies.each { |id, hash|
  230.         next if @infect_enemies[id] > 0
  231.         next if rand(100) > hash[2]
  232.         if self.actor?
  233.           battlers = $game_troop.members
  234.         else
  235.           battlers = $game_party.battle_members
  236.         end
  237.         if hash[0] <= 0
  238.           if rand(100) < hash[2]
  239.             battlers.each { |battler| battler.add_state(id) }
  240.           end
  241.         else
  242.           count = hash[0]
  243.           battlers = battlers.shuffle
  244.           battlers.each { |battler|
  245.             if battler && battler.alive? && !battler.state?(id)
  246.               if rand(100) > hash[2]
  247.                 battler.add_state(id)
  248.                 count -= 1
  249.               end
  250.             end
  251.             break if count <= 0
  252.           }
  253.         end
  254.       }
  255.     }
  256.   end
  257.   
  258.   #--------------------------------------------------------------------------
  259.   # new method: infective_clear
  260.   #--------------------------------------------------------------------------
  261.   def infective_clear
  262.     @infect_allies.each_key { |id|
  263.       @infect_allies[id] = nil unless infect_allies_include?(id)
  264.     }
  265.     #---
  266.     @infect_enemies.each_key { |id|
  267.       @infect_enemies[id] = nil unless infect_enemies_include?(id)
  268.     }
  269.   end
  270.   
  271.   #--------------------------------------------------------------------------
  272.   # alias method: on_turn_end
  273.   #--------------------------------------------------------------------------
  274.   alias yes_infect_state_on_turn_end on_turn_end
  275.   def on_turn_end
  276.     yes_infect_state_on_turn_end
  277.     update_infective
  278.     infective_clear
  279.   end
  280.   
  281. end # Game_Battler

  282. #==============================================================================
  283. #
  284. # ¥ End of File
  285. #
  286. #==============================================================================
复制代码


临死技(仅敌人有效)
  1. =begin
  2.       RGSS3

  3.       ★ 断末魔 ★

  4.       戦闘不能になる直前に指定のスキルを発動するエネミーを作れます。
  5.       
  6.       ● 仕様 ●==========================================================
  7.       断末魔を発動したエネミーは、
  8.       自身を断末魔スキルの効果対象にすることはできません。
  9.       ====================================================================
  10.       
  11.       ● 使い方 ●========================================================
  12.       エネミーのメモ欄に「临死技:n」と記述してください。
  13.       nには断末魔として発動させるスキルIDを指定してください。
  14.       ====================================================================
  15.       
  16.       ver1.00

  17.       Last Update : 2015/05/13
  18.       5/13 : RGSS2にあったものを移植
  19.       
  20.       ろかん   [url]http://kaisou-ryouiki.sakura.ne.jp/[/url]
  21. =end

  22. $rsi ||= {}
  23. $rsi["临死技"] = true

  24. class RPG::Enemy < RPG::BaseItem
  25.   def death_throes_id
  26.     unless @death_throes_id
  27.       @death_throes_id = 0
  28.       self.note.each_line{|line|
  29.         if line =~ /临死技:(\d+)/i
  30.           @death_throes_id = $1.to_i
  31.           break
  32.         end
  33.       }
  34.     end
  35.     @death_throes_id
  36.   end
  37. end

  38. class << BattleManager
  39.   #--------------------------------------------------------------------------
  40.   # ● ターン終了
  41.   #--------------------------------------------------------------------------
  42.   alias death_throes_turn_end turn_end
  43.   def turn_end
  44.     death_throes_turn_end if @phase
  45.   end
  46. end

  47. class Game_Battler < Game_BattlerBase
  48.   #--------------------------------------------------------------------------
  49.   # ● 断末魔をあげるバトラーであるか
  50.   #--------------------------------------------------------------------------
  51.   def death_throes?
  52.     false
  53.   end
  54. end

  55. class Game_Action
  56.   #--------------------------------------------------------------------------
  57.   # ● 断末魔のターゲットの配列作成
  58.   #--------------------------------------------------------------------------
  59.   def make_targets_with_death_throes
  60.     if item.for_opponent?
  61.       targets_for_opponents
  62.     elsif item.for_friend?
  63.       targets_for_friends_with_death_throes
  64.     else
  65.       []
  66.     end
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # ● 味方に対するターゲット
  70.   #--------------------------------------------------------------------------
  71.   def targets_for_friends_with_death_throes
  72.     if item.for_user?
  73.       []
  74.     elsif item.for_dead_friend?
  75.       if item.for_one?
  76.         [friends_unit.smooth_dead_target(@target_index)]
  77.       else
  78.         friends_unit.dead_members
  79.       end
  80.     elsif item.for_friend?
  81.       result = friends_unit.alive_members
  82.       result.delete(@subject)
  83.       if item.for_one?
  84.         result.empty? ? [] : [result.sample]
  85.       else
  86.         result
  87.       end
  88.     end
  89.   end
  90. end

  91. class Game_Enemy < Game_Battler
  92.   #--------------------------------------------------------------------------
  93.   # ● 公開インスタンス変数
  94.   #--------------------------------------------------------------------------
  95.   attr_accessor :gave_death_throes
  96.   #--------------------------------------------------------------------------
  97.   # ● オブジェクト初期化
  98.   #--------------------------------------------------------------------------
  99.   alias death_throes_initialize initialize
  100.   def initialize(index, enemy_id)
  101.     death_throes_initialize(index, enemy_id)
  102.     @gave_death_throes = false # 既に断末魔をあげたかの判断に利用
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # ● 断末魔をあげるバトラーであるか
  106.   #--------------------------------------------------------------------------
  107.   def death_throes?
  108.     @result.added_states.include?(death_state_id) && !death_throes_id.zero? && !@gave_death_throes
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ● 断末魔で発動するスキルID
  112.   #--------------------------------------------------------------------------
  113.   def death_throes_id
  114.     enemy.death_throes_id
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # ● 戦闘不能から復活
  118.   #--------------------------------------------------------------------------
  119.   def revive
  120.     super
  121.     @gave_death_throes = false
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 戦闘不能判定
  125.   #--------------------------------------------------------------------------
  126.   def dead?
  127.     (!death_throes_id.zero? && !@gave_death_throes) ? false : super
  128.   end
  129.   #--------------------------------------------------------------------------
  130.   # ● 生存判定
  131.   #--------------------------------------------------------------------------
  132.   def alive?
  133.     (!death_throes_id.zero? && !@gave_death_throes) ? true : super
  134.   end
  135.   #--------------------------------------------------------------------------
  136.   # ● 断末魔行動の作成
  137.   #--------------------------------------------------------------------------
  138.   def make_death_throes_actions
  139.     clear_actions
  140.     action = Game_Action.new(self, true)
  141.     action.set_skill(death_throes_id)
  142.     @actions.push(action)
  143.   end
  144. end

  145. class Window_BattleLog < Window_Selectable
  146.   #--------------------------------------------------------------------------
  147.   # ● 断末魔用メソッドの設定
  148.   #--------------------------------------------------------------------------
  149.   def method_death_throes=(method)
  150.     @method_death_throes = method
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ● 影響を受けたステータスの表示
  154.   #--------------------------------------------------------------------------
  155.   alias death_throes_display_affected_status display_affected_status
  156.   def display_affected_status(target, item)
  157.     if target.death_throes?
  158.       wait_and_clear
  159.       last_added_states = target.result.added_states.dup
  160.       @method_death_throes.call(target)
  161.       target.result.added_states = last_added_states
  162.       death_throes_display_affected_status(target, item)
  163.       wait_and_clear
  164.       BattleManager.judge_win_loss
  165.     else
  166.       death_throes_display_affected_status(target, item)
  167.     end
  168.   end
  169. end

  170. class Scene_Battle < Scene_Base
  171.   #--------------------------------------------------------------------------
  172.   # ● ログウィンドウの作成
  173.   #--------------------------------------------------------------------------
  174.   alias death_throes_create_log_window create_log_window
  175.   def create_log_window
  176.     death_throes_create_log_window
  177.     @log_window.method_death_throes = method(:process_death_throes)
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● 断末魔の処理
  181.   #--------------------------------------------------------------------------
  182.   def process_death_throes(user)
  183.     last_subject = @subject
  184.     @subject = user
  185.     @subject.make_death_throes_actions
  186.     targets = @subject.current_action.make_targets_with_death_throes.compact
  187.     unless targets.empty?
  188.       if @subject.current_action
  189.         @status_window.open
  190.         use_death_throes(targets)
  191.         @subject.remove_current_action
  192.         process_action_end
  193.       end
  194.     end
  195.     @subject.gave_death_throes = true
  196.     @subject = last_subject
  197.     update_for_wait
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # ● 断末魔の使用
  201.   #--------------------------------------------------------------------------
  202.   def use_death_throes(targets)
  203.     @subject.sprite_effect_type = :whiten
  204.     item = @subject.current_action.item
  205.     @log_window.display_use_item(@subject, item)
  206.     @subject.use_item(item)
  207.     refresh_status
  208.     show_animation(targets, item.animation_id)
  209.     targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  210.     @log_window.wait_and_clear
  211.   end
  212. end
复制代码



随即出售商品
  1. =begin

  2.   說明:
  3.   
  4.   事件中執行腳本呼叫隨機物品商店
  5.   
  6.     random_shop(group, number)
  7.     例:隨機出售組:A中的三件商品:  random_shop(:A, 3)
  8.   
  9.    
  10.   打折出售
  11.   
  12.     random_shop(group, number, disount)
  13.     例:8折出售商品: random_shop(:B, 4, 0.8)
  14.    
  15.    
  16.   不讓玩家出售物品
  17.   
  18.     random_shop(group, number, discount, purchase_only)
  19.     例(須設定折扣):random_shop(:C, 20, 1, 1)
  20.    
  21. =end


  22. class Game_Interpreter
  23.   Random_Goods = { #在這裡定義你的商品列表
  24.   :A => [:i1],
  25.     :时空商人 => [:i1_29, :i154],
  26.     :时空商人2 => [:i1_29, :i154],
  27.     :时空商人3 => [:i1_29, :i97, :i154],
  28.     :时空商人4 => [:i1_29, :i64_i68, :i154],
  29.     :时空商人5 => [:i1_29, :i154],
  30.     :时空商人6 => [:i1_29, :i109, :i154],
  31.     :时空商人7 => [:i1_29],
  32.     :时空商人8 => [:i1_29, :i86, :i154],
  33.     :时空商人9 => [:i1_29, :i154],
  34.     :时空商人10 => [:i1_29, :i104, :i154],
  35.     :时空商人11 => [:i1_29, :i71, :i154],
  36.     :时空商人12 => [:i1_29, :i72, :i154],
  37.     :时空商人13 => [:i1_29, :i130_i132, :i154],
  38.     :时空商人14 => [:i1_29, :i154],
  39.     :时空商人15 => [:i1_29, :i82, :i154],
  40.     :神器商人 => [:w71_75],
  41.     :C => [:w1_60]#i物品,w武器,每個組用逗號隔開
  42.   }
  43.   # 設置變數號碼,當變數改變后商人才會更新商品
  44.   # 設置為 nil 的話,每次跟商人對話商品都會更新
  45.   Goods_Change_Var = 86
  46.   #
  47.   def random_shop(group, num, discount = 1, purchase_only = false)
  48.     return if $game_party.in_battle
  49.     goods = []
  50.     Random_Goods[group].each {|g|
  51.       g = g.to_s
  52.       type = g[0]=="i" ? 0 : g[0]=="w" ? 1 : 2
  53.       if g.include?("_")
  54.         a, b = g.scan(/\d+/)
  55.         for i in a.to_i..b.to_i
  56.           begin
  57.             goods.push(random_goods_info(discount, type, i))
  58.           rescue
  59.             report_random_goods_crash(group, g)
  60.             return
  61.           end
  62.         end
  63.       else
  64.         g =~ /(\d+)/
  65.         begin
  66.           goods.push(random_goods_info(discount, type, $1.to_i))
  67.         rescue
  68.           report_random_goods_crash(group, g)
  69.           return
  70.         end
  71.       end
  72.     }
  73.     SceneManager.call(Scene_Shop)
  74.     SceneManager.scene.prepare(new_random_goods(goods, num), purchase_only)
  75.     Fiber.yield
  76.   end
  77.   #
  78.   def new_random_goods(goods, num)
  79.     return unless event = get_character(0)
  80.     if Goods_Change_Var
  81.       key = [@map_id, @event_id, :random_goods]
  82.       var = $game_variables[Goods_Change_Var]
  83.       unless $game_self_switches.get_value(key) &&
  84.              $game_self_switches.get_value(key)[0] == var
  85.         goods = goods.sample(num).sort
  86.         $game_self_switches.set_without_refresh(key, [var, goods])
  87.         return goods
  88.       else
  89.         return $game_self_switches.get_value(key)[1]
  90.       end
  91.     else
  92.       return goods.sample(num).sort
  93.     end
  94.   end
  95.   #
  96.   def random_goods_info(discount, type, i)
  97.     discount == 1 ?
  98.       [type, i, 0, which_random_goods(type)[i].price] :
  99.       [type, i, 1, (which_random_goods(type)[i].price * discount).round]
  100.   end
  101.   def which_random_goods(type)
  102.     case type
  103.     when 0; $data_items
  104.     when 1; $data_weapons
  105.     when 2; $data_armors
  106.     end
  107.   end
  108.   #
  109.   def report_random_goods_crash(group, g)
  110.     msgbox("隨機商店發生錯誤:Group :#{group}  Element :#{g}") if $TEST
  111.   end
  112. end

  113. class Game_SelfSwitches
  114.   def set_without_refresh(key, value)
  115.     @data[key] = value
  116.   end
  117.   def get_value(key)
  118.     @data[key]
  119.   end
  120. end
复制代码


随机礼物(两个随机在图书馆有)
  1. =begin

  2.   說明:
  3.   
  4.   事件中執行腳本呼叫來獲取隨機物品
  5.   
  6.     random_gift(group, number)
  7.     例:隨機獲得組:A中的三件物品:  random_gift(:A, 3)
  8.    
  9. =end

  10. class Game_Interpreter
  11.   Random_Gifts = { #隨機獎品列表
  12.     :恢复 => [:i1_8], #i物品,w武器,每個組用逗號隔開
  13.     :符文 => [:i9_16],
  14.     :升阶 => [:i17_19],
  15.     :宝珠 => [:i22_29],
  16.     :终焉宝珠 => [:i140_144],
  17.     :攻击神器 => [:w71_75],
  18.     :防御神器 => [:a82_89],
  19.     :时空之光 => [:a108_116],
  20.     :点数 => [:i137_139],
  21.     :低级素材 => [:i1_8, :i20, :i21, :i35_37, :i17_19],
  22.     :中级素材 => [:i9_16, :i38, :i39, :i119, :i132],
  23.     :高级素材 => [:i114, :i103, :i70_72, :i56, :i45,:i22_29],
  24.    
  25.    
  26.    
  27. :奖池普 => [:i9_16, :i38, :i39, :i119, :i132,:i114, :i103, :i70_72, :i56, :i45,:i22_29],
  28. :王者 => [:i9_16, :i38, :i39, :i119, :i132,:i114, :i103, :i70_72, :i56, :i45,:i22_29,:i172_180,:i140_144],
  29. :礼装 => [:i9_16, :i38, :i39, :i119, :i132,:i114, :i103, :i70_72, :i56, :i45,:i22_29,:a118_131],

  30.    
  31.    
  32.     :谱尼 => [:i130_132, :i119,:i144,:i70_72,:i53,:i46],
  33.     :票 => [:i1_8, :i17_19],
  34.     :券 => [:i1_8, :i17_19, :i9_16, :i22_29, :i137_139],
  35.     :药水 => [:i47, :i48, :i53_i56, :i84, :i85, :i78, :i133_i135, :i1_i8],
  36.     :各种礼包 => [:i145_152, :i154, :i155, :i157],
  37.     :末日 => [:i3, :i5, :i6, :i30, :i31, :i36, :i37, :i17_19, :i119, :i152],
  38.     :C => [:w1_60]
  39.   }
  40.   # 設置開關號碼,當開關開啟時一定會獲取到不同的幾件物品
  41.   # 設置為 nil 的話則總是有可能獲取到相同的物品
  42.   Diff_Gift_Swth = nil
  43.   def display_gift_text(name)
  44.     $game_message.add("获得:" + name)
  45.   end
  46.   #
  47.   def random_gift(group, num)
  48.     gifts = []
  49.     Random_Gifts[group].each {|g|
  50.       g = g.to_s
  51.       type = g[0]=="i" ? 0 : g[0]=="w" ? 1 : 2
  52.       if g.include?("_")
  53.         a, b = g.scan(/\d+/)
  54.         for i in a.to_i..b.to_i
  55.           gift = which_random_gift(type)[i]
  56.           gift ? gifts.push(gift) : (return report_random_gifts_crash(group, g))
  57.         end
  58.       else
  59.         g =~ /(\d+)/
  60.         gift = which_random_gift(type)[$1.to_i]
  61.         gift ? gifts.push(gift) : (return report_random_gifts_crash(group, g))
  62.       end
  63.     }
  64.     wait_for_message
  65.     if Diff_Gift_Swth && $game_switches[Diff_Gift_Swth]
  66.       gifts.sample(num).each {|g|
  67.         $game_party.gain_item(g, 1)
  68.         display_gift_text(g.name)
  69.       }
  70.     else
  71.       num.times {
  72.         g = gifts[rand(gifts.size)]
  73.         $game_party.gain_item(g, 1)
  74.         display_gift_text(g.name)
  75.       }
  76.     end
  77.     $game_message.face_name = ''
  78.     $game_message.face_index = 0
  79.     $game_message.background = 0
  80.     $game_message.position = 2
  81.     wait_for_message
  82.   end
  83.   #
  84.   def which_random_gift(type)
  85.     case type
  86.     when 0; $data_items
  87.     when 1; $data_weapons
  88.     when 2; $data_armors
  89.     end
  90.   end
  91.   #
  92.   def report_random_gifts_crash(group, g)
  93.     msgbox("隨機禮物發生錯誤:Group :#{group}  Element :#{g}") if $TEST
  94.   end
  95. end
复制代码


新套装系统(6RVA帖应该功能最全了)
  1. #============================================================================
  2. # Equipment Sets v2.1e
  3. # By Emerald
  4. #----------------------------------------------------------------------------
  5. # You're free to use the script for any game, as long as you give credits
  6. #----------------------------------------------------------------------------
  7. # Version History
  8. # 1.0 -> Script fully ready for public use. Addes sets, unlimited set items,
  9. #        set bonuses for the 8 basic stats, set bonuses requirement (how many
  10. #        items of the set is the actor wearing?)
  11. # 1.1 -> a. changed the set bonuses work. Instead of [parameter, bonus] you now
  12. #        use [sort, parameter, bonus]. Also added sorts 0 and 2. Check SPECIAL
  13. #        VALUES for their corresponding parameters.
  14. #        b. Added sort 1: Standard Parameters (Percentage). The corresponding
  15. #        parameters are the same as for sort 0. See SPECIAL VALUES for extra
  16. #        notes.
  17. # 1.2 -> Added Sort 3: Special Parameters. The values for the parameters can be
  18. #        found in SPECIAL VALUES, just as usual. Addes Sort 4: Skills!! These
  19. #        use a different syntax than the other bonuses, so be sure to check
  20. #        SPECIAL VALUES if you are unfamiliar with them.
  21. # 1.3 -> a. rewritten most of the code to remove so major bugs. Also cleaned
  22. #        code (about 140 lines less this time, WITH 4 added Sorts). Added
  23. #        Module Emerald (EME). Sets and Set_Bonuses move to Module EME. Added
  24. #        MAX_ELEMENTS to Module EME. Added Sort 5 (Elemental Efficiency), Sort
  25. #        6 (Debuff Rate), Sort 7 (State Rate), Sort 8 (State Resist) and Sort 9
  26. #        (Attack Elements). See SPECIAL VALUES for instructions.
  27. #        WARNING these are still in Beta Stage, so report all bugs found.  
  28. #        b. removed many, MANY major bugs! Removed a bug where unequipping
  29. #        resulted in an undefined array, removed some typos, fixed the bonuses
  30. #        for almost EVERY Sort, removed some more typos, shortened code a little
  31. #        bit, removed some more minor bugs regarding change_equip.
  32. # 1.4 -> More bug fixes. Also added Sort 10 (Attack States), Sort 11 (Equipment
  33. #        Types) and Sort 12 (Attack Specials). Refer to SPECIAL VALUES for
  34. #        all needed information.
  35. # 1.5 -> Bug fix to discard_equip(...). Added the foruth value of Sort 11
  36. #        (Dual Wielding), added Sort 13, Sort 14, Sort 15, Sort 16 and Sort 17
  37. #        which are Additional Skill Types, Sealed Skill Types, Sealed Skills,
  38. #        Fixed Equip Types and Sealed Equip Types respectively. As usual, go to
  39. #        SPECIAL VALUES for the needed instructions.
  40. # 1.6 -> Added a compatibility patch for Fomar's Dual Wield -> Free Hands script.
  41. # 1.7 -> Added Sorts 18 (special flags), 19 (party abilities) and 20 (other
  42. #        traits). See SPECIAL VALUES for the instructions.
  43. # 1.8a-> Added sounds to be played when a certain amount of set pieces has been
  44. #        equipped. Also removed a bug regarding skipping amounts of pieces.
  45. # 1.8b-> Small bugfix regarding set sounds.
  46. # 1.8c-> Small bugfix regarding attack states.
  47. #
  48. # 2.0 -> MAJOR REWRITE. Aliased a few more methods than before, to further
  49. #        increases compatability. Added a method which initializes sets which
  50. #        are worn by actors at the start of the game. Halved the code used to
  51. #        determine if items belong to sets. Scraped a few uneccessairy methods.
  52. #        Practically removed 2/3 of my version of release_unequipable_equips,
  53. #        and made the EES + Fomar123's Dual Wield -> Free Hands script patch
  54. #        1 line instead of 10. Almost entirely changed the way Set Skills and
  55. #        Set Equipment Options work. Also fixed a few bugs in the progress
  56. #        (for example additions of variable 2 which I accidentally left in the
  57. #        script.)
  58. # 2.1a-> Start of the debugging patch. Added a function to remove bonuses when
  59. #        unequipping stuff, like usual. Forgot to re-add in 2.0 >.<
  60. # 2.1b-> Fixed a small typo.
  61. # 2.1c-> Fixed initalizition of set equips.
  62. # 2.1d-> Fixed a bug regarding bonuses not being applied upon optimizing equips
  63. #        and a bug regarding the removing of bonuses when unequipping stuff.
  64. # 2.1e-> Removed something which I should have added (regarding the BaseItem
  65. #        class) in release_unequippable_items. This also fixed the compatibility
  66. #        issues with Tsukihime's Effect Manager.
  67. #----------------------------------------------------------------------------
  68. # Started with a Iron Sword? Pretty good. Found a Gold Sword? Awesome! Found
  69. # the complete Bronze Set? Bad stuff...
  70. # Unless, they give you bonuses! In other words, this script allows you to create
  71. # bonuses for wearing multiple items of a set... Just wanted to make it sound
  72. # more fun...
  73. #
  74. # Instructions:
  75. #
  76. # Just as always, put this script between Бе Materials and Бе Main. Put this script
  77. # below any script which rewrites change_equip and above any script which aliases
  78. # 'param' in Game_Actor (usually in Game_BattlerBase, but it only matters if it
  79. # is rewritten/aliased in Game_Actor).
  80. #
  81. # Set MAX_ELEMENTS below module EME and above Sets to the maximum number of
  82. # elements in the database. Else, the script won't recognize any above the value.
  83. #
  84. #
  85. # SETS
  86. #
  87. # To create sets (sorry, no names yet) go to Sets in the configuration part.
  88. # Add the set id, followed by an array containing arrays. The latter arrays
  89. # must be at least two elements long, one for the type of equipment, one for the
  90. # id.
  91. # Examples:
  92. #
  93. # 1 => [[0, 1], [1, 2]], <- The []'s define an array. The arrays like the [0,1]
  94. # and [1, 2] should be at least two elements long (each element is separated by
  95. # a comma.
  96. #
  97. # 2 => [[0, 5], [0, 6], [1, 5], [1,7]], <- If the array is not the last in the
  98. # list, add a comma or you'll get an error. This goes for every array.
  99. #
  100. # set id => [[equipment type, equipment id], [equipment type, equipment id]]
  101. #
  102. # NOTE:
  103. # The set id MUST be 0 or higher. The variable in which the sets are stored (which
  104. # is called a hash) usually begins with 1 =>, so that's why that's also in the
  105. # standard config.
  106. # The Equipment Types are 0 (weapons) and 1 (armors.)
  107. # DO NOT COPY the ID of items in the database. If you put all the useless 0's
  108. # in front of the real ID, you'll get an error/the script won't work.
  109. # Furthermore, you can have an infinite amount of equipment belonging (is that a
  110. # word?) to a set, so don't worry about compatibility issues with Extra Equipment
  111. # Slots scripts. Unless they rewrite change_equip, than there's a slight chance
  112. # on problems. This can be fixed, however, by putting this script below any
  113. # script which rewrites change_equip.
  114. # Also, you can have multiple weapons in array and the same equipment in different
  115. # sets.
  116. #
  117. #
  118. # SET BONUSES
  119. #
  120. # For set bonuses, go to Set_Bonuses. Use the follwing syntax to add bonuses:
  121. #
  122. # set id => {
  123. #    amount of pieces required => [[sort, parameter, bonus]]
  124. #           },
  125. #
  126. # Specifications:
  127. # set id = the same set id as in Sets.
  128. #
  129. # amount of pieces required = the amount of pieces the player must be wearing in
  130. # order to receive the bonuses. If you want to skip one, just skip it. Like:
  131. # 1 => blablabla
  132. # 3 => blablabla
  133. #
  134. # sort = type of bonus. For all sorts, see SPECIAL VALUES.
  135. #
  136. # parameter = the parameter which receives the bonus. For all parameters, see
  137. # SPECIAL VALUES.
  138. #
  139. # bonus = the bonus to be added to parameter. Note that this is a direct bonus,
  140. # not a percentage. If the vale is negative, the bonus will become negative. If
  141. # the value is 0, there will be no bonus to that stat.
  142. #
  143. #
  144. # SPECIAL VALUES
  145. # Sets
  146. # ----
  147. # Equipment types: 0 and 1. 0 is the Weapons tab in the database, 1 is the
  148. # Armors tab in the database.
  149. #
  150. # Set_Bonuses
  151. # ---
  152. # Sorts:
  153. # 0  - Standard Parameter
  154. # 1  - Standard Parameter (Percentage)
  155. # 2  - Extra Parameter
  156. # 3  - Special Paramater
  157. # 4  - Skills (WARNING, DIFFERENT SYNTAX!! See Skills on how to use them)
  158. # 5  - Elemental Efficiency
  159. # 6  - Debuff Rate
  160. # 7  - State Rate
  161. # 8  - State Resistance (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
  162. # 9  - Attack Elements (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
  163. # 10 - Attack States
  164. # 11 - Equipment Types (WARNING, DIFFERENT SYNTAX!! See Equipment Types on how
  165. #                       to use them)
  166. # 12 - Attack Specials
  167. # 13 - Additional Skill Types (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
  168. # 14 - Sealed Skill Types (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
  169. # 15 - Sealed Skills (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
  170. # 16 - Fixed Equip Types (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
  171. # 17 - Sealed Equip Types (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
  172. # 18 - Special Flags (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
  173. # 19 - Party Abilities (WARNING, VALUE HAS A DIFFERENT FUNCTION!!)
  174. # 20 - Other Traits
  175. #
  176. # Standard Parameters: (Sort 0)
  177. # 0 - MaxHp
  178. # 1 - MaxMp
  179. # 2 - Attack
  180. # 3 - Defense
  181. # 4 - Magic Attack (Spirit)
  182. # 5 - Magic Defence (Resistance)
  183. # 6 - Agility
  184. # 7 - Luck
  185. #
  186. # Standard Parameters (Percentage): (Sort 1)
  187. # 0 - MaxHp
  188. # 1 - MaxMp
  189. # 2 - Attack
  190. # 3 - Defense
  191. # 4 - Magic Attack (Spirit)
  192. # 5 - Magic Defence (Resistance)
  193. # 6 - Agility
  194. # 7 - Luck
  195. # Note that stats are calculated this way:
  196. # Basic + Equipment Bonuses + Set Bonuses (normal) + Set Bonuses (percentages,
  197. # equal to bonus% (in [1, parameter, bonus]) * basic + equipment bonuses)
  198. #
  199. # Extra Parameters: (Sort 2)
  200. # 0 - Hit Rate
  201. # 1 - Evasion
  202. # 2 - Critical Rate
  203. # 3 - Critical Evasion
  204. # 4 - Magical Evasion
  205. # 5 - Magical Reflection
  206. # 6 - Counter Rate
  207. # 7 - HP Regen
  208. # 8 - MP Regen
  209. # 9 - TP Regen
  210. #
  211. # Special Parameters: (Sort 3)
  212. # 0 - Target Rate/ Accuracy Rate(in Eng Translation Patch)/ Aggro Rate
  213. # 1 - Guard Effect Rate
  214. # 2 - Recovery Effect Rate
  215. # 3 - Pharmacology/ Knowledge in Medicine(in Eng Translation Patch)
  216. # 4 - MP Cost Rate
  217. # 5 - TP Charge Rate
  218. # 6 - Physical Damage Rate
  219. # 7 - Magical Damage Rate
  220. # 8 - Floor Damage Rate
  221. # 9 - Experience Rate
  222. #
  223. # Skills: (Sort 4)
  224. # These skills don't have parameter values. Instead, the last two elements in
  225. # their array have a different effect than usual:
  226. # [sort (4), -----, skill_id]
  227. # Sort = still the same and of course 4
  228. # ----- = before this was Active, but that is no longer required. In order to
  229. # by-pass the need to change this to skill_id (for people who had this script
  230. # before v2.0), this variable has become unused instead of deleted all-together.
  231. # You can put anything you want here, it doesn't even have to be an integer.
  232. # Skill_Id = the id of the skill which the actor learns.
  233. #
  234. # Elemental Efficiency: (Sort 5)
  235. # Values are the same as Element IDs in the database. (SO NO 0!!)
  236. # If the bonus is negative, the actor becomes more resistant to the element.
  237. # If the bonus is positive, the actor becomes weaker to the element.
  238. #
  239. # Debuff Rate: (Sort 6)
  240. # 0 - MaxHp
  241. # 1 - MaxMp
  242. # 2 - Attack
  243. # 3 - Defense
  244. # 4 - Magic Attack (Spirit)
  245. # 5 - Magic Defence (Resistance)
  246. # 6 - Agility
  247. # 7 - Luck
  248. # If the bonus is negative, the actor becomes more resistant to debuffs regarding
  249. # the set parameter.
  250. # If the bonus is positive, the actor becomes weaker to debuffs regarding the set
  251. # parameter.
  252. #
  253. # State Rate: (Sort 7)
  254. # Values are the same as the State IDs in the database (SO NO 0!!)
  255. # If the bonus is negative, the actor becomes more resistant to the state.
  256. # If the bonus is positive, the actor becomes weaker to the state.
  257. #
  258. # State Resist: (Sort 8)
  259. # Values are the same as the State IDs in the database (SO NO 0!!)
  260. # If the bonus is positive, the actor becomes fully resistant to the set state.
  261. # However, if the bonus is negative, the actor LOSES full resistance to the set
  262. # state!
  263. #
  264. # Attack Elements: (Sort 9)
  265. # Values are the same as the Element IDs in the database (SO NO 0!!)
  266. # If the bonus is positive, the element is added to the attack elements.
  267. # However, if the bonus is negative, the element is REMOVED from the attack
  268. # elements!
  269. #
  270. # Attack States: (Sort 10)
  271. # Values are the same as the State IDs in the database (SO NO 0!!)
  272. # Bonus is the chance of the state to occur.
  273. #
  274. # Equipment Types: (Sort 11)
  275. # 0 as parameter means that the bonus type is a Weapon Type.
  276. # 1 as parameter means that the bonus type is a Weapon Type, but instead it will
  277. # be REMOVED from the list of weapon types.
  278. # 2 as parameter means that the bonus type is an Armor Type.
  279. # 3 as parameter means that the bonus type is an Armor Type, but instead it will
  280. # be REMOVED from the list of armor types.
  281. # 4 as parameter allows Dual Wielding.
  282. # Bonus is the same as the ID of the Equipment Types in the database.
  283. # Note that removed types override added types. So you can first remove an
  284. # equip type and afterwards add it, but you can first add it and then remove it.
  285. #
  286. # Attack Specials: (Sort 12)
  287. # 0 - Attack Speed
  288. # 1 - Additional Attacks
  289. # Both in percentages. So for additional attacks, not 1 but 100.
  290. #
  291. # Additional Skill Types: (Sort 13)
  292. # Values are the same as the Skill Types IDs in the database (SO NO 0!!)
  293. # If the bonus is positive, the skill types is added.
  294. # However, if the bonus is negative, the skill type is REMOVED!
  295. #
  296. # Sealed Skill Types: (Sort 14)
  297. # Exact the same as above, only if the bonus is positive the type gets sealed,
  298. # if the bonus is negative the type gets removed from the sealed types.
  299. #
  300. # Sealed Skills: (Sort 15)
  301. # Again, exact the same as above. Only this time, replace the skill type id by
  302. # the skill id.
  303. #
  304. # Fixed Equip Types: (Sort 16)
  305. # Exact the same as Sealed Skill Types, only the equip types get fixed. Of course,
  306. # replace skill type id by equip type id.
  307. #
  308. # Sealed Equip Types: (Sort 17)
  309. # And yet again, exact the same only the equip types get sealed. Of course,
  310. # replace skill type id by equip type id.
  311. #
  312. # Special Flags: (Sort 18)
  313. # 0 - Auto Combat
  314. # 1 - Guard
  315. # 2 - Substitute/Cover
  316. # 3 - Same TP in next battle
  317. # For bonus, put a positive number (or 0) for added trait, and negative number
  318. # for removed trait.
  319. #
  320. # Party Abilities: (Sort 19)
  321. # 0 - Encounter cut down by half
  322. # 1 - No encounters
  323. # 2 - No suprise attacks
  324. # 3 - Preemptive strike rate up
  325. # 4 - Double currency from battles
  326. # 5 - Double items from battles
  327. # For bonus, put a positive number (or 0) for added trait, and negative number
  328. # for removed trait.
  329. #
  330. # Others Traits: (Sort 20)
  331. # 0 - Max TP up by bonus
  332. # 1 - Atk Skill becomes bonus (skill ID) / So, if you have [20, 1, 10] the actor's
  333. # attack skill becomes 10.
  334. # 2 - Guard Skill becomes bonus (skill ID) / So, if you have [20, 2, 10] the
  335. # actor's guard skill becomes 10,
  336. #----------------------------------------------------------------------------
  337. # Credits to:
  338. # Lettuce, if it wasn't for his RMVX Item Sets script, I would not have learned
  339. # how Arrays and Hashes work.
  340. # Many members at [url]www.rpgmakervxace.net[/url] for pointing out various bugs and whatnot.
  341. # You for reading through the wall of text ^^ (at least... I hope you did that..)
  342. #----------------------------------------------------------------------------
  343. # If you have any issues with this script, contact me at
  344. # [url]http://www.rpgmakervxace.net/index.php?/topic/1092-ees-emeralds-equipment-sets/[/url]
  345. #============================================================================
  346. #
  347. # CONFIGURATION
  348. #
  349. #============================================================================

  350. module EME
  351.   
  352.   MAX_ELEMENTS = 999

  353. #----------------------------------------------------------------------------
  354. # Sets syntax
  355. #----------------------------------------------------------------------------
  356. # Sets = {
  357. #          set_id => [[equipment_type, equipment_id]]
  358. #        }
  359. #
  360. # set_id must be bigger than 0
  361. # equipment_type can be either 0 (weapon) or 1 (armor)
  362. # Add a comma after a ']' if it's not the last element in the array/hash.
  363. #
  364. # Don't forget to add a ungettable item at the end! Else, the last item will
  365. # count for two!
  366. #----------------------------------------------------------------------------

  367. Sets = {
  368.          1 => [[0, 64], [1, 61]],
  369.          2 => [[0, 79], [1, 102], [1, 103], [1, 104]],
  370.          3 => [[0, 86], [1, 106], [1, 107], [1, 117]]
  371.          
  372.        }

  373. #----------------------------------------------------------------------------
  374. # Sets syntax
  375. #----------------------------------------------------------------------------
  376. # Set_Bonuses = {
  377. #       set id => {
  378. #         amount of pieces required => [[sort, parameter, bonus]], [sort, random parameter, 0]]
  379. #                 }
  380. #                }
  381. #
  382. # set_id must correspond to set_id of Sets
  383. # amount of pieces required indicates how many pieces of the set the actor must
  384. # be wearing before receiving the bonus. If you want to skip one, make the only
  385. # element in it's array [0, 0, 0].
  386. # sort indicates which kind of parameters the bonuses change. See SPECIAL VALUES
  387. # for all sorts.
  388. # parameter can be a value depending on sort. See SPECIAL VALUES in the
  389. # instructions for their corresponding stats.
  390. # Bonus is a direct value added to 'parameter'. If 0, no bonus is added. If
  391. # negative, bonus becomes negative.
  392. # Random paramter is just a random parameter to prevent the last bonus from
  393. # being doubled. Always make the bonus of this element 0.
  394. #
  395. # Add a comma after a ']' or '}' if it's not the last element in the array/hash.
  396. #
  397. # Don't forget to add a bonus of [0, 0, 0] at the end! Or else, the last bonus
  398. # will be doubled!
  399. #----------------------------------------------------------------------------
  400. Set_Bonuses =
  401. {
  402.   1 => {
  403. #~     1 => [[2, 7, 5]],
  404.     1 => [4,269],
  405.     2 => [[0, 0, 200]]
  406.        },

  407.   3 => {
  408.     1 => [[0, 2, 120]],
  409.     2 => [[0, 4, 120]],
  410.     3 => [[1, 2, 15]],
  411.     4 => [[1, 4, 15]]
  412.        },
  413.       
  414.   2 => {
  415.     1 => [[0, 2, 120]],
  416.     2 => [[2, 2, 10]],
  417.     3 => [[3, 5, 115]],
  418.     4 => [[1, 2, 25]],
  419.        }
  420. }

  421. #-----------------------------------------------------------------------------
  422. # Sets syntax
  423. #-----------------------------------------------------------------------------
  424. # Set_Sounds = {
  425. #   set_id => {
  426. #     amount_of_pieces_required => [file_name, volume, pitch]
  427. #   }
  428. # }
  429. #
  430. # Resembles the other two parts so I think not much of an explanation is needed.
  431. # When the required amount of pieces has been equipped, the sound sound will be
  432. # played. Doesn't apply for unequipping. Again, watch the comma's!!
  433. #----------------------------------------------------------------------------
  434. Set_Sounds =
  435. {
  436.   1 => {
  437.     1 => ["Flash2", 100, 100], # <- comma here since it isn't the last one!
  438.     2 => ["Flash1", 100, 100],  # <- no comma here since it IS the last one!
  439.     3 => ["Flash1", 100, 100]  # <- no comma here since it IS the last one!
  440.        }
  441. }

  442. end

  443. # Only edit things past here if you know what you're doing

  444. $imported = {} if $imported.nil?
  445. $imported["Emerald's Equipment Sets"] = true

  446. #============================================================================
  447. #
  448. # Game_Actor
  449. # Handles everything for this script.
  450. #============================================================================
  451. class Game_Actor < Game_Battler
  452.   
  453.   attr_reader :active_sets
  454.   attr_reader :item_sets
  455.   
  456.   alias eme_ees_setup setup
  457.   def setup(actor_id)
  458.     @non_set_skills = []
  459.     @skill_from_sets = false
  460.     reset_bonuses
  461.     @active_sets = []
  462.     @item_sets = [0] * (EME::Sets.size + 1)
  463.     eme_ees_setup(actor_id)
  464.   end

  465.   alias eme_init_equips init_equips
  466.   def init_equips(equips)
  467.     eme_init_equips(equips)
  468.     equips.each_with_index{|item_id, i|
  469.       etype_id = index_to_etype_id(i)
  470.       slot_id = empty_slot(etype_id)
  471.       for set_id in 1..EME::Sets.size
  472.         for ees_set_equip in EME::Sets[set_id]
  473.           if item_id != nil and slot_id != nil and ees_is_the_set_item?(etype_id == 0 ? $data_weapons[item_id] : $data_armors[item_id], ees_set_equip)
  474.             @item_sets[set_id] += 1
  475.             @active_sets.push(set_id) unless @active_sets.include?(set_id)
  476.           end
  477.         end
  478.       end
  479.     }
  480.     refresh
  481.   end
  482.    
  483.   def ees_is_the_set_item?(item, ees_set_equip)
  484.     return (((ees_set_equip[0] == 0 and item.is_a?(RPG::Weapon)) or (ees_set_equip[0] == 1 and item.is_a?(RPG::Armor))) and ees_set_equip[1] == item.id)
  485.   end

  486.   alias eme_ees_learn_skill learn_skill
  487.   def learn_skill(skill_id)
  488.     eme_ees_learn_skill(skill_id)
  489.     @non_set_skills.push(skill_id) unless @skill_from_sets
  490.     @skill_from_sets = false
  491.   end

  492.   alias eme_ebs_change_equip change_equip
  493.   def change_equip(slot_id, item)
  494.       for set_id in 1..EME::Sets.size
  495.         for ees_set_equip in EME::Sets[set_id]
  496.           if slot_id != nil and @equips[slot_id] != nil and @equips[slot_id].object != nil
  497.             if ees_is_the_set_item?(@equips[slot_id].object, ees_set_equip)
  498.               @item_sets[set_id] -= 1
  499.               @active_sets.delete(set_id) if @item_sets[set_id] == 0
  500.             end
  501.           end
  502.           if item != nil and ees_is_the_set_item?(item, ees_set_equip)
  503.             @item_sets[set_id] += 1
  504.             @active_sets.push(set_id) unless @active_sets.include?(set_id)
  505.             if EME::Set_Sounds.has_key?(set_id) and EME::Set_Sounds[set_id].has_key?(set_amount_wearing(set_id))
  506.               sound = EME::Set_Sounds[set_id][set_amount_wearing(set_id)]
  507.               Audio.se_play("Audio/SE/" + sound[0], sound[1], sound[2])
  508.             end
  509.           end
  510.         end
  511.       end
  512.     set_check
  513.     eme_ebs_change_equip(slot_id, item)
  514.   end

  515.   def unlearn_set_skills(set_id)
  516.     EME::Set_Bonuses[set_id].each_value{|bonus_array|
  517.       bonus_array.each{|bonus|
  518.         if bonus[0] == 4
  519.           forget_skill(bonus[2]) unless @non_set_skills.include?(bonus[2])
  520.           @ees_skills.delete(bonus[2])
  521.         end
  522.       }
  523.     }
  524.   end
  525.   
  526.   def item_set_reset_all
  527.     @active_sets.each{|set_id| item_set_reset(set_id)}
  528.   end
  529.   
  530.   def item_set_reset(set_id)
  531.     return unless set_id > 0 and @item_sets[set_id] > 0
  532.     unlearn_set_skills(set_id)
  533.   end
  534.   
  535.   def release_unequippable_items(item_gain = true)
  536.     @equips.each_with_index do |item, i|
  537.       if !equippable?(item.object) || item.object.etype_id != equip_slots[i]
  538.         trade_item_with_party(nil, item.object) if item_gain
  539.         item.object = nil
  540.       end
  541.     end
  542.   end

  543.   def release_unequippable_items(item_gain = true)
  544.     loop do
  545.       change_equips = 0
  546.       @equips.each_with_index do |item, i|
  547.         if !equippable?(item.object) or item.object.etype_id != equip_slots[i]
  548.           next if (RPG::Weapon.method_defined?(:two_handed?) and dual_wield? and (equip_slots[i] == 1 and item.object.etype_id == 0))
  549.           trade_item_with_party(nil, item.object) if item_gain
  550.           change_equips += 1 unless item.object.nil?
  551.           unless item.object.nil?
  552.           for set_id in 1..EME::Sets.size
  553.             for ees_set_equip in EME::Sets[set_id]
  554.               if ees_is_the_set_item?(item.object, ees_set_equip)
  555.                 @item_sets[set_id] -= 1
  556.                 @active_sets.delete(set_id) if @item_sets[set_id] == 0
  557.               end
  558.             end
  559.           end
  560.           end
  561.           item.object = nil
  562.         end
  563.       end
  564.       set_check
  565.       break if change_equips == 0
  566.     end
  567.   end

  568.   alias eme_ebs_discard_equip discard_equip
  569.   def discard_equip(item)
  570.     slot_id = equips.index(item)
  571.     if slot_id != nil
  572.       for set_id in 1..EME::Sets.size
  573.         for ees_set_equip in EME::Sets[set_id]
  574.           if ees_is_the_set_item?(item, ees_set_equip)
  575.             @item_sets[set_id] -= 1
  576.             @active_sets.delete(set_id) if @item_sets[set_id] == 0
  577.           end
  578.         end
  579.       end
  580.     end
  581.     eme_ebs_discard_equip(item)
  582.     refresh
  583.   end
  584.   
  585.   def set_amount_wearing(set_id)
  586.     return @item_sets[set_id]
  587.   end

  588.   def set_check
  589.     item_set_reset_all
  590.     reset_bonuses
  591.     @active_sets.each{|set| change_bonuses(set) unless set == nil}
  592.   end
  593.   
  594.   def change_bonuses(set_id)
  595.     return if set_id == 0 or set_amount_wearing(set_id) == 0
  596.     EME::Set_Bonuses[set_id].each_key{|key|
  597.       if set_amount_wearing(set_id) >= key
  598.         for g in 0...EME::Set_Bonuses[set_id][key].size
  599.           sort = EME::Set_Bonuses[set_id][key][g][0]
  600.           stat = EME::Set_Bonuses[set_id][key][g][1]
  601.           stat_bonus = EME::Set_Bonuses[set_id][key][g][2]
  602.           case EME::Set_Bonuses[set_id][key][g][0]
  603.           when 0
  604.             sets_param_change(stat, stat_bonus)
  605.           when 1
  606.             sets_per_param_change(stat, stat_bonus)
  607.           when 2
  608.             sets_xparam_change(stat, stat_bonus)
  609.           when 3
  610.             sets_sparam_change(stat, stat_bonus)
  611.           when 4
  612.             next if skill_learn?(stat_bonus)
  613.             @skill_from_sets = true
  614.             learn_skill(stat_bonus)
  615.             @ees_skills.push(stat_bonus)
  616.           when 5
  617.             stat -= 1
  618.             sets_element_rate_change(stat, stat_bonus)
  619.           when 6
  620.             stat -= 1
  621.             sets_debuff_rate_change(stat, stat_bonus)
  622.           when 7
  623.             stat -= 1
  624.             sets_state_rate_change(stat, stat_bonus)
  625.           when 8
  626.             sets_state_resist_change(stat, stat_bonus)
  627.           when 9
  628.             sets_atk_elements_change(stat, stat_bonus)
  629.           when 10
  630.             sets_atk_states_change(stat) if stat_bonus > 0
  631.             sets_atk_states_rate_change(stat, stat_bonus)
  632.           when 11
  633.             if stat < 2
  634.               change_sets_additional_wtypes(stat_bonus, (stat == 0 ? true : false))
  635.             elsif stat < 4
  636.               change_sets_additional_atypes(stat_bonus, (stat == 2))
  637.             elsif stat == 4
  638.               @eme_ebs_two_swords_style = true
  639.             end
  640.           when 12
  641.             sets_atk_specials_change(stat, stat_bonus)
  642.           when 13
  643.             add_sets_skill_types(stat, stat_bonus)
  644.           when 14
  645.             add_sets_sealed_skill_types(stat, stat_bonus)
  646.           when 15
  647.             add_sets_sealed_skills(stat, stat_bonus)
  648.           when 16
  649.             add_sets_fixed_equip_types(stat, stat_bonus)
  650.           when 17
  651.             add_sets_sealed_equip_types(stat, stat_bonus)
  652.           when 18
  653.             stat_bonus < 0 ? change_special_flags(stat, true) : change_special_flags(stat)
  654.           when 19
  655.             stat_bonus < 0 ? change_party_abilities(stat, true) : change_party_abilities(stat)
  656.           when 20
  657.             case stat
  658.             when 0
  659.               set_bonus_max_tp(stat_bonus)
  660.             when 1
  661.               set_atk_skill(stat_bonus)
  662.             when 2
  663.               set_grd_skill(stat_bonus)
  664.             end
  665.           end
  666.         end
  667.       end
  668.     }
  669.   end

  670. #-------------------------------------------#
  671. # LABEL FOR AUTHOR                          #
  672. # Don't mind this ;)                        #
  673. #-------------------------------------------#

  674.   def reset_bonuses
  675.     @sets_param_plus = [0] * 8
  676.     @sets_per_param_plus = [0] * 8
  677.     @sets_xparam_plus = [0] * 10
  678.     @sets_sparam_plus = [0] * 10
  679.     @sets_element_rate = [0] * (EME::MAX_ELEMENTS)
  680.     @sets_debuff_rate = [0] * 8
  681.     @sets_state_rate = [0] * ($data_states.size + 1)
  682.     @sets_state_resist = []
  683.     @sets_state_resist_remove = []
  684.     @sets_atk_elements = []
  685.     @sets_atk_elements_remove = []
  686.     @sets_atk_states = []
  687.     @sets_atk_states_rate = [0] * $data_states.size
  688.     @sets_atk_speed_plus = 0
  689.     @sets_atk_times_plus = 0
  690.     @sets_skill_types = []
  691.     @sets_skill_types_remove = []
  692.     @sets_sealed_skill_types = []
  693.     @sets_sealed_skill_types_remove = []
  694.     @sets_sealed_skills = []
  695.     @sets_sealed_skills_remove = []
  696.     @sets_fixed_equip_types = []
  697.     @sets_fixed_equip_types_remove = []
  698.     @sets_sealed_equip_types = []
  699.     @sets_sealed_equip_types_remove = []
  700.    
  701.     @ees_added_special_flags = []
  702.     @ees_removed_special_flags = []
  703.     @ees_added_party_abilities = []
  704.     @ees_removed_party_abilities = []
  705.     @ees_bonus_max_tp = 0
  706.     @new_atk_skill = nil
  707.     @new_grd_skill = nil
  708.    
  709.     @ees_skills = []
  710.     @sets_wtypes = []
  711.     @sets_atypes = []
  712.     @sets_removed_wtypes = []
  713.     @sets_removed_atypes = []
  714.     @eme_ebs_two_swords_style = false
  715.   end

  716.   def sets_param_plus(param_id)
  717.     @sets_param_plus[param_id]
  718.   end

  719.   def sets_param_change(param_id, value)
  720.     @sets_param_plus[param_id] += value
  721.   end

  722.   def sets_per_param_plus(param_id)
  723.     value = param_base(param_id) + param_plus(param_id)
  724.     value *= @sets_per_param_plus[param_id] / 100
  725.     return value
  726.   end

  727.   def sets_per_param_change(param_id, value)
  728.     @sets_per_param_plus[param_id] += value
  729.   end
  730.   
  731.   def sets_xparam_plus(param_id)
  732.     @sets_xparam_plus[param_id]
  733.   end

  734.   def sets_xparam_change(param_id, value)
  735.     @sets_xparam_plus[param_id] += value
  736.   end

  737.   def sets_sparam_plus(param_id)
  738.     @sets_sparam_plus[param_id]
  739.   end
  740.   
  741.   def sets_sparam_change(param_id, value)
  742.     @sets_sparam_plus[param_id] += value
  743.   end
  744.   
  745.   def sets_element_rate(element_id)
  746.     @sets_element_rate[element_id]
  747.   end
  748.   
  749.   def sets_element_rate_change(element_id, value)
  750.     @sets_element_rate[element_id] += value
  751.   end
  752.   
  753.   def sets_debuff_rate(param_id)
  754.     @sets_debuff_rate[param_id]
  755.   end

  756.   def sets_debuff_rate_change(param_id, value)
  757.     @sets_debuff_rate[param_id] += value
  758.   end
  759.   
  760.   def sets_state_rate(state_id)
  761.     @sets_state_rate[state_id]
  762.   end

  763.   def sets_state_rate_change(state_id, value)
  764.     @sets_state_rate[state_id] += value
  765.   end
  766.   
  767.   def sets_state_resist(state_id)
  768.     @sets_state_resist[state_id]
  769.   end
  770.   
  771.   def sets_state_resist_remove(state_id)
  772.     @sets_state_resist_remove[state_id]
  773.   end
  774.   
  775.   def sets_state_resist_change(state_id, value)
  776.     value >= 0 ? (@sets_state_resist.push(state_id) unless @sets_state_resist.include?(state_id)) : (@sets_state_resist_remove.delete(state_id) unless @sets_state_resist_remove.include?(state_id))
  777.   end
  778.   
  779.   def sets_atk_elements(element_id)
  780.     @sets_atk_elements[element_id]
  781.   end
  782.   
  783.   def sets_atk_elements_remove(element_id)
  784.     @sets_atk_elements_remove[element_id]
  785.   end

  786.   def sets_atk_elements_change(element_id, value)
  787.     value >= 0 ? (@sets_atk_elements.push(element_id) unless @sets_atk_elements.include?(element_id)) : (@sets_attack_elements_remove.delete(element_id) unless @sets_atk_elements_remove.include?(element_id))
  788.   end
  789.   
  790.   def sets_atk_states(state_id)
  791.     @sets_atk_states[state_id]
  792.   end

  793.   def sets_atk_states_change(state_id)
  794.     @sets_atk_states.push(state_id) unless @sets_atk_states.include?(state_id)
  795.   end
  796.   
  797.   def sets_atk_states_rate(state_id)
  798.     @sets_atk_states_rate[state_id]
  799.   end

  800.   def sets_atk_states_rate_change(state_id, value)
  801.     @sets_atk_states_rate[state_id] += value
  802.   end
  803.   
  804.   def sets_atk_speed_plus
  805.     @sets_atk_speed_plus
  806.   end

  807.   def sets_atk_times_plus
  808.     @sets_atk_times_plus
  809.   end
  810.   
  811.   def sets_atk_specials_change(parameter, value)
  812.     parameter == 0 ? @sets_atk_speed_plus += value : @sets_atk_times_plus += value
  813.   end
  814.    
  815.   def sets_skill_types(skill_type_id)
  816.     @sets_skill_types[skill_type_id]
  817.   end
  818.   
  819.   def sets_skill_types_remove(skill_type_id)
  820.     @sets_skill_types_remove[skill_type_id]
  821.   end

  822.   def add_sets_skill_types(skill_type_id, value)
  823.     value >= 0 ? (@sets_skill_types.push(skill_type_id) unless @sets_skill_types.include?(skill_type_id)) : (@sets_skill_types_remove.delete(skill_type_id) unless @sets_skill_types_remove.include?(skill_type_id))
  824.   end
  825.   
  826.   def sets_sealed_skill_types(skill_type_id)
  827.     @sets_sealed_skill_types[skill_type_id]
  828.   end
  829.   
  830.   def sets_sealed_skill_types_remove(skill_type_id)
  831.     @sets_sealed_skill_types_remove[skill_type_id]
  832.   end

  833.   def add_sealed_skill_types(skill_type_id, value)
  834.     value >= 0 ? (@sets_sealed_skill_types.push(skill_type_id) unless @sets_sealed_skill_types.include?(skill_type_id)) : (@sets_sealed_skill_types_remove.delete(skill_type_id) unless @sets_sealed_skill_types_remove.include?(skill_type_id))
  835.   end
  836.   
  837.   def sets_sealed_skills(skill_id)
  838.     @sets_sealed_skills[skill_id]
  839.   end
  840.   
  841.   def sets_sealed_skills_remove(skill_id)
  842.     @sets_sealed_skills_remove[skill_id]
  843.   end

  844.   def add_sets_sealed_skills(skill_id, value)
  845.     value > 0 ? (@sets_sealed_skills.push(skill_id) unless @sets_sealed_skills.include?(skill_id)) : (@sets_attack_elements_remove.delete(skill_id) unless @sets_sealed_skills_remove.include?(skill_id))
  846.   end
  847.   
  848.   def sets_additional_wtypes
  849.     @sets_wtypes
  850.   end
  851.   
  852.   def sets_additional_atypes
  853.     @sets_atypes
  854.   end
  855.   
  856.   def sets_removed_wtypes
  857.     @sets_removed_wtypes
  858.   end
  859.   
  860.   def sets_removed_atypes
  861.     @sets_removed_atypes
  862.   end
  863.   
  864.   def change_sets_additional_wtypes(wtype_id, positive_change = true)
  865.     positive_change ? @sets_wtypes.push(wtype_id) : @sets_removed_wtypes.push(wtype_id)
  866.   end
  867.   
  868.   def change_sets_additional_atypes(atype_id, positive_change = true)
  869.     positive_change ? @sets_atypes.push(atype_id) : @sets_removed_atypes.push(atype_id)
  870.   end
  871.   
  872.   def sets_fixed_equip_types(equip_type_id)
  873.     @sets_fixed_equip_types[equip_type_id]
  874.   end
  875.   
  876.   def sets_fixed_equip_types_remove(equip_type_id)
  877.     @sets_fixed_equip_types_remove[equip_type_id]
  878.   end

  879.   def add_fixed_equip_types(equip_type_id, value)
  880.     value >= 0 ? @sets_fixed_equip_types.push(equip_type_id) : @sets_fixed_equip_types_remove.delete(sequip_type_id)
  881.   end
  882.   
  883.   def sets_sealed_equip_types(equip_type_id)
  884.     @sets_sealed_equip_types[equip_type_id]
  885.   end
  886.   
  887.   def sets_sealed_equip_types_remove(equip_type_id)
  888.     @sets_sealed_equip_types_remove[equip_type_id]
  889.   end

  890.   def add_sealed_equip_types(equip_type_id, value)
  891.     value > 0 ? (@sets_sealed_equip_types.push(equip_type_id) unless @sets_sealed_equip_types.include?(equip_type_id)) : (@sets_sealed_equip_types_remove.delete(equip_type_id) unless @sets_sealed_equip_types_remove.include?(equip_type_id))
  892.   end
  893.   
  894.   def change_special_flags(flag_id, negative = false)
  895.     !negative ? @ees_added_special_flags.push(flag_id) : @ees_removed_special_flags.push(flag_id)
  896.   end
  897.   
  898.   def change_party_abilities(ability_id, negative = false)
  899.     !negative ? @ees_added_party_abilities.push(ability_id) : @ees_removed_party_abilities.push(ability_id)
  900.   end
  901.   
  902.   def set_bonus_max_tp(value)
  903.     @ees_bonus_max_tp += value
  904.   end
  905.   
  906.   def set_atk_skill(skill_id)
  907.     @new_atk_skill = skill_id
  908.   end
  909.   
  910.   def set_grd_skill(skill_id)
  911.     @new_grd_skill = skill_id
  912.   end
  913.   
  914. #-------------------------------------------#
  915. # 'NOTHER LABEL FOR AUTHOR                  #
  916. # Don't mind this ;)                        #
  917. #-------------------------------------------#

  918.   def param(param_id)
  919.     value = param_base(param_id) + param_plus(param_id) + sets_param_plus(param_id) #+ [sets_per_param_plus(param_id), 0].max
  920.     value *= param_rate(param_id) * param_buff_rate(param_id)
  921.     [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
  922.   end
  923.   
  924.   alias eme_ebs_xparam xparam
  925.   def xparam(xparam_id)
  926.     value = eme_ebs_xparam(xparam_id) + sets_xparam_plus(xparam_id) / 100
  927.     return value
  928.   end
  929.   
  930.   alias eme_ebs_sparam sparam
  931.   def sparam(sparam_id)
  932.     value = eme_ebs_sparam(sparam_id) + sets_sparam_plus(sparam_id) / 100
  933.     return value
  934.   end
  935.   
  936.   alias eme_ebs_element_rate element_rate
  937.   def element_rate(element_id)
  938.     value = eme_ebs_element_rate(element_id) + sets_element_rate(element_id) / 100
  939.     return value
  940.   end
  941.   
  942.   alias eme_ebs_debuff_rate debuff_rate
  943.   def debuff_rate(param_id)
  944.     value = eme_ebs_debuff_rate(param_id) + sets_debuff_rate(param_id) / 100
  945.     return value
  946.   end

  947.   alias eme_ebs_state_rate state_rate
  948.   def state_rate(state_id)
  949.     value = eme_ebs_state_rate(state_id) + sets_state_rate(state_id) / 100
  950.     return value
  951.   end

  952.   alias eme_ebs_state_resist_set state_resist_set
  953.   def state_resist_set
  954.     value = eme_ebs_state_resist_set
  955.     @sets_state_resist.each{|state| value.push(state) unless value.include?(element)}
  956.     @sets_state_resist_remove.each{|state| value.delete(state)}
  957.     return value
  958.   end
  959.   
  960.   alias eme_ebs_atk_elements atk_elements
  961.   def atk_elements
  962.     value = eme_ebs_atk_elements
  963.     @sets_atk_elements.each{|element| value.push(element) unless value.include?(element)}
  964.     @sets_atk_elements_remove.each{|element| value.delete(element)}
  965.     return value
  966.   end
  967.   
  968.   alias eme_ebs_atk_states atk_states
  969.   def atk_states
  970.     value = eme_ebs_atk_states
  971.     @sets_atk_states.each{|state| value.push(@sets_atk_states[i]) }
  972.     return value
  973.   end
  974.   
  975.   alias eme_ebs_atk_states_rate atk_states_rate
  976.   def atk_states_rate(state_id)
  977.     value = eme_ebs_atk_states_rate(state_id) + sets_atk_states_rate(state_id) / 100
  978.     return value
  979.   end
  980.   
  981.   alias eme_ebs_atk_speed atk_speed
  982.   def atk_speed
  983.     value = eme_ebs_atk_speed + sets_atk_speed_plus / 100
  984.     return value
  985.   end

  986.   alias eme_ebs_atk_times atk_times_add
  987.   def atk_times_add
  988.     value = [eme_ebs_atk_times + sets_atk_times_plus / 100, 0].max
  989.     return value
  990.   end

  991.   alias eme_ebs_dual_wield? dual_wield?
  992.   def dual_wield?
  993.     return true if @eme_ebs_two_swords_style
  994.     eme_ebs_dual_wield?
  995.   end
  996.   
  997.   alias eme_ebs_added_skill_types added_skill_types
  998.   def added_skill_types
  999.     value = eme_ebs_added_skill_types
  1000.     @sets_skill_types.each{|sk_type| value.push(sk_type)}
  1001.     @sets_skill_types_remove.each{|sk_type| value.delete(sk_type)}
  1002.     return value
  1003.   end
  1004.   
  1005.   def skill_type_sealed?(stype_id)
  1006.     value = features_set(FEATURE_STYPE_SEAL)
  1007.     @sets_sealed_skill_types.each{|sk_type| value.push(sk_type)}
  1008.     @sets_sealed_skill_types_remove.each{|sk_type| value.delete(sk_type)}
  1009.     return true if value.include?(stype_id)
  1010.   end

  1011.   def skill_sealed?(skill_id)
  1012.     value = features_set(FEATURE_SKILL_SEAL)
  1013.     @sets_sealed_skills.each{|skill| value.push(skill)}
  1014.     @sets_sealed_skills_remove.each{|skill| value.delete(skill)}
  1015.     return true if value.include?(skill_id)
  1016.   end
  1017.   
  1018.   def equip_wtype_ok?(wtype_id)
  1019.     value = features_set(FEATURE_EQUIP_WTYPE)
  1020.     @sets_wtypes.each{|w_type| value.push(w_type)}
  1021.     @sets_removed_wtypes.each{|w_type| value.delete(w_type)}
  1022.     return true if value.include?(wtype_id)
  1023.   end

  1024.   def equip_atype_ok?(atype_id)
  1025.     value = features_set(FEATURE_EQUIP_ATYPE)
  1026.     @sets_atypes.each{|a_type| value.push(a_type)}
  1027.     @sets_removed_atypes.each{|a_type| value.delete(a_type)}
  1028.     return true if value.include?(atype_id)
  1029.   end

  1030.   def equip_type_fixed?(etype_id)
  1031.     value = features_set(FEATURE_EQUIP_FIX)
  1032.     @sets_fixed_equip_types.each{|e_type| value.push(e_type)}
  1033.     @sets_fixed_equip_types_remove.each{|e_type| value.delete(e_type)}
  1034.     return true if value.include?(etype_id)
  1035.   end
  1036.   
  1037.   def equip_type_sealed?(etype_id)
  1038.     value = features_set(FEATURE_EQUIP_SEAL)
  1039.     @sets_sealed_equip_types.each{|e_type| value.push(e_type)}
  1040.     @sets_sealed_equip_types_remove.each{|e_type| value.delete(e_type)}
  1041.     return true if value.include?(etype_id)
  1042.   end
  1043.   
  1044.   alias eme_ees_special_flag special_flag
  1045.   def special_flag(flag_id)
  1046.     return false if @ees_removed_special_flags.include?(flag_id)
  1047.     return @ees_added_special_flags.include?(flag_id) ? true : eme_ees_special_flag(flag_id)
  1048.   end
  1049.   
  1050.   alias eme_ees_party_ability party_ability
  1051.   def party_ability(ability_id)
  1052.     return false if @ees_removed_party_abilities.include?(ability_id)
  1053.     return @ees_added_party_abilities.include?(ability_id) ? true : eme_ees_party_ability(ability_id)
  1054.   end
  1055.   
  1056.   alias eme_ees_max_tp max_tp
  1057.   def max_tp
  1058.     return eme_ees_max_tp + @ees_bonus_max_tp
  1059.   end
  1060.   
  1061.   alias eme_ees_attack_skill attack_skill_id
  1062.   def attack_skill_id
  1063.     return @new_atk_skill unless @new_atk_skill == nil
  1064.     return eme_ees_attack_skill
  1065.   end

  1066.   alias eme_ees_guard_skill guard_skill_id
  1067.   def guard_skill_id
  1068.     return @new_grd_skill unless @new_grd_skill == nil
  1069.     return eme_ees_guard_skill
  1070.   end

  1071. end
复制代码


战斗优势:之前那个展示进度的那个大大的帖子。说过这个很特别
  1. #------------------------------------------------------------------------------#
  2. #  Galv's Battle Favour
  3. #------------------------------------------------------------------------------#
  4. #  For: RPGMAKER VX ACE
  5. #  Version 1.8
  6. #------------------------------------------------------------------------------#
  7. #  2013-04-25 - version 1.8 - fixed bug when battle ends there is a has full bar
  8. #  2012-12-14 - version 1.7 - option added to change bar widths
  9. #  2012-12-01 - version 1.6 - added a lot more options to tweak bar aesthetics
  10. #  2012-11-18 - version 1.5 - added a switch to disable the favour meter
  11. #                             fixed 'enemy text' positioning
  12. #  2012-11-14 - version 1.4 - fixed a bug where using items would crash the game
  13. #  2012-11-14 - version 1.3 - updated to work better with Yanfly's battle
  14. #  2012-11-12 - version 1.2 - potential bug remedied
  15. #  2012-11-12 - version 1.1 - bug fix
  16. #  2012-11-12 - version 1.0 - release
  17. #------------------------------------------------------------------------------#
  18. #  This scripts adds a 'favour meter' to battle. As the meter fills for each
  19. #  team (enemy or party) they gain a state that can be used to determine the
  20. #  benefits of having higher favour. Upon reaching max favour, a common event
  21. #  can be called to add any additional effects you might like.
  22. #
  23. #  These favour bars increase by causing damage. When one side causes damage, it
  24. #  can also decrease the other side's bar by an amount based on the gain amount.
  25. #
  26. #  Actors and equips can give bonuses to how much these bars increase. Enemies
  27. #  can also have different bonuses for this as well.
  28. #
  29. #  Skills can also be set to modify either side's favour bar without causing
  30. #  damage.
  31. #------------------------------------------------------------------------------#
  32. #  SCRIPT CALLS
  33. #------------------------------------------------------------------------------#
  34. #  You can use script calls to change party or enemy favour during battles.
  35. #
  36. #  $game_party.enemy_favour = x      # set enemy favour to x
  37. #  $game_party.favour = x            # set party favour to x
  38. #
  39. #  $game_actors[y].favour = x        # set actor y's favour bonus to x
  40. #
  41. #  For those with limited scripting knowledge, instead of "=" you can use:
  42. #
  43. #    -=    # minus            +=    # plus            *=    # multiply
  44. #
  45. #  NOTE: The enemy favour and party favour bars are reset each battle.
  46. #  The Actor favour changes remain for the game (and is used for bonuses)
  47. #------------------------------------------------------------------------------#
  48. #  You can use script to get favour amounts (eg. for use in variables 'script')
  49. #
  50. #  $game_party.enemy_favour       # returns the amount the enemy favour bar has
  51. #  $game_party.favour             # returns the amount the party favour bar has
  52. #  $game_actors[x].favour         # returns how much favour actor x has
  53. #  $game_party.members[x].favour  # returns how much favour actor in position x has
  54. #  $game_troop.members[x].favour  # returns how much favour troop x has
  55. #
  56. #------------------------------------------------------------------------------#
  57. #  NOTETAG - ACTORS
  58. #------------------------------------------------------------------------------#
  59. #  <favour: x>          # Where x is the actor's INITIAL favour bonus. This
  60. #                       # bonus can change with above script calls.
  61. #------------------------------------------------------------------------------#
  62. #  NOTETAG - WEAPONS and ARMORS
  63. #------------------------------------------------------------------------------#
  64. #  <favour: x>          # Equips with this notetag will give bonus favour when
  65. #                       # the equipped actor causes damage.
  66. #------------------------------------------------------------------------------#
  67. #  NOTETAG - ENEMIES
  68. #------------------------------------------------------------------------------#
  69. #  <favour: x>          # Enemies tagged with this will get a bonus when they
  70. #                       # cause damage.
  71. #------------------------------------------------------------------------------#
  72. #  NOTETAG - SKILLS
  73. #------------------------------------------------------------------------------#
  74. #  <favour: x>          # Skills with this notetag will give bonus favour when
  75. #                       # the skill used causes damage.
  76. #------------------------------------------------------------------------------#
  77. #
  78. #  HOW DO THE ABOVE NOTETAG BONUSES WORK?
  79. #
  80. #  10% of the total bonuses an actor or enemy has is added to the amount of
  81. #  favour that is generated for their team each time they cause damage.
  82. #
  83. #------------------------------------------------------------------------------#
  84. #  NOTETAG - SKILLS and ITEMS
  85. #------------------------------------------------------------------------------#
  86. #  <mod_pfavour: x>        # How you want to modify party favour
  87. #  <mod_efavour: x>        # How you want to modify enemy favour
  88. #                          # x can be set to:
  89. #                          # 1 for 'add', 2 for 'multiply' or 3 for 'set'.
  90. #                          # If you leave this out, the below won't do anything.
  91. #
  92. #  <do_pfavour: x>         # How much to "add", "mul" or "set" party favour by.
  93. #  <do_efavour: x>         # How much to "add", "mul" or "set" enemy favour by.
  94. #------------------------------------------------------------------------------#
  95. #  EXAMPLE OF TAGS ON A SKILL/ITEM:
  96. #
  97. #  <mod_pfavour: 3>            # This example, the skill would 'set' party
  98. #  <do_pfavour: 50>            # favour to 50 and subtract 30 from enemy.
  99. #  <mod_efavour: 1>            # Only one of each tag will apply.
  100. #  <do_efavour: -30>
  101. #
  102. #------------------------------------------------------------------------------#

  103. ($imported ||= {})["Galvs_Battle_Favour"] = true

  104. module Galv_Favour
  105. #------------------------------------------------------------------------------#
  106. #  SCRIPT SETTINGS
  107. #------------------------------------------------------------------------------#  

  108.   DISABLE_SWITCH = 999        # Turn switch ON to disable meters. Do this outside
  109.                             # of combat.

  110. #----------------------------#
  111. #   FAVOUR BAR AESTHETICS:   #
  112. #----------------------------#

  113.   FONT = "Arial"            # The font for all bar related text

  114.   TEXT_SIZE = 22            # The font size of the party/enemy text names.
  115.   TEXT_Y = 0                # Offset ALL bar text vertically different to bars
  116.                              
  117.   PARTY_TEXT = "我方优势"      # Text displayed above party favour bar.
  118.   PARTY_TEXT_COLOR = 0      # The colour of the party text
  119.   ENEMY_TEXT = "敌方优势"      # Text displayed above enemy favour bar.
  120.   ENEMY_TEXT_COLOR = 0      # The colour of the enemy text
  121.    
  122.   TURNS_TEXT_SIZE = 22      # Size of the turns text
  123.   TURNS_TEXT = " CD"     # Text displayed after remaining special turns
  124.   PARTY_TURNS_COLOR = 8     # Colour of the turns text for party
  125.   ENEMY_TURNS_COLOR = 8    # Colour of the turns text for enemy
  126.    
  127.   SHOW_NUMBERS = true       # Show amount of favour as numbers above the bars.
  128.    
  129.   BAR_WIDTH = 250           # How wide the bars are.
  130.   BAR_HEIGHT = 10           # The height of the actual bars.
  131.   BAR_Y = 0                 # Offset the bars vertically different to text
  132.   BAR_POSITION = "bottom"   # Position of the favour bars. Can be "top" or
  133.                             # "bottom" or put in a number without quotes to
  134.                             # display the bar that many pixels from the top.
  135.    
  136.   PARTY_BAR_COLORS = [4,11]     # Gradient colors of party bar.
  137.   ENEMY_BAR_COLORS = [14,10]    # Gradient colors of enemy bar.
  138.    
  139.   PARTY_ACTIVATE_SE = ["Barrier", 100, 100]  # SE when favours reach MAX
  140.   PARTY_ACTIVATE_COLORS = [4,9,12,16]        # bar cycles these colors randomly
  141.    
  142.   ENEMY_ACTIVATE_SE = ["Barrier", 100, 100]  # ["SE Name", volume, pitch]
  143.   ENEMY_ACTIVATE_COLORS = [2,10,18,21]        # bar cycles these colors randomly

  144. #-----------------------#
  145. #   FAVOUR MECHANICS:   #
  146. #-----------------------#

  147.   FAVOUR_MAX = 100          # The number used to determine a full favour bar.
  148.    
  149.   INITIAL_PARTY_FAVOUR = [5,20]    # Set amount of favour when battles begin
  150.   INITIAL_ENEMY_FAVOUR = [5,20]    # randomized between the first and second
  151.                                    # numbers.
  152.                                     
  153.   REDUCE_OPPONENT = 0.5     # When an enemy or party gains favour, the opposing
  154.                             # side loses favour equal to this amount gained
  155.                             # multiplied by this number. ie. 0.5 is 50%

  156.   SPECIAL_ACTIVATE = 119          # Common event ID that is activated when
  157.                                 # the party reaches MAX favour.
  158.   ENEMY_SPECIAL_ACTIVATE = 89    # Common event ID that is activated when
  159.                                 # the enemy reaches MAX favour.

  160.   SPECIAL_TURNS = 5         # When MAX favour is reached, the party or enemy
  161.                             # team enter a "Special mode". They retain their
  162.   # MAX favour for this many turns. Once the special is over, the favour returns
  163.   # to 0. While in special mode, the opposing team's favour gains are halved.


  164.   # FAVOUR STATES
  165.    
  166.   # Below are lists to set up to determine states to apply for each favour level.
  167.   # They are listed in pairs - a favour amount and a state id.
  168.   # eg.  20 => 21
  169.   # means: when favour amount reaches 20, apply state with id 21 to party/enemy.
  170.   # Each time the next favour level is reached, it removes the previous favour
  171.   # state the party or enemy troop had active.
  172.    

  173.   FAVOUR_STATES = {  # don't touch this.
  174. #------------------------------------------------------------------------------#

  175.     # PARTY FAVOUR STATES
  176.      
  177.       0 => 0,           # when less than 20, display no state. Leave as is.
  178.       20 => 0,         # when 20 favour earned, state 21 applied.
  179.       40 => 0,         # when 40 favour earned, state 22 applied.
  180.       60 => 0,         # when 60 favour earned, state 23 applied.
  181.       80 => 0,         # when 80 favour earned, state 24 applied.
  182.       100 => 0,        # when 100 favour earned, state 25 applied.
  183.       
  184. #------------------------------------------------------------------------------#
  185.   } # don't touch this
  186. #------------------------------------------------------------------------------#

  187.   ENEMY_FAVOUR_STATES = {  # don't touch this.
  188. #------------------------------------------------------------------------------#

  189.     # ENEMY TROOP FAVOUR STATES

  190.       0 => 0,           # when less than 20, display no state. Leave as is.
  191.       20 => 0,         # when 20 favour earned, state 21 applied.
  192.       40 => 0,         # when 40 favour earned, state 22 applied.
  193.       60 => 0,         # when 60 favour earned, state 23 applied.
  194.       80 => 0,         # when 80 favour earned, state 24 applied.
  195.       100 => 0,        # when 100 favour earned, state 25 applied.
  196.       
  197. #------------------------------------------------------------------------------#
  198.   } # don't touch this
  199. #------------------------------------------------------------------------------#
  200. #  CHARGING FAVOUR
  201. #------------------------------------------------------------------------------#
  202. #  Below are equations for enemy and party to charge favour on damage caused.
  203. #  You will need some scripting knowledge to modify this. I have set it up to
  204. #  be used with 100 favour as the max in mind.
  205. #------------------------------------------------------------------------------#

  206. end # don't touch
  207. module Galv_Favour_Mechanics # don't touch

  208. #------------------------------------------------------------------------------#
  209. #  CHARGING PARTY FAVOUR - Equation for gaining favour when causing damage:
  210. #------------------------------------------------------------------------------#  
  211.   def charge_favour(damage) # don't touch
  212. #------------------------------------------------------------------------------#  

  213.     # Generate random favour depending % of max life damage actor does to enemy.
  214.     # Add 10% of all actor's favour bonuses:

  215.     @charge = rand(6) + 5 + (10 * ([damage.to_f,mhp].min / mhp)).to_i
  216.     @charge += (get_actor_favour_bonus * 0.1).to_i

  217. #------------------------------------------------------------------------------#  
  218.   end # don't touch
  219. #------------------------------------------------------------------------------#
  220. #  CHARGING ENEMY FAVOUR - Equation for gaining favour when causing damage:
  221. #------------------------------------------------------------------------------#  
  222.   def charge_enemy_favour(damage) # don't touch
  223. #------------------------------------------------------------------------------#  

  224.     # Generate random favour depending % of max life damage enemy does to actor.
  225.     # Add 10% of enemy favour bonus:
  226.      
  227.     @charge = rand(6) + 5 + (10 * ([damage.to_f,mhp].min / mhp)).to_i
  228.     @charge += (get_enemy_favour_bonus * 0.1).to_i
  229.      
  230. #------------------------------------------------------------------------------#  
  231. #------------------------------------------------------------------------------#
  232. #  END OF SCRIPT SETTINGS
  233. #------------------------------------------------------------------------------#  
  234.   end
  235.    
  236.   def get_actor_favour_bonus
  237.     @bonus = $game_temp.user.favour
  238.     @no_equips = $game_temp.user.equips.count
  239.     @no_equips.times { |i|
  240.       if $game_temp.user.equips[i] != nil
  241.         @bonus += $game_temp.user.equips[i].favour_bonus
  242.       end
  243.     }
  244.     @bonus += $game_temp.skill_used.favour_bonus
  245.     return @bonus
  246.   end
  247.    
  248.   def get_enemy_favour_bonus
  249.     @bonus = $game_temp.user.favour
  250.     @bonus += $game_temp.skill_used.favour_bonus
  251.     return @bonus
  252.   end

  253. end # Galv_Favour_Mechanics


  254. class RPG::BaseItem

  255.   def favour_bonus
  256.     if @favour_bonus.nil?
  257.       if @note =~ /<favour: (.*)>/i
  258.         @favour_bonus = $1.to_i
  259.       else
  260.         @favour_bonus = 0
  261.       end
  262.     end
  263.     @favour_bonus
  264.   end

  265.   def mod_pfavour
  266.     if @mod_pfavour.nil?
  267.       if @note =~ /<mod_pfavour: (.*)>/i
  268.         @mod_pfavour = $1.to_i
  269.       else
  270.         @mod_pfavour = 0
  271.       end
  272.     end
  273.     @mod_pfavour
  274.   end
  275.   def mod_efavour
  276.     if @mod_efavour.nil?
  277.       if @note =~ /<mod_efavour: (.*)>/i
  278.         @mod_efavour = $1.to_i
  279.       else
  280.         @mod_efavour = 0
  281.       end
  282.     end
  283.     @mod_efavour
  284.   end
  285.    
  286.   def do_pfavour
  287.     if @do_pfavour.nil?
  288.       if @note =~ /<do_pfavour: (.*)>/i
  289.         @do_pfavour = $1.to_i
  290.       else
  291.         @do_pfavour = 0
  292.       end
  293.     end
  294.     @do_pfavour
  295.   end
  296.   def do_efavour
  297.     if @do_efavour.nil?
  298.       if @note =~ /<do_efavour: (.*)>/i
  299.         @do_efavour = $1.to_i
  300.       else
  301.         @do_efavour = 0
  302.       end
  303.     end
  304.     @do_efavour
  305.   end
  306. end # RPG::BaseItem


  307. class Window_Favour < Window_Base

  308.   def initialize
  309.     super(0, 0, Graphics.width, Graphics.height)
  310.     @cycle = 0
  311.     contents.font.name = Galv_Favour::FONT
  312.     update_location
  313.     draw_favour_bars
  314.     self.opacity = 0
  315.   end
  316.    
  317.   def bar_width
  318.     return Galv_Favour::BAR_WIDTH
  319.   end
  320.    
  321.   def update
  322.     self.refresh if $game_party.favour == Galv_Favour::FAVOUR_MAX || $game_party.enemy_favour == Galv_Favour::FAVOUR_MAX || $imported["YEA-BattleEngine"]
  323.   end

  324.   def refresh
  325.     contents.clear
  326.     draw_favour_bars
  327.   end

  328.   def open
  329.     refresh
  330.     super
  331.   end

  332.   def update_location
  333.     case Galv_Favour::BAR_POSITION
  334.     when "top"
  335.       self.y = 0
  336.     when "bottom"
  337.       self.y = Graphics.height - 170
  338.     else
  339.       self.y = Galv_Favour::BAR_POSITION
  340.     end
  341.     self.z = 0
  342.   end
  343.    
  344.   def party_random_color
  345.     @cycle = rand(Galv_Favour::PARTY_ACTIVATE_COLORS.count)
  346.     return Galv_Favour::PARTY_ACTIVATE_COLORS[@cycle]
  347.   end
  348.    
  349.   def enemy_random_color
  350.     @cycle = rand(Galv_Favour::ENEMY_ACTIVATE_COLORS.count)
  351.     return Galv_Favour::ENEMY_ACTIVATE_COLORS[@cycle]
  352.   end

  353.   def draw_favour_bars
  354.     draw_party_favour(Graphics.width / 2, 0, bar_width)
  355.     draw_enemy_favour(Graphics.width / 2 - bar_width - 20, 0, bar_width)
  356.   end
  357.    
  358.   def draw_party_favour(x, y, width)
  359.     if $game_party.favour < Galv_Favour::FAVOUR_MAX
  360.       draw_favour_gauge(x, y, width, favour_rate, text_color(Galv_Favour::PARTY_BAR_COLORS[0]), text_color(Galv_Favour::PARTY_BAR_COLORS[1]))
  361.     else
  362.       draw_favour_gauge(x, y, width, favour_rate, text_color(party_random_color), text_color(party_random_color))
  363.       change_color(text_color(Galv_Favour::PARTY_TURNS_COLOR))
  364.       xr = x + width
  365.       contents.font.size = Galv_Favour::TURNS_TEXT_SIZE
  366.       draw_text(xr - 100, y + Galv_Favour::TEXT_Y, 100, contents.font.size, $game_party.p_special.to_s + Galv_Favour::TURNS_TEXT, 2)
  367.       
  368.     end
  369.     change_color(text_color(Galv_Favour::PARTY_TEXT_COLOR))
  370.     contents.font.size = Galv_Favour::TEXT_SIZE

  371.     draw_text(x, y + Galv_Favour::TEXT_Y, bar_width, contents.font.size, party_text)
  372.     if Galv_Favour::SHOW_NUMBERS && $game_party.p_special <= 0
  373.       xr = x + width
  374.       draw_text(xr - 100, y + Galv_Favour::TEXT_Y, 100, contents.font.size, $game_party.favour.to_s, 2)
  375.     end
  376.   end
  377.    
  378.   def draw_enemy_favour(x, y, width)
  379.      
  380.     if $game_party.enemy_favour < Galv_Favour::FAVOUR_MAX
  381.       draw_reverse_gauge(x, y, width, enemy_favour_rate, text_color(Galv_Favour::ENEMY_BAR_COLORS[0]), text_color(Galv_Favour::ENEMY_BAR_COLORS[1]))
  382.     else
  383.       draw_reverse_gauge(x, y, width, enemy_favour_rate, text_color(enemy_random_color), text_color(enemy_random_color))
  384.       change_color(text_color(Galv_Favour::ENEMY_TURNS_COLOR))
  385.       contents.font.size = Galv_Favour::TURNS_TEXT_SIZE
  386.       draw_text(x + 2, y + Galv_Favour::TEXT_Y, 100, contents.font.size, $game_party.e_special.to_s + Galv_Favour::TURNS_TEXT, 0)
  387.     end
  388.     change_color(text_color(Galv_Favour::ENEMY_TEXT_COLOR))
  389.     contents.font.size = Galv_Favour::TEXT_SIZE
  390.      
  391.     draw_text(x + 2, y + Galv_Favour::TEXT_Y, bar_width, contents.font.size, enemy_text,2)
  392.     if Galv_Favour::SHOW_NUMBERS && $game_party.e_special <= 0
  393.       xr = x + width
  394.       draw_text(x + 2, y + Galv_Favour::TEXT_Y, 100, contents.font.size, $game_party.enemy_favour.to_s, 0)
  395.     end
  396.   end
  397.    
  398.   def enemy_text
  399.     Galv_Favour::ENEMY_TEXT
  400.   end
  401.   def enemy_favour_rate
  402.     [$game_party.enemy_favour.to_f, Galv_Favour::FAVOUR_MAX].min / Galv_Favour::FAVOUR_MAX
  403.   end
  404.    
  405.   def party_text
  406.     Galv_Favour::PARTY_TEXT
  407.   end
  408.   def favour_rate
  409.     [$game_party.favour.to_f, Galv_Favour::FAVOUR_MAX].min / Galv_Favour::FAVOUR_MAX
  410.   end


  411.   def draw_favour_gauge(x, y, width, rate, color1, color2)
  412.     fill_w = (width * rate).to_i
  413.     gauge_y = y + line_height - 8 + Galv_Favour::BAR_Y
  414.     contents.fill_rect(x, gauge_y, width, Galv_Favour::BAR_HEIGHT, gauge_back_color)
  415.     contents.gradient_fill_rect(x, gauge_y, fill_w, Galv_Favour::BAR_HEIGHT, color1, color2)
  416.   end
  417.    
  418.   def draw_reverse_gauge(x, y, width, rate, color1, color2)
  419.     fill_w = (width * rate).to_i
  420.     gauge_y = y + line_height - 8 + Galv_Favour::BAR_Y
  421.     contents.fill_rect(x, gauge_y, width, Galv_Favour::BAR_HEIGHT, gauge_back_color)
  422.     contents.gradient_fill_rect(x + width - fill_w, gauge_y, fill_w, Galv_Favour::BAR_HEIGHT, color1, color2)
  423.   end

  424. end # Window_Favour < Window_Base


  425. class Scene_Battle < Scene_Base
  426.    
  427.   alias galv_favour_sb_start start
  428.   def start
  429.     set_initial_favour
  430.     galv_favour_sb_start
  431.   end
  432.    
  433.   alias galv_favour_sb_terminate terminate
  434.   def terminate
  435.     clear_favour
  436.     galv_favour_sb_terminate
  437.   end
  438.    
  439.   alias galv_favour_create_all_windows create_all_windows
  440.   def create_all_windows
  441.     galv_favour_create_all_windows
  442.     @favour_window = Window_Favour.new if !$game_switches[Galv_Favour::DISABLE_SWITCH]
  443.   end
  444.    
  445.   alias galv_favour_refresh_status refresh_status
  446.   def refresh_status
  447.     galv_favour_refresh_status
  448.     @favour_window.refresh if !$game_switches[Galv_Favour::DISABLE_SWITCH]
  449.   end
  450.    
  451. if $imported["YEA-BattleEngine"]
  452.     def apply_item_effects(target, item)
  453.     if $imported["YEA-LunaticObjects"]
  454.       lunatic_object_effect(:prepare, item, @subject, target)
  455.     end
  456.     target.item_apply(@subject, item)
  457.     status_redraw_target(@subject)
  458.     status_redraw_target(target) unless target == @subject
  459.     @log_window.display_action_results(target, item)
  460.     if $imported["YEA-LunaticObjects"]
  461.       lunatic_object_effect(:during, item, @subject, target)
  462.     end
  463.     @status_window.refresh if !$game_switches[Galv_Favour::DISABLE_SWITCH]
  464.     perform_collapse_check(target)
  465.   end
  466. end

  467.   def set_initial_favour
  468.     $game_party.p_special = 0
  469.     $game_party.e_special = 0
  470.     min = Galv_Favour::INITIAL_PARTY_FAVOUR[0]
  471.     max = Galv_Favour::INITIAL_PARTY_FAVOUR[1]
  472.     $game_party.favour = rand(max - min) + min
  473.     min = Galv_Favour::INITIAL_ENEMY_FAVOUR[0]
  474.     max = Galv_Favour::INITIAL_ENEMY_FAVOUR[1]
  475.     $game_party.enemy_favour = rand(max - min) + min
  476.     if $game_switches[Galv_Favour::DISABLE_SWITCH]
  477.       $game_party.favour = 0
  478.       $game_party.enemy_favour = 0
  479.     end
  480.   end
  481.    
  482.   def clear_favour
  483.     $game_party.favour = 0
  484.     $game_party.enemy_favour = 0
  485.   end
  486.    
  487. end # Scene_Battle < Scene_Base


  488. class Game_Party < Game_Unit
  489.   attr_accessor :favour
  490.   attr_accessor :enemy_favour
  491.   attr_accessor :p_special
  492.   attr_accessor :e_special
  493.    
  494.   alias galv_favour_initialize initialize
  495.   def initialize
  496.     galv_favour_initialize
  497.     @favour = 0
  498.     @enemy_favour = 0
  499.     @p_special = 0
  500.     @e_special = 0
  501.   end
  502. end # Game_Party < Game_Unit


  503. class Game_BattlerBase

  504.   def apply_state
  505.     # get hash with KEYS: favour required and VALUES: state ids
  506.     @list = Galv_Favour::FAVOUR_STATES
  507.      
  508.     # get state_id required:
  509.     @get_state = (@list.select {|k,v| k <= $game_party.favour}).max[1]

  510.     # add state_id required. Remove all other state_id's in list
  511.     Galv_Favour::FAVOUR_STATES.each {|key, value|
  512.       $game_party.alive_members.each do |mem|
  513.          
  514.         if value == @get_state
  515.           if !mem.state?(@get_state) && value != 0
  516.             mem.add_favour_state(@get_state)
  517.           end
  518.         else
  519.           mem.remove_state(value)
  520.         end
  521.       end  
  522.     }
  523.   end
  524.    
  525.   def apply_enemy_state
  526.     # get hash with KEYS: favour required and VALUES: state ids
  527.     @enemy_list = Galv_Favour::ENEMY_FAVOUR_STATES
  528.      
  529.     # get state_id required:
  530.     @get_enemy_state = (@enemy_list.select {|k,v| k <= $game_party.enemy_favour}).max[1]

  531.     # add state_id required. Remove all other state_id's in list
  532.     Galv_Favour::ENEMY_FAVOUR_STATES.each {|key, value|
  533.       $game_troop.alive_members.each do |enemy|
  534.          
  535.         if value == @get_enemy_state
  536.           if !enemy.state?(@get_enemy_state) && value != 0
  537.             enemy.add_favour_state(@get_enemy_state)
  538.           end
  539.         else
  540.           enemy.remove_state(value)
  541.         end
  542.       end  
  543.     }
  544.   end
  545.    
  546.   def check_favour
  547.     return if $game_switches[Galv_Favour::DISABLE_SWITCH]
  548.     if $game_party.favour >= Galv_Favour::FAVOUR_MAX
  549.       $game_party.favour = Galv_Favour::FAVOUR_MAX
  550.       if $game_party.p_special == 0 && $game_party.favour == Galv_Favour::FAVOUR_MAX
  551.         RPG::SE.new(Galv_Favour::PARTY_ACTIVATE_SE[0], Galv_Favour::PARTY_ACTIVATE_SE[1], Galv_Favour::PARTY_ACTIVATE_SE[2]).play
  552.         $game_party.p_special = Galv_Favour::SPECIAL_TURNS
  553.         $game_temp.reserve_common_event(Galv_Favour::SPECIAL_ACTIVATE)
  554.       end
  555.     elsif $game_party.favour <= 0
  556.       $game_party.favour = 0
  557.       $game_party.p_special = 0
  558.     end
  559.      
  560.     if $game_party.enemy_favour >= Galv_Favour::FAVOUR_MAX
  561.       $game_party.enemy_favour = Galv_Favour::FAVOUR_MAX
  562.       if $game_party.e_special == 0 && $game_party.enemy_favour == Galv_Favour::FAVOUR_MAX
  563.         RPG::SE.new(Galv_Favour::ENEMY_ACTIVATE_SE[0], Galv_Favour::ENEMY_ACTIVATE_SE[1], Galv_Favour::ENEMY_ACTIVATE_SE[2]).play
  564.         $game_party.e_special = Galv_Favour::SPECIAL_TURNS
  565.         $game_temp.reserve_common_event(Galv_Favour::ENEMY_SPECIAL_ACTIVATE)
  566.       end
  567.     elsif $game_party.enemy_favour <= 0
  568.       $game_party.enemy_favour = 0
  569.       $game_party.e_special = 0
  570.     end
  571.   end
  572. end # Game_BattlerBase


  573. class Game_Battler < Game_BattlerBase
  574.   include Galv_Favour_Mechanics
  575.    
  576.   alias galv_favour_execute_damage execute_damage
  577.   def execute_damage(user)
  578.     $game_temp.user = user
  579.     galv_favour_execute_damage(user)
  580.   end
  581.    
  582.   alias galv_favour_on_damage on_damage
  583.   def on_damage(value)
  584.     galv_favour_on_damage(value)
  585.     return if $game_switches[Galv_Favour::DISABLE_SWITCH]
  586.     if $game_temp.user.actor?
  587.       # When enemy is damaged
  588.       if $game_party.e_special > 0
  589.         charge = charge_favour(value)
  590.         $game_party.favour += charge / 2
  591.       else
  592.         charge = charge_favour(value)
  593.         $game_party.favour += charge
  594.         $game_party.enemy_favour -= (charge * Galv_Favour::REDUCE_OPPONENT).to_i
  595.       end
  596.     else
  597.       # When party is damaged
  598.       if $game_party.p_special > 0
  599.         charge = charge_enemy_favour(value)
  600.         $game_party.enemy_favour += charge / 2
  601.       else
  602.         charge = charge_enemy_favour(value)
  603.         $game_party.enemy_favour += charge
  604.         $game_party.favour -= (charge * Galv_Favour::REDUCE_OPPONENT).to_i
  605.       end
  606.     end
  607.     check_favour
  608.     apply_state
  609.     apply_enemy_state
  610.   end
  611.    
  612.   def add_favour_state(state_id)
  613.     add_new_state(state_id) unless state?(state_id)
  614.     reset_state_counts(state_id)
  615.     @result.added_states.push(state_id).uniq!
  616.   end
  617.    
  618.   alias galv_favour_use_item use_item
  619.   def use_item(item)
  620.     $game_temp.skill_used = item
  621.     galv_favour_use_item(item)
  622.     change_party_favour if $game_temp.skill_used.mod_pfavour != 0
  623.     change_enemy_favour if $game_temp.skill_used.mod_efavour != 0
  624.     apply_state
  625.     apply_enemy_state
  626.     check_favour
  627.   end
  628.    
  629.   def change_party_favour
  630.     case $game_temp.skill_used.mod_pfavour
  631.     when 1
  632.       $game_party.favour += $game_temp.skill_used.do_pfavour
  633.     when 2
  634.       $game_party.favour *= $game_temp.skill_used.do_pfavour
  635.     when 3
  636.       $game_party.favour = $game_temp.skill_used.do_pfavour
  637.     end
  638.   end
  639.    
  640.   def change_enemy_favour
  641.     case $game_temp.skill_used.mod_efavour
  642.     when 1
  643.       $game_party.enemy_favour += $game_temp.skill_used.do_efavour
  644.     when 2
  645.       $game_party.enemy_favour *= $game_temp.skill_used.do_efavour
  646.     when 3
  647.       $game_party.enemy_favour = $game_temp.skill_used.do_efavour
  648.     end
  649.   end
  650.    
  651. end # Game_Battler < Game_BattlerBase


  652. class Game_Enemy < Game_Battler
  653.   attr_accessor :favour
  654.    
  655.   alias galv_favour_enemy_initialize initialize
  656.   def initialize(index, enemy_id)
  657.     galv_favour_enemy_initialize(index, enemy_id)
  658.     @favour = $data_enemies[enemy_id].favour_bonus
  659.   end

  660. end # Game_Enemy < Game_Battler


  661. class Game_Actor < Game_Battler
  662.   attr_accessor :favour
  663.    
  664.   alias galv_favour_actor_initialize initialize
  665.   def initialize(actor_id)
  666.     galv_favour_actor_initialize(actor_id)
  667.     @favour = $data_actors[actor_id].favour_bonus
  668.   end

  669. end # Game_Actor < Game_Battler


  670. class Game_Temp
  671.   attr_accessor :user
  672.   attr_accessor :skill_used
  673. end # Game_Temp


  674. module BattleManager
  675.    
  676.   class << self
  677.     alias galv_favour_bm_turn_end turn_end
  678.      
  679.     def turn_end
  680.       galv_favour_bm_turn_end
  681.       return if $game_switches[Galv_Favour::DISABLE_SWITCH]
  682.       if $game_party.p_special >= 0 && $game_party.favour == Galv_Favour::FAVOUR_MAX
  683.         $game_party.p_special -= 1
  684.         if $game_party.p_special == 0
  685.           $game_party.favour = 0
  686.           rem_party_state
  687.         end
  688.       end
  689.       
  690.       if $game_party.e_special >= 0 && $game_party.enemy_favour == Galv_Favour::FAVOUR_MAX
  691.         $game_party.e_special -= 1
  692.         if $game_party.e_special == 0
  693.           $game_party.enemy_favour = 0
  694.           rem_enemy_state
  695.         end
  696.       end
  697.     end
  698.       
  699.     def rem_party_state
  700.       @list = Galv_Favour::FAVOUR_STATES

  701.       Galv_Favour::FAVOUR_STATES.each {|key, value|
  702.         $game_party.alive_members.each do |mem|
  703.           mem.remove_state(value)
  704.         end  
  705.       }
  706.     end
  707.    
  708.     def rem_enemy_state
  709.       @enemy_list = Galv_Favour::ENEMY_FAVOUR_STATES

  710.       Galv_Favour::ENEMY_FAVOUR_STATES.each {|key, value|
  711.         $game_troop.alive_members.each do |enemy|
  712.           enemy.remove_state(value)
  713.         end  
  714.       }
  715.     end
  716.   end
  717.    
  718. end # BattleManager
复制代码


状态蓝盾
  1. # Manashield
  2. # This will make a manashield state which allow actor takes damage to mana
  3. # instead of health points.
  4. # Usage: use this notetag inside a state <manashield: X, Y%>
  5. # X is damage absorb per mana point.
  6. # Y is damage percentage which can be absorbed.
  7. # Free for all using purposes.
  8. # Credit: Archeia Nessiah for the allowance.

  9. module REGEXP
  10.   module MANASHIELD
  11.     MANASHIELD = /<manashield:[ ]*(\d+),[ ]*(\d+)[%“]?>/i
  12.   end # MANASHIELD
  13. end # REGEXP

  14. #==============================================================================
  15. # ¡ DataManager
  16. #==============================================================================

  17. module DataManager
  18.    
  19.   #--------------------------------------------------------------------------
  20.   # alias method: load_database
  21.   #--------------------------------------------------------------------------
  22.   class <<self; alias load_database_manashield load_database; end
  23.   def self.load_database
  24.     load_database_manashield
  25.     initialize_manashield
  26.   end
  27.   
  28.   #--------------------------------------------------------------------------
  29.   # new method: initialize_manashield
  30.   #--------------------------------------------------------------------------
  31.   def self.initialize_manashield
  32.     groups = [$data_states]
  33.     groups.each { |group|
  34.       group.each { |obj|
  35.         next if obj.nil?
  36.         obj.initialize_manashield
  37.       }
  38.     }
  39.   end
  40.   
  41. end # DataManager

  42. #==============================================================================
  43. # ¡ RPG::BaseItem
  44. #==============================================================================

  45. class RPG::BaseItem
  46.   
  47.   #--------------------------------------------------------------------------
  48.   # * Public Instance Variables
  49.   #--------------------------------------------------------------------------
  50.   attr_accessor :manashield

  51.   #--------------------------------------------------------------------------
  52.   # new method: initialize_manashield
  53.   #--------------------------------------------------------------------------
  54.   def initialize_manashield
  55.     #---
  56.     self.note.split(/[\r\n]+/).each { |line|
  57.       case line
  58.       when REGEXP::MANASHIELD::MANASHIELD
  59.         @manashield = [$1.to_i, [$2.to_i, 100].min]
  60.       end
  61.     }
  62.   end
  63.   
  64. end # RPG::BaseItem

  65. #==============================================================================
  66. # ¡ Game_ActionResult
  67. #==============================================================================

  68. class Game_ActionResult
  69.   
  70.   #--------------------------------------------------------------------------
  71.   # alias method: make_damage
  72.   #--------------------------------------------------------------------------
  73.   alias manashield_make_damage make_damage
  74.   def make_damage(value, item)
  75.     manashield_make_damage(value, item)
  76.     #---
  77.     if @battler.manashield && @battler.mp > 0
  78.       dpm = @battler.manashield[0]
  79.       percent = @battler.manashield[1]
  80.       shield = (@hp_damage * percent.to_f) / 100.0
  81.       shield = shield / dpm.to_f
  82.       shield = [shield, @battler.mp.to_f].min
  83.       @hp_damage -= (shield * dpm.to_f).to_i
  84.       @mp_damage += shield.to_i
  85.     end
  86.   end
  87.   
  88. end # Game_ActionResult

  89. #==============================================================================
  90. # ¡ Game_Battler
  91. #==============================================================================

  92. class Game_Battler < Game_BattlerBase
  93.   
  94.   #--------------------------------------------------------------------------
  95.   # new method: manashield
  96.   #--------------------------------------------------------------------------
  97.   def manashield
  98.     mns = nil
  99.     states.each { |state|
  100.       next unless state.manashield
  101.       mns = state.manashield
  102.       break
  103.     }
  104.     return mns ? mns : false
  105.   end
  106.   
  107. end # Game_Battler
复制代码


充能的技能(比那位tarxod大大那个延迟好用,因为T大大每回合都能动,但是到了释放时刻,没达到要求就不放了)
  1. #==============================================================================
  2. #
  3. # ¥ Yami Engine Ace - Charge Skill
  4. # -- Last Updated: 2012.05.13
  5. # -- Level: Easy
  6. # -- Requires: none
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YSE-ChargeSkill"] = true

  11. #==============================================================================
  12. # ¥ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.05.13 - Fixed Enemy Charging.
  15. # 2012.03.30 - Fixed Skill Targets.
  16. # 2012.03.29 - Fixed Auto Battle bug.
  17. # 2012.03.27 - Fixed Cancel Charge bug.
  18. # 2012.03.26 - Fixed Battle End bug.
  19. # 2012.03.18 - Started and Finished Script.
  20. #
  21. #==============================================================================
  22. # ¥ Introduction
  23. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  24. # This script provides charging skill feature. Charging Skill means that skill
  25. # will be used after some turn it was choosen.
  26. #
  27. #==============================================================================
  28. # ¥ Instructions
  29. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  30. # To install this script, open up your script editor and copy/paste this script
  31. # to an open slot below ¥ Materials/‘fÞ but above ¥ Main. Remember to save.
  32. #
  33. # -----------------------------------------------------------------------------
  34. # Skill/Item Notetags - These notetags go in the skill/item notebox in the database.
  35. # -----------------------------------------------------------------------------
  36. # <charge turn: x>
  37. # Make skill be a charge skill with x charging turns.
  38. # -----------------------------------------------------------------------------
  39. # <start charge message>
  40. # example
  41. # </start charge message>
  42. #
  43. # Set the Charging Start Message to example.
  44. # -----------------------------------------------------------------------------
  45. # <continue charge message>
  46. # example
  47. # </continue charge message>
  48. #
  49. # Set the Charging Continue Message to example.
  50. #
  51. #==============================================================================
  52. # ¥ Compatibility
  53. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  54. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  55. # it will run with RPG Maker VX without adjusting.
  56. #
  57. #==============================================================================

  58. module YSE
  59.   module CHARGE_SKILL
  60.    
  61.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  62.     # - Visual Settings -
  63.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  64.     VISUAL_SETTING = { # Start.
  65.       # Message shows when choose a charge skill.
  66.       # Set this to nil to disable.
  67.       :default_msg_start      =>  "%s 开始充能 %s!",
  68.       # Message shows when end a charging turn.
  69.       # Set this to nil to disable.
  70.       :default_msg_continue   =>  "%s 还在充能 %s...",
  71.     } # End.
  72.    
  73.   end # CHARGE_SKILL
  74. end # YSE

  75. #==============================================================================
  76. # ¥ Editting anything past this point may potentially result in causing
  77. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  78. # halitosis so edit at your own risk.
  79. #==============================================================================

  80. #==============================================================================
  81. # ¡ Regular Expression
  82. #==============================================================================

  83. module YSE
  84.   module REGEXP
  85.   module USABLEITEM
  86.    
  87.     CHARGE_TURN = /<(?:CHARGE_TURN|charge turn):[ ](\d+)?>/i
  88.     START_MSG_BEGIN = /<(?:START_CHARGE_MESSAGE|start charge message)>/i
  89.     START_MSG_END = /<\/(?:START_CHARGE_MESSAGE|start charge message)>/i
  90.     CONT_MSG_BEGIN = /<(?:CONTINUE_CHARGE_MESSAGE|continue charge message)>/i
  91.     CONT_MSG_END = /<\/(?:CONTINUE_CHARGE_MESSAGE|continue charge message)>/i
  92.    
  93.   end # STATE
  94.   end # REGEXP
  95. end # YSE

  96. #==============================================================================
  97. # ¡ DataManager
  98. #==============================================================================

  99. module DataManager
  100.   
  101.   #--------------------------------------------------------------------------
  102.   # alias method: load_database
  103.   #--------------------------------------------------------------------------
  104.   class <<self; alias load_database_ysecs load_database; end
  105.   def self.load_database
  106.     load_database_ysecs
  107.     load_notetags_ysecs
  108.   end
  109.   
  110.   #--------------------------------------------------------------------------
  111.   # new method: load_notetags_ysecs
  112.   #--------------------------------------------------------------------------
  113.   def self.load_notetags_ysecs
  114.     groups = [$data_skills, $data_items]
  115.     for group in groups
  116.       for obj in group
  117.         next if obj.nil?
  118.         obj.load_notetags_ysecs
  119.       end
  120.     end
  121.   end
  122.   
  123. end # DataManager

  124. #==============================================================================
  125. # ¡ RPG::UsableItem
  126. #==============================================================================

  127. class RPG::UsableItem < RPG::BaseItem
  128.   
  129.   #--------------------------------------------------------------------------
  130.   # public instance variables
  131.   #--------------------------------------------------------------------------
  132.   attr_accessor :charge_turn
  133.   attr_accessor :start_msg
  134.   attr_accessor :continue_msg
  135.   
  136.   #--------------------------------------------------------------------------
  137.   # common cache: load_notetags_ysecs
  138.   #--------------------------------------------------------------------------
  139.   def load_notetags_ysecs
  140.     @start_begin = false
  141.     @continue_begin = false
  142.     @charge_turn = 0
  143.     #---
  144.     self.note.split(/[\r\n]+/).each { |line|
  145.       case line
  146.       #---
  147.       when YSE::REGEXP::USABLEITEM::CHARGE_TURN
  148.         @charge_turn = $1.to_i
  149.       when YSE::REGEXP::USABLEITEM::START_MSG_BEGIN
  150.         @start_begin = true
  151.       when YSE::REGEXP::USABLEITEM::START_MSG_END
  152.         @start_begin = false
  153.       when YSE::REGEXP::USABLEITEM::CONT_MSG_BEGIN
  154.         @continue_begin = true
  155.       when YSE::REGEXP::USABLEITEM::CONT_MSG_END
  156.         @continue_begin = false
  157.       else
  158.         @start_msg = line.to_s if @start_msg.nil? && @start_begin
  159.         @start_msg += line.to_s if @start_begin
  160.         @continue_msg = line.to_s if @continue_msg.nil? && @continue_begin
  161.         @continue_msg += line.to_s if @continue_begin
  162.       end
  163.     } # self.note.split
  164.     #---
  165.     @charge_turn = nil if @charge_turn <= 0
  166.     @start_msg = YSE::CHARGE_SKILL::VISUAL_SETTING[:default_msg_start]
  167.     @continue_msg = YSE::CHARGE_SKILL::VISUAL_SETTING[:default_msg_continue]
  168.     @start_msg = nil if @start_msg == ""
  169.     @continue_msg = nil if @continue_msg == ""
  170.   end
  171.   
  172. end # RPG::UsableItem

  173. #==============================================================================
  174. # ¡ Game_Battler
  175. #==============================================================================

  176. class Game_Battler < Game_BattlerBase
  177.   
  178.   #--------------------------------------------------------------------------
  179.   # public instance variables
  180.   #--------------------------------------------------------------------------
  181.   attr_accessor :charged
  182.   attr_accessor :first_charge

  183.   #--------------------------------------------------------------------------
  184.   # alias method: auto_battle?
  185.   #--------------------------------------------------------------------------
  186.   alias yse_auto_battle_cs auto_battle?
  187.   def auto_battle?
  188.     charging? ? false : yse_auto_battle_cs
  189.   end
  190.   
  191.   #--------------------------------------------------------------------------
  192.   # new method: charging?
  193.   #--------------------------------------------------------------------------
  194.   def charging?
  195.     !@charging_cache.nil? || @charged
  196.   end
  197.   
  198.   #--------------------------------------------------------------------------
  199.   # new method: start_charge
  200.   #--------------------------------------------------------------------------
  201.   def start_charge
  202.     return false if charging?
  203.     return false if current_action.item.charge_turn.nil?
  204.     @charging_cache = current_action.clone
  205.     @charge_turn = current_action.item.charge_turn
  206.     return true
  207.   end
  208.   
  209.   #--------------------------------------------------------------------------
  210.   # new method: current_charging
  211.   #--------------------------------------------------------------------------
  212.   def current_charging
  213.     @charging_cache
  214.   end
  215.   
  216.   #--------------------------------------------------------------------------
  217.   # new method: end_charge
  218.   #--------------------------------------------------------------------------
  219.   def end_charge
  220.     @actions.push(@charging_cache)
  221.     @charging_cache = nil
  222.     @charge_turn = nil
  223.     @charged = true
  224.     return true
  225.   end
  226.   
  227.   #--------------------------------------------------------------------------
  228.   # new method: cancel_charge
  229.   #--------------------------------------------------------------------------
  230.   def cancel_charge
  231.     clear_actions
  232.     @charging_cache = nil
  233.     @charge_turn = nil
  234.     @charged = false
  235.   end
  236.   
  237.   #--------------------------------------------------------------------------
  238.   # new method: update_charge_skill
  239.   #--------------------------------------------------------------------------
  240.   def update_charge_skill
  241.     @charge_turn -= 1
  242.     return end_charge if @charge_turn == 0
  243.     return false
  244.   end
  245.   
  246.   #--------------------------------------------------------------------------
  247.   # alias method: on_battle_end
  248.   #--------------------------------------------------------------------------
  249.   alias yse_on_battle_end_cs on_battle_end
  250.   def on_battle_end
  251.     cancel_charge
  252.     yse_on_battle_end_cs
  253.   end

  254. end # Game_Battler

  255. #==============================================================================
  256. # ¡ Game_Actor
  257. #==============================================================================

  258. class Game_Actor < Game_Battler
  259.   
  260.   #--------------------------------------------------------------------------
  261.   # alias method: inputable?
  262.   #--------------------------------------------------------------------------
  263.   alias yse_inputable_cs inputable?
  264.   def inputable?
  265.     yse_inputable_cs && !charging?
  266.   end
  267.   
  268. end # Game_Actor

  269. #==============================================================================
  270. # ¡ Game_Enemy
  271. #==============================================================================

  272. class Game_Enemy < Game_Battler
  273.   
  274.   #--------------------------------------------------------------------------
  275.   # alias method: make_actions
  276.   #--------------------------------------------------------------------------
  277.   alias yse_make_actions_cs make_actions
  278.   def make_actions
  279.     return super if charging?
  280.     yse_make_actions_cs
  281.   end
  282.   
  283. end # Game_Enemy

  284. #==============================================================================
  285. # ¡ Scene_Battle
  286. #==============================================================================

  287. class Scene_Battle < Scene_Base
  288.   
  289.   #--------------------------------------------------------------------------
  290.   # alias method: execute_action
  291.   #--------------------------------------------------------------------------
  292.   alias yse_execute_action_bacs execute_action
  293.   def execute_action
  294.     return start_charge if @subject.start_charge
  295.     yse_execute_action_bacs
  296.   end
  297.    
  298.   #--------------------------------------------------------------------------
  299.   # alias method: process_action_end
  300.   #--------------------------------------------------------------------------
  301.   alias yse_process_action_end_bacs process_action_end
  302.   def process_action_end
  303.     process_charge_skill
  304.     yse_process_action_end_bacs
  305.   end
  306.   
  307.   #--------------------------------------------------------------------------
  308.   # new method: start_charge
  309.   #--------------------------------------------------------------------------
  310.   def start_charge
  311.     @subject.first_charge = true
  312.     return if @subject.current_action.item.start_msg.nil?
  313.     str = @subject.current_action.item.start_msg
  314.     skill = @subject.current_action.item
  315.     skill_text = sprintf("\\i[%d]%s", skill.icon_index, skill.name)
  316.     text = sprintf(str, @subject.name, skill_text)
  317.     @log_window.add_text(text)
  318.     3.times do @log_window.wait end
  319.     @log_window.back_one
  320.   end

  321.   #--------------------------------------------------------------------------
  322.   # new method: process_charge_skill
  323.   #--------------------------------------------------------------------------
  324.   def process_charge_skill
  325.     return @subject.first_charge = false if @subject.first_charge
  326.     return unless @subject.charging?
  327.     return unless check_charge_turn
  328.     process_action_charge
  329.   end

  330.   #--------------------------------------------------------------------------
  331.   # new method: check_charge_turn
  332.   #--------------------------------------------------------------------------
  333.   def check_charge_turn
  334.     continue = @subject.update_charge_skill
  335.     if continue
  336.       return true
  337.     else
  338.       return false if @subject.current_charging.item.continue_msg.nil?
  339.       str = @subject.current_charging.item.continue_msg
  340.       skill = @subject.current_charging.item
  341.       skill_text = sprintf("\\i[%d]%s", skill.icon_index, skill.name)
  342.       text = sprintf(str, @subject.name, skill_text)
  343.       @log_window.add_text(text)
  344.       3.times do @log_window.wait end
  345.       @log_window.back_one
  346.     end
  347.     return false
  348.   end
  349.   
  350.   #--------------------------------------------------------------------------
  351.   # new method: process_action_charge
  352.   #--------------------------------------------------------------------------
  353.   def process_action_charge
  354.     loop do
  355.       break if $game_troop.all_dead?
  356.       break unless @subject.current_action
  357.       @subject.current_action.prepare
  358.       execute_action if @subject.current_action.valid?
  359.       @subject.remove_current_action
  360.     end
  361.     @subject.charged = false
  362.   end
  363.   
  364. end # Scene_Battle

  365. #==============================================================================
  366. #
  367. # ¥ End of File
  368. #
  369. #==============================================================================
复制代码


环境脚本
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Field State Effects v1.00
  4. # -- Last Updated: 2012.01.11
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-FieldStateEffects"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.11 - Started Script and Finished.
  15. #
  16. #==============================================================================
  17. # ▼ Introduction
  18. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  19. # Field States are states that are applied to all actors and enemies without
  20. # discrimination. Field states cannot be removed through usual means and can
  21. # only be applied through certain skills and items. Multiple field states can
  22. # be added at once whether side by side or overwriting any previous field
  23. # states. Skills and items can also alter the turns of existing field states.
  24. #
  25. #==============================================================================
  26. # ▼ Instructions
  27. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  28. # To install this script, open up your script editor and copy/paste this script
  29. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  30. #
  31. # -----------------------------------------------------------------------------
  32. # Skill Notetags - These notetags go in the skill notebox in the database.
  33. # -----------------------------------------------------------------------------
  34. # <add field state: x>
  35. # <add field state: x, x>
  36. # Causes the action to add state x to the field, making it apply to everyone
  37. # and cannot be removed through normal state removal means. Insert multiples of
  38. # this tag to have the action cause multiple field states.
  39. #
  40. # <remove field state: x>
  41. # <remove field state: x, x>
  42. # Causes the action to remove state x from the field. This does not remove
  43. # states that were inflicted normally. Insert multiples of this tag to remove
  44. # multiple field states.
  45. #
  46. # <remove all field states>
  47. # Causes the action to remove all field states. This does not remove states
  48. # that were inflicted normally.
  49. #
  50. # <overwrite field state: x>
  51. # <overwrite field state: x, x>
  52. # Causes the action to remove all field states and then add field states x,
  53. # making it apply to everyone and cannot be removed through normal state
  54. # removal means. Insert multiples of this tag to have the action overwrite and
  55. # add more field states.
  56. #
  57. # <field state x turns: +y>
  58. # <field state x turns: -y>
  59. # Changes the remaining turns on field state x by y amount. If a field state
  60. # is to reach 0 or less turns through this process, the field state is removed.
  61. # This effect does not add turns to field states that weren't inflicted. Insert
  62. # multiples of this tag to adjust multiple field states at once.
  63. #
  64. # <all field state turns: +x>
  65. # <all field state turns: -x>
  66. # Changes the remaining turns on all field states by x amount. If a field state
  67. # is to reach 0 or less turns through this process, the field state is removed.
  68. #
  69. # -----------------------------------------------------------------------------
  70. # Item Notetags - These notetags go in the items notebox in the database.
  71. # -----------------------------------------------------------------------------
  72. # <add field state: x>
  73. # <add field state: x, x>
  74. # Causes the action to add state x to the field, making it apply to everyone
  75. # and cannot be removed through normal state removal means. Insert multiples of
  76. # this tag to have the action cause multiple field states.
  77. #
  78. # <remove field state: x>
  79. # <remove field state: x, x>
  80. # Causes the action to remove state x from the field. This does not remove
  81. # states that were inflicted normally. Insert multiples of this tag to remove
  82. # multiple field states.
  83. #
  84. # <remove all field states>
  85. # Causes the action to remove all field states. This does not remove states
  86. # that were inflicted normally.
  87. #
  88. # <overwrite field state: x>
  89. # <overwrite field state: x, x>
  90. # Causes the action to remove all field states and then add field states x,
  91. # making it apply to everyone and cannot be removed through normal state
  92. # removal means. Insert multiples of this tag to have the action overwrite and
  93. # add more field states.
  94. #
  95. # <field state x turns: +y>
  96. # <field state x turns: -y>
  97. # Changes the remaining turns on field state x by y amount. If a field state
  98. # is to reach 0 or less turns through this process, the field state is removed.
  99. # This effect does not add turns to field states that weren't inflicted. Insert
  100. # multiples of this tag to adjust multiple field states at once.
  101. #
  102. # <all field state turns: +x>
  103. # <all field state turns: -x>
  104. # Changes the remaining turns on all field states by x amount. If a field state
  105. # is to reach 0 or less turns through this process, the field state is removed.
  106. #
  107. # -----------------------------------------------------------------------------
  108. # State Notetags - These notetags go in the states notebox in the database.
  109. # -----------------------------------------------------------------------------
  110. # <field back 1: string>
  111. # <field back 2: string>
  112. # If this state is being used as a field state and this state is the state with
  113. # the highest priority, these notetags will determine the battlebacks used
  114. # while the field state is in effect. If this notetag is not used, there will
  115. # be no changes to the battleback.
  116. #
  117. #==============================================================================
  118. # ▼ Compatibility
  119. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  120. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  121. # it will run with RPG Maker VX without adjusting.
  122. #
  123. #==============================================================================

  124. module YEA
  125.   module FIELD_STATES
  126.    
  127.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  128.     # - Visual Settings -
  129.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  130.     # This setting causes a wave effect to play whenever the battlebacks change
  131.     # due to field state effects.
  132.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  133.     WAVE_EFFECT = true  # Plays a wave effect when the battleback changes.
  134.    
  135.   end # FIELD_STATES
  136. end # YEA

  137. #==============================================================================
  138. # ▼ Editting anything past this point may potentially result in causing
  139. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  140. # halitosis so edit at your own risk.
  141. #==============================================================================

  142. module YEA
  143.   module REGEXP
  144.   module USABLEITEM
  145.    
  146.     ADD_FIELD_STATE =
  147.       /<(?:ADD_FIELD_STATE|add field state):[ ](\d+(?:\s*,\s*\d+)*)>/i
  148.     REMOVE_FIELD_STATE =
  149.       /<(?:REMOVE_FIELD_STATE|remove field state):[ ](\d+(?:\s*,\s*\d+)*)>/i
  150.     REMOVE_ALL_FIELD_STATES =
  151.       /<(?:REMOVE_ALL_FIELD_STATES|remove all field states)>/i
  152.     OVERWRITE_FIELD_STATE =
  153.     /<(?:OVERWRITE_FIELD_STATE|OVERWRITE field state):[ ](\d+(?:\s*,\s*\d+)*)>/i
  154.     CHANGE_FIELD_STATE_TURN =
  155.       /<(?:FIELD state)[ ](\d+)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
  156.     CHANGE_ALL_FIELD_STATE_TURN =
  157.       /<(?:ALL_FIELD_STATE_TURNS|all field state turns):[ ]([\+\-]\d+)>/i
  158.    
  159.   end # USABLEITEM
  160.   module STATE
  161.    
  162.     FIELD_BATTLEBACK1 = /<(?:FIELD_BACK1|field back1|field back 1):[ ](.*)>/i
  163.     FIELD_BATTLEBACK2 = /<(?:FIELD_BACK2|field back2|field back 2):[ ](.*)>/i
  164.    
  165.   end # STATE
  166.   end # REGEXP
  167. end # YEA

  168. #==============================================================================
  169. # ■ DataManager
  170. #==============================================================================

  171. module DataManager
  172.   
  173.   #--------------------------------------------------------------------------
  174.   # alias method: load_database
  175.   #--------------------------------------------------------------------------
  176.   class <<self; alias load_database_fse load_database; end
  177.   def self.load_database
  178.     load_database_fse
  179.     load_notetags_fse
  180.   end
  181.   
  182.   #--------------------------------------------------------------------------
  183.   # new method: load_notetags_fse
  184.   #--------------------------------------------------------------------------
  185.   def self.load_notetags_fse
  186.     groups = [$data_skills, $data_items, $data_states]
  187.     for group in groups
  188.       for obj in group
  189.         next if obj.nil?
  190.         obj.load_notetags_fse
  191.       end
  192.     end
  193.   end
  194.   
  195. end # DataManager

  196. #==============================================================================
  197. # ■ RPG::UsableItem
  198. #==============================================================================

  199. class RPG::UsableItem < RPG::BaseItem
  200.   
  201.   #--------------------------------------------------------------------------
  202.   # public instance variables
  203.   #--------------------------------------------------------------------------
  204.   attr_accessor :add_field_state
  205.   attr_accessor :remove_field_state
  206.   attr_accessor :remove_all_field_states
  207.   attr_accessor :change_field_state_turns
  208.   
  209.   #--------------------------------------------------------------------------
  210.   # common cache: load_notetags_fse
  211.   #--------------------------------------------------------------------------
  212.   def load_notetags_fse
  213.     @add_field_state = []
  214.     @remove_field_state = []
  215.     @remove_all_field_states = false
  216.     @change_field_state_turns = {}
  217.     #---
  218.     self.note.split(/[\r\n]+/).each { |line|
  219.       case line
  220.       #---
  221.       when YEA::REGEXP::USABLEITEM::ADD_FIELD_STATE
  222.         $1.scan(/\d+/).each { |num|
  223.         @add_field_state.push(num.to_i) if num.to_i > 0 }
  224.       when YEA::REGEXP::USABLEITEM::REMOVE_FIELD_STATE
  225.         $1.scan(/\d+/).each { |num|
  226.         @remove_field_state.push(num.to_i) if num.to_i > 0 }
  227.       when YEA::REGEXP::USABLEITEM::REMOVE_ALL_FIELD_STATES
  228.         @remove_all_field_states = true
  229.       when YEA::REGEXP::USABLEITEM::OVERWRITE_FIELD_STATE
  230.         @remove_all_field_states = true
  231.         $1.scan(/\d+/).each { |num|
  232.         @add_field_state.push(num.to_i) if num.to_i > 0 }
  233.       when YEA::REGEXP::USABLEITEM::CHANGE_FIELD_STATE_TURN
  234.         @change_field_state_turns[$1.to_i] = $2.to_i
  235.       when YEA::REGEXP::USABLEITEM::CHANGE_ALL_FIELD_STATE_TURN
  236.         for i in 1...$data_states.size
  237.           @change_field_state_turns[i] = $1.to_i
  238.         end
  239.       end
  240.     } # self.note.split
  241.     #---
  242.   end
  243.   
  244. end # class RPG::UsableItem

  245. #==============================================================================
  246. # ■ RPG::State
  247. #==============================================================================

  248. class RPG::State < RPG::BaseItem
  249.   
  250.   #--------------------------------------------------------------------------
  251.   # public instance variables
  252.   #--------------------------------------------------------------------------
  253.   attr_accessor :field_battlebacks
  254.   
  255.   #--------------------------------------------------------------------------
  256.   # common cache: load_notetags_fse
  257.   #--------------------------------------------------------------------------
  258.   def load_notetags_fse
  259.     @field_battlebacks = ["", ""]
  260.     #---
  261.     self.note.split(/[\r\n]+/).each { |line|
  262.       case line
  263.       #---
  264.       when YEA::REGEXP::STATE::FIELD_BATTLEBACK1
  265.         @field_battlebacks[0] = $1.to_s
  266.       when YEA::REGEXP::STATE::FIELD_BATTLEBACK2
  267.         @field_battlebacks[1] = $1.to_s
  268.       end
  269.     } # self.note.split
  270.     #---
  271.   end
  272.   
  273. end # RPG::State

  274. #==============================================================================
  275. # ■ BattleManager
  276. #==============================================================================

  277. module BattleManager
  278.   
  279.   #--------------------------------------------------------------------------
  280.   # alias method: init_members
  281.   #--------------------------------------------------------------------------
  282.   class <<self; alias battlemanager_init_members_fse init_members; end
  283.   def self.init_members
  284.     battlemanager_init_members_fse
  285.     clear_field_states
  286.   end
  287.   
  288.   #--------------------------------------------------------------------------
  289.   # new method: field_states
  290.   #--------------------------------------------------------------------------
  291.   def self.field_states
  292.     return @field_states.collect {|id| $data_states[id] }
  293.   end
  294.   
  295.   #--------------------------------------------------------------------------
  296.   # new method: field_state_turns
  297.   #--------------------------------------------------------------------------
  298.   def self.field_state_turns(state_id)
  299.     return @field_state_turns[state_id]
  300.   end
  301.   
  302.   #--------------------------------------------------------------------------
  303.   # new method: field_state?
  304.   #--------------------------------------------------------------------------
  305.   def self.field_state?(state_id)
  306.     return @field_states.include?(state_id)
  307.   end
  308.   
  309.   #--------------------------------------------------------------------------
  310.   # new method: sort_field_states
  311.   #--------------------------------------------------------------------------
  312.   def self.sort_field_states
  313.     @field_states = @field_states.sort_by { |id|
  314.       [-$data_states[id].priority, id] }
  315.     set_field_battlebacks
  316.     set_field_state_icons
  317.   end
  318.   
  319.   #--------------------------------------------------------------------------
  320.   # new method: clear_field_states
  321.   #--------------------------------------------------------------------------
  322.   def self.clear_field_states
  323.     @field_states = []
  324.     @field_state_turns = {}
  325.     @field_state_battleback = ["", ""]
  326.     @field_state_icons = []
  327.   end
  328.   
  329.   #--------------------------------------------------------------------------
  330.   # new method: add_field_state
  331.   #--------------------------------------------------------------------------
  332.   def self.add_field_state(state_id)
  333.     return if $data_states[state_id].nil?
  334.     return if @field_states.include?(state_id)
  335.     @field_states.push(state_id)
  336.     state = $data_states[state_id]
  337.     variance = 1 + [state.max_turns - state.min_turns, 0].max
  338.     @field_state_turns[state_id] = state.min_turns + rand(variance)
  339.     sort_field_states
  340.   end
  341.   
  342.   #--------------------------------------------------------------------------
  343.   # new method: remove_field_state
  344.   #--------------------------------------------------------------------------
  345.   def self.remove_field_state(state_id)
  346.     return if $data_states[state_id].nil?
  347.     return unless @field_states.include?(state_id)
  348.     @field_states.delete(state_id)
  349.     @field_state_turns.delete(state_id)
  350.     sort_field_states
  351.   end
  352.   
  353.   #--------------------------------------------------------------------------
  354.   # new method: change_field_state_turns
  355.   #--------------------------------------------------------------------------
  356.   def self.change_field_state_turns(state_id, value)
  357.     return unless field_state?(state_id)
  358.     state_id = state_id.id if state_id.is_a?(RPG::State)
  359.     return if $data_states[state_id].auto_removal_timing <= 0
  360.     @field_state_turns[state_id] = 0 if @field_state_turns[state_id].nil?
  361.     @field_state_turns[state_id] = [value, 0].max
  362.     remove_field_state(state_id) if @field_state_turns[state_id] <= 0
  363.   end
  364.   
  365.   #--------------------------------------------------------------------------
  366.   # alias method: turn_end
  367.   #--------------------------------------------------------------------------
  368.   class <<self; alias battlemanager_turn_end_fse turn_end; end
  369.   def self.turn_end
  370.     battlemanager_turn_end_fse
  371.     update_field_states
  372.     remove_field_states_auto
  373.   end
  374.   
  375.   #--------------------------------------------------------------------------
  376.   # new method: update_field_states
  377.   #--------------------------------------------------------------------------
  378.   def self.update_field_states
  379.     for state_id in @field_states
  380.       next unless @field_state_turns[state_id] > 0
  381.       @field_state_turns[state_id] -= 1
  382.     end
  383.   end
  384.   
  385.   #--------------------------------------------------------------------------
  386.   # new method: remove_field_states_auto
  387.   #--------------------------------------------------------------------------
  388.   def self.remove_field_states_auto
  389.     for state_id in @field_states
  390.       next if $data_states[state_id].auto_removal_timing <= 0
  391.       remove_field_state(state_id) if @field_state_turns[state_id] <= 0
  392.     end
  393.   end
  394.   
  395.   #--------------------------------------------------------------------------
  396.   # new method: field_battlebacks
  397.   #--------------------------------------------------------------------------
  398.   def self.field_battlebacks
  399.     return @field_state_battleback
  400.   end
  401.   
  402.   #--------------------------------------------------------------------------
  403.   # new method: set_field_battlebacks
  404.   #--------------------------------------------------------------------------
  405.   def self.set_field_battlebacks
  406.     @field_state_battleback = ["", ""]
  407.     for state in field_states
  408.       next if state.field_battlebacks == ["", ""]
  409.       @field_state_battleback = state.field_battlebacks
  410.       return
  411.     end
  412.   end
  413.   
  414.   #--------------------------------------------------------------------------
  415.   # new method: field_state_icons
  416.   #--------------------------------------------------------------------------
  417.   def self.field_state_icons
  418.     return @field_state_icons
  419.   end
  420.   
  421.   #--------------------------------------------------------------------------
  422.   # new method: set_field_state_icons
  423.   #--------------------------------------------------------------------------
  424.   def self.set_field_state_icons
  425.     icons = field_states.collect {|state| state.icon_index }
  426.     icons.delete(0)
  427.     @field_state_icons = icons
  428.   end
  429.   
  430. end # BattleManager

  431. #==============================================================================
  432. # ■ Game_BattlerBase
  433. #==============================================================================

  434. class Game_BattlerBase
  435.   
  436.   #--------------------------------------------------------------------------
  437.   # public instance variables
  438.   #--------------------------------------------------------------------------
  439.   attr_accessor :anti_field_states
  440.   
  441.   #--------------------------------------------------------------------------
  442.   # alias method: states
  443.   #--------------------------------------------------------------------------
  444.   alias game_battlerbase_states_fse states
  445.   def states
  446.     result = game_battlerbase_states_fse
  447.     result |= field_states unless @anti_field_states
  448.     return result
  449.   end
  450.   
  451.   #--------------------------------------------------------------------------
  452.   # new method: field_states
  453.   #--------------------------------------------------------------------------
  454.   def field_states
  455.     return [] unless SceneManager.scene_is?(Scene_Battle)
  456.     return BattleManager.field_states
  457.   end
  458.   
  459.   #--------------------------------------------------------------------------
  460.   # alias method: state?
  461.   #--------------------------------------------------------------------------
  462.   alias game_battlerbase_state_fse state?
  463.   def state?(state_id)
  464.     return true if field_states.include?($data_states[state_id])
  465.     return game_battlerbase_state_fse(state_id)
  466.   end
  467.   
  468. end # Game_BattlerBase

  469. #==============================================================================
  470. # ■ Game_Battler
  471. #==============================================================================

  472. class Game_Battler < Game_BattlerBase
  473.   
  474.   #--------------------------------------------------------------------------
  475.   # alias method: item_apply
  476.   #--------------------------------------------------------------------------
  477.   alias game_battler_item_apply_fse item_apply
  478.   def item_apply(user, item)
  479.     game_battler_item_apply_fse(user, item)
  480.     apply_field_state_effect(item)
  481.   end
  482.   
  483.   #--------------------------------------------------------------------------
  484.   # new method: apply_field_state_effect
  485.   #--------------------------------------------------------------------------
  486.   def apply_field_state_effect(item)
  487.     return if item.nil?
  488.     return unless $game_party.in_battle
  489.     return unless SceneManager.scene_is?(Scene_Battle)
  490.     return @result.success = true if item.add_field_state != []
  491.     return @result.success = true if item.remove_field_state != []
  492.     return @result.success = true if item.remove_all_field_states
  493.     for key in item.change_field_state_turns
  494.       return @result.success = true if BattleManager.field_state?(key[0])
  495.     end
  496.   end
  497.   
  498.   #--------------------------------------------------------------------------
  499.   # alias method: on_restrict
  500.   #--------------------------------------------------------------------------
  501.   alias game_battler_on_restrict_fse on_restrict
  502.   def on_restrict
  503.     @anti_field_states = true
  504.     game_battler_on_restrict_fse
  505.     @anti_field_states = nil
  506.   end
  507.   
  508.   #--------------------------------------------------------------------------
  509.   # alias method: update_state_turns
  510.   #--------------------------------------------------------------------------
  511.   alias game_battler_update_state_turns_fse update_state_turns
  512.   def update_state_turns
  513.     @anti_field_states = true
  514.     game_battler_update_state_turns_fse
  515.     @anti_field_states = nil
  516.   end
  517.   
  518.   #--------------------------------------------------------------------------
  519.   # alias method: remove_battle_states
  520.   #--------------------------------------------------------------------------
  521.   alias game_battler_remove_battle_states_fse remove_battle_states
  522.   def remove_battle_states
  523.     @anti_field_states = true
  524.     game_battler_remove_battle_states_fse
  525.     @anti_field_states = nil
  526.   end
  527.   
  528.   #--------------------------------------------------------------------------
  529.   # alias method: remove_states_auto
  530.   #--------------------------------------------------------------------------
  531.   alias game_battler_remove_states_auto_fse remove_states_auto
  532.   def remove_states_auto(timing)
  533.     @anti_field_states = true
  534.     game_battler_remove_states_auto_fse(timing)
  535.     @anti_field_states = nil
  536.   end
  537.   
  538.   #--------------------------------------------------------------------------
  539.   # alias method: remove_states_by_damage
  540.   #--------------------------------------------------------------------------
  541.   alias game_battler_remove_states_by_damage_fse remove_states_by_damage
  542.   def remove_states_by_damage
  543.     @anti_field_states = true
  544.     game_battler_remove_states_by_damage_fse
  545.     @anti_field_states = nil
  546.   end
  547.   
  548. end # Game_Battler

  549. #==============================================================================
  550. # ■ Spriteset_Battle
  551. #==============================================================================

  552. class Spriteset_Battle
  553.   
  554.   #--------------------------------------------------------------------------
  555.   # alias method: create_viewports
  556.   #--------------------------------------------------------------------------
  557.   alias spriteset_battle_create_viewports_fse create_viewports
  558.   def create_viewports
  559.     spriteset_battle_create_viewports_fse
  560.     create_field_state_effect
  561.   end
  562.   
  563.   #--------------------------------------------------------------------------
  564.   # new method: create_field_state_effect
  565.   #--------------------------------------------------------------------------
  566.   def create_field_state_effect
  567.     @field_state_battleback = ["", ""]
  568.     @field_state_effect_sprite1 = Sprite.new(@viewport1)
  569.     @field_state_effect_sprite1.bitmap = Bitmap.new(640, 480)
  570.     @field_state_effect_sprite1.opacity = 0
  571.     @field_state_effect_sprite1.z = 3
  572.     @field_state_effect_sprite2 = Sprite.new(@viewport1)
  573.     @field_state_effect_sprite2.bitmap = Bitmap.new(640, 480)
  574.     @field_state_effect_sprite2.opacity = 0
  575.     @field_state_effect_sprite2.z = 4
  576.   end
  577.   
  578.   #--------------------------------------------------------------------------
  579.   # alias method: dispose
  580.   #--------------------------------------------------------------------------
  581.   alias spriteset_battle_dispose_fse dispose
  582.   def dispose
  583.     dispose_field_state_effect
  584.     spriteset_battle_dispose_fse
  585.   end
  586.   
  587.   #--------------------------------------------------------------------------
  588.   # new method: dispose_field_state_effect
  589.   #--------------------------------------------------------------------------
  590.   def dispose_field_state_effect
  591.     @field_state_effect_sprite1.bitmap.dispose
  592.     @field_state_effect_sprite1.dispose
  593.     @field_state_effect_sprite2.bitmap.dispose
  594.     @field_state_effect_sprite2.dispose
  595.   end
  596.   
  597.   #--------------------------------------------------------------------------
  598.   # alias method: update
  599.   #--------------------------------------------------------------------------
  600.   alias spriteset_battle_update_fse update
  601.   def update
  602.     update_field_state_effect
  603.     spriteset_battle_update_fse
  604.   end
  605.   
  606.   #--------------------------------------------------------------------------
  607.   # new method: update_field_state_effect
  608.   #--------------------------------------------------------------------------
  609.   def update_field_state_effect
  610.     update_field_battleback_images
  611.     update_field_battleback_opacity
  612.     #---
  613.     @field_state_effect_sprite1.update
  614.     @field_state_effect_sprite2.update
  615.   end
  616.   
  617.   #--------------------------------------------------------------------------
  618.   # new method: update_field_battleback_images
  619.   #--------------------------------------------------------------------------
  620.   def update_field_battleback_images
  621.     return if @field_state_battleback == BattleManager.field_battlebacks
  622.     @field_state_battleback = BattleManager.field_battlebacks.clone
  623.     change_field_battleback_images
  624.   end
  625.   
  626.   #--------------------------------------------------------------------------
  627.   # new method: change_field_battleback_images
  628.   #--------------------------------------------------------------------------
  629.   def change_field_battleback_images
  630.     #---
  631.     @field_state_effect_sprite1.bitmap.dispose
  632.     @field_state_effect_sprite1.bitmap =  @back1_sprite.bitmap.clone
  633.     @field_state_effect_sprite1.opacity = 255
  634.     @field_state_effect_sprite1.wave_amp = 0
  635.     center_sprite(@field_state_effect_sprite1)
  636.     #---
  637.     @field_state_effect_sprite2.bitmap.dispose
  638.     @field_state_effect_sprite2.bitmap = @back2_sprite.bitmap.clone
  639.     @field_state_effect_sprite2.opacity = 255
  640.     @field_state_effect_sprite2.wave_amp = 0
  641.     center_sprite(@field_state_effect_sprite2)
  642.     #---
  643.     if YEA::FIELD_STATES::WAVE_EFFECT
  644.       @field_state_effect_sprite1.wave_amp = 16
  645.       @field_state_effect_sprite2.wave_amp = 16
  646.     end
  647.     #---
  648.     @back1_sprite.bitmap.dispose
  649.     @back2_sprite.bitmap.dispose
  650.     if BattleManager.field_battlebacks == ["", ""]
  651.       bb1 = battleback1_bitmap
  652.       bb2 = battleback2_bitmap
  653.     else
  654.       bb1 = Cache.battleback1(BattleManager.field_battlebacks[0])
  655.       bb2 = Cache.battleback2(BattleManager.field_battlebacks[1])
  656.     end
  657.     @back1_sprite.bitmap = bb1
  658.     @back2_sprite.bitmap = bb2
  659.     center_sprite(@back1_sprite)
  660.     center_sprite(@back2_sprite)
  661.   end
  662.   
  663.   #--------------------------------------------------------------------------
  664.   # new method: update_field_battleback_opacity
  665.   #--------------------------------------------------------------------------
  666.   def update_field_battleback_opacity
  667.     return if @field_state_effect_sprite1.opacity <= 0
  668.     @field_state_effect_sprite1.opacity -= 1
  669.     @field_state_effect_sprite2.opacity -= 1
  670.   end
  671.   
  672. end # Spriteset_Battle

  673. #==============================================================================
  674. # ■ Scene_Battle
  675. #==============================================================================

  676. class Scene_Battle < Scene_Base
  677.   
  678.   #--------------------------------------------------------------------------
  679.   # alias method: use_item
  680.   #--------------------------------------------------------------------------
  681.   alias scene_battle_use_item_fse use_item
  682.   def use_item
  683.     item = @subject.current_action.item
  684.     scene_battle_use_item_fse
  685.     apply_field_state_effects(item)
  686.   end
  687.   
  688.   #--------------------------------------------------------------------------
  689.   # new method: apply_field_state_effects
  690.   #--------------------------------------------------------------------------
  691.   def apply_field_state_effects(item)
  692.     return if item.nil?
  693.     remove_all_field_state_effects(item)
  694.     remove_field_state_effects(item)
  695.     add_field_state_effects(item)
  696.     change_field_state_turns(item)
  697.     refresh_all_battlers
  698.   end
  699.   
  700.   #--------------------------------------------------------------------------
  701.   # new method: remove_all_field_state_effects
  702.   #--------------------------------------------------------------------------
  703.   def remove_all_field_state_effects(item)
  704.     return unless item.remove_all_field_states
  705.     BattleManager.clear_field_states
  706.   end
  707.   
  708.   #--------------------------------------------------------------------------
  709.   # new method: remove_field_state_effects
  710.   #--------------------------------------------------------------------------
  711.   def remove_field_state_effects(item)
  712.     return if BattleManager.field_states == []
  713.     return if item.remove_field_state == []
  714.     for state_id in item.remove_field_state
  715.       BattleManager.remove_field_state(state_id)
  716.     end
  717.   end
  718.   
  719.   #--------------------------------------------------------------------------
  720.   # new method: add_field_state_effects
  721.   #--------------------------------------------------------------------------
  722.   def add_field_state_effects(item)
  723.     return if item.add_field_state == []
  724.     for state_id in item.add_field_state
  725.       BattleManager.add_field_state(state_id)
  726.     end
  727.   end
  728.   
  729.   #--------------------------------------------------------------------------
  730.   # new method: change_field_state_turns
  731.   #--------------------------------------------------------------------------
  732.   def change_field_state_turns(item)
  733.     return if item.change_field_state_turns == {}
  734.     for key in item.change_field_state_turns
  735.       state_id = key[0]
  736.       next unless BattleManager.field_state?(state_id)
  737.       next unless $data_states[state_id].auto_removal_timing > 0
  738.       turns = BattleManager.field_state_turns(state_id)
  739.       BattleManager.change_field_state_turns(state_id, turns + key[1])
  740.     end
  741.   end
  742.   
  743.   #--------------------------------------------------------------------------
  744.   # new method: change_field_state_turns
  745.   #--------------------------------------------------------------------------
  746.   def refresh_all_battlers
  747.     all_battle_members.each { |battler| battler.refresh }
  748.     @status_window.refresh
  749.   end
  750.   
  751. end # Scene_Battle

  752. #==============================================================================
  753. #
  754. # ▼ End of File
  755. #
  756. #==============================================================================
复制代码


结尾脚本
  1. #==============================================================================
  2. # ■ VX-RGSS2-24 エンディング [Ver.1.0.0]        by Claimh
  3. #------------------------------------------------------------------------------
  4. #  エンディング(スタッフロール)の雛型です
  5. #  あくまで雛形なので、自分で納得がいくように改造してください。
  6. #   
  7. #  表示順:製作者等表示 → ~Fin~表示
  8. #           (→クリアデータをセーブ)→ タイトルor強制終了
  9. #
  10. #  画像パス:Graphics/Pictures
  11. #------------------------------------------------------------------------------
  12. #【呼び出し】
  13. #  SceneManager.goto(Scene_Ending)
  14. #==============================================================================

  15. #==============================================================================
  16. # □ カスタマイズ  ~START~
  17. #==============================================================================
  18. module Ending
  19.   # エンディング後はタイトルに戻す(false:強制終了)
  20.   BACKTO_TITLE = true

  21.   # クリアデータセーブを行う?
  22.   CLRED_SAVE = false
  23.   # クリアデータ上でONにするスイッチ
  24.   CLRED_SWITCH = 10

  25.   # ボタン押下時にエンディングスキップ
  26.   ON_SKIP = true

  27.   # 画像表示位置
  28.   #   0 : 画像いっぱい
  29.   #   1 : 特定位置へ表示
  30.   #   2 : 特定矩形へ表示
  31.   G_TYPE = 1
  32.   # 画像表示位置 [x, y] <G_TYPE=1>
  33.   G_POS = [0, 0]
  34.   # 画像表示矩形 <G_TYPE=2>
  35.   G_RECT = Rect.new(10, 100, 200, 200)

  36.   # シーン番号ごとの切り替え間隔(frame数)
  37.   SC_WAIT = 60 * 3

  38.   # シーン切り替え演出
  39.   #  0 : 演出なし
  40.   #  1 : トランジション(フェード)を挟む
  41.   SC_EFFECT = 1

  42.   # ~FIN~表示位置 [x, y]
  43.   FIN_POS = [Graphics.width - 600, Graphics.height - 420]
  44.   # ~FIN~時のウェイト(nil:ボタンが押されるまでウェイト)
  45.   FIN_WAIT = 60 * 5
  46. end

  47. #==============================================================================
  48. # ■ シーン制御設定
  49. #==============================================================================
  50. class Scene_Ending < Scene_Base
  51.   include Ending
  52.   #--------------------------------------------------------------------------
  53.   # ● エンドミュージック
  54.   #      n  : シーン番号
  55.   #--------------------------------------------------------------------------
  56.   def end_music(n=0)
  57.     case n
  58.     when 0  # 最初のBGM
  59.       return RPG::BGM.new("Theme3")
  60.     when -1 # Fin時のBGM
  61.       return RPG::BGM.new("Scene5", 80, 80)
  62.     end
  63.     return nil
  64.   end
  65.   #--------------------------------------------------------------------------
  66.   # ● エンド背景
  67.   #      n      : シーン番号  (-1:Fin画像)
  68.   #--------------------------------------------------------------------------
  69.   def end_graphic(n=0)
  70.     case n
  71.     when 0  # 最初の画像
  72.       return Cache.picture("Mountains5")
  73.     when -1 # Fin画像
  74.       return Cache.picture("Fin")
  75.     when -2 # Fin画像2
  76.       return Cache.picture("StarlitSky")
  77. #~     when 3  # (例) 途中で画像をチェンジ
  78. #~        return Cache.picture("Ocean1")
  79.     end
  80.     return nil
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ★ エンディングロール処理
  84.   #      n      : シーン番号
  85.   #--------------------------------------------------------------------------
  86.   TEXTS = [
  87.   # ["役割", "名前", "付属情報", …]
  88.     ["作者",           "光明魔法灵"],
  89.     ["特别合伙人",       "风"],
  90.     ["开场音楽",               "GILIGI EYE",],
  91.     ["游戏中音乐",         "默认的VA音乐"],
  92.     ["出场人物",         "\\n[11]", "\\n[12]", "\\n[13]", "\\n[14]", "\\n[15]", "\\n[16]", "\\n[17]", "\\n[18]", "\\n[19]", "\\n[20]", "\\n[21]"],
  93.     ["特别穿插", "火影人物类", "火影忍术创作", "火影人物穿插", "火影奥义"]
  94.   ]
  95.   def update_ending(n)
  96.     play_music(n)                   # BGM演奏
  97.     redraw_end_graphic(n)           # 画像描画
  98.     draw_text(10, 10, TEXTS[n])   # テキスト描画
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # ● Fin表示
  102.   #--------------------------------------------------------------------------
  103.   def finish
  104.     play_music(-1)
  105.     clear_graphic
  106. #~     draw_graphic(end_graphic_rect(-2, 0), -2) # 背景
  107.     draw_graphic(end_graphic_rect(-1, 1, FIN_POS[0], FIN_POS[1]), -1)
  108.   end
  109. end

  110. #==============================================================================
  111. # □ カスタマイズ  ~END~
  112. #==============================================================================


  113. #==============================================================================
  114. # ■ 汎用メソッド  ★部分で使用する
  115. #==============================================================================
  116. class Scene_Ending < Scene_Base
  117.   #--------------------------------------------------------------------------
  118.   # ● ミュージック演奏
  119.   #      n      : シーン番号
  120.   #--------------------------------------------------------------------------
  121.   def play_music(n=0)
  122.     music = end_music(n)
  123.     return if music.nil?
  124.     music.play
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # ● エンド背景の描画先矩形
  128.   #      n      : シーン番号
  129.   #--------------------------------------------------------------------------
  130.   def end_graphic_rect(n=0, type=G_TYPE, x=G_POS[0], y=G_POS[1])
  131.     case type
  132.     when 0  # 画面いっぱいに描画
  133.       return @viewport.rect
  134.     when 1  # アスペクト比を維持して特定位置に描画
  135.       return Rect.new(x, y, end_graphic(n).width, end_graphic(n).height)
  136.     when 2  # 特定矩形に収まるように描画
  137.       return G_RECT
  138.     end
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ● 画像描画
  142.   #      rect   : 描画先矩形
  143.   #      n      : シーン番号
  144.   #--------------------------------------------------------------------------
  145.   def draw_graphic(rect, n=0)
  146.     graphic = end_graphic(n)
  147.     src_rect = Rect.new
  148.     src_rect.width  = graphic.width
  149.     src_rect.height = graphic.height
  150.     @sprite.bitmap.stretch_blt(rect, graphic, src_rect)
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ● 画像領域消去
  154.   #      rect   : 消去矩形
  155.   #--------------------------------------------------------------------------
  156.   def clear_graphic(rect=@viewport.rect)
  157.     @sprite.bitmap.clear_rect(rect)
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   # ● シーン番号別  画像描画
  161.   #--------------------------------------------------------------------------
  162.   def draw_end_graphic(n=0, type=G_TYPE)
  163.     draw_graphic(end_graphic_rect(n, type), n)
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● シーン番号別  画像再描画
  167.   #--------------------------------------------------------------------------
  168.   def redraw_end_graphic(n=0, type=G_TYPE)
  169.     return if end_graphic(n).nil?
  170.     clear_graphic
  171.     draw_end_graphic(n, type)
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ● テキスト描画
  175.   #--------------------------------------------------------------------------
  176.   def draw_text(x, y, texts)
  177.     texts.size.times do |i|
  178.       xx = (i == 0) ? x : (x+30)
  179.       @window.draw_text_ex(xx, y, texts[i])
  180.       y += @window.line_height
  181.     end
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ● テキスト消去
  185.   #--------------------------------------------------------------------------
  186.   def clear_text
  187.     @window.contents.clear
  188.   end
  189. end


  190. #==============================================================================
  191. # ■ シーンクラス
  192. #==============================================================================
  193. class Scene_Ending < Scene_Base
  194.   #--------------------------------------------------------------------------
  195.   # ● オブジェクト初期化
  196.   #--------------------------------------------------------------------------
  197.   def initialize
  198.     super
  199.     @no = 0
  200.     @called_save = false
  201.   end
  202.   #--------------------------------------------------------------------------
  203.   # ● 開始処理
  204.   #--------------------------------------------------------------------------
  205.   def start
  206.     super
  207.     create_viewport
  208.     create_sprite
  209.     create_window
  210.     return goto_next_scene if @no >= TEXTS.size
  211.     update_ending(@no)
  212.   end
  213.   #--------------------------------------------------------------------------
  214.   # ● 画面Viewport生成
  215.   #--------------------------------------------------------------------------
  216.   def create_viewport
  217.     @viewport = Viewport.new
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ● 画像表示用スプライト生成
  221.   #--------------------------------------------------------------------------
  222.   def create_sprite
  223.     @sprite = Sprite_Base.new(@viewport)
  224.     @sprite.bitmap = Bitmap.new(@viewport.rect.width, @viewport.rect.height)
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # ● 文字描画用ウィンドウ生成
  228.   #--------------------------------------------------------------------------
  229.   def create_window
  230.     r = @viewport.rect
  231.     @window = Window_Base.new(r.x, r.y, r.width, r.width)
  232.     @window.opacity = 0
  233.   end
  234.   #--------------------------------------------------------------------------
  235.   # ● 終了処理
  236.   #--------------------------------------------------------------------------
  237.   def terminate
  238.     dispose_sprite
  239.     dispose_viewport
  240.     super
  241.   end
  242.   #--------------------------------------------------------------------------
  243.   # ● 画面Viewport解放
  244.   #--------------------------------------------------------------------------
  245.   def dispose_viewport
  246.     @viewport.dispose
  247.   end
  248.   #--------------------------------------------------------------------------
  249.   # ● 画像表示用スプライト解放
  250.   #--------------------------------------------------------------------------
  251.   def dispose_sprite
  252.     @sprite.dispose
  253.   end
  254.   #--------------------------------------------------------------------------
  255.   # ● 次のシーンへ
  256.   #--------------------------------------------------------------------------
  257.   def goto_next_scene
  258.     if CLRED_SAVE and !@called_save
  259.       call_save
  260.     elsif BACKTO_TITLE
  261.       SceneManager.goto(Scene_Title)
  262.     else
  263.       fadeout_all
  264.       SceneManager.exit
  265.     end
  266.   end
  267.   #--------------------------------------------------------------------------
  268.   # ● クリアデータをセーブ
  269.   #--------------------------------------------------------------------------
  270.   def call_save
  271.     $game_switches[CLRED_SWITCH] = true
  272.     @called_save = true
  273.     SceneManager.call(Scene_Save)
  274.   end
  275.   #--------------------------------------------------------------------------
  276.   # ● フレーム更新
  277.   #--------------------------------------------------------------------------
  278.   def update
  279.     super
  280.     update_ending_scene
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ● フレーム更新 <シーン切り替え制御>
  284.   #--------------------------------------------------------------------------
  285.   def update_ending_scene
  286.     return goto_next_scene if @no >= TEXTS.size
  287.     update_ending(@no)
  288.     perform_transition if SC_EFFECT == 1
  289.     wait
  290.     Graphics.freeze    if SC_EFFECT == 1
  291.     clear_text
  292.     @no += 1
  293.     if @no >= TEXTS.size
  294.       RPG::BGM.fade(transition_speed * 2) if
  295.       finish
  296.       Graphics.transition(transition_speed * 2) if SC_EFFECT == 1
  297.       finish_wait
  298.     end
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # ● トランジション速度の取得
  302.   #--------------------------------------------------------------------------
  303.   def transition_speed
  304.     return 30
  305.   end
  306.   #--------------------------------------------------------------------------
  307.   # ● トランジション速度の取得
  308.   #--------------------------------------------------------------------------
  309.   def skip_trigger?
  310.     Input.trigger?(:C) or Input.trigger?(:B)
  311.   end
  312.   #--------------------------------------------------------------------------
  313.   # ● フレーム更新
  314.   #--------------------------------------------------------------------------
  315.   def update_skipwait(skip=true)
  316.     update_basic
  317.     skip and skip_trigger?
  318.   end
  319.   #--------------------------------------------------------------------------
  320.   # ● ウェイト
  321.   #--------------------------------------------------------------------------
  322.   def wait(duration=SC_WAIT)
  323.     duration.times { |i| break if update_skipwait(ON_SKIP) }
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # ● Finishウェイト
  327.   #--------------------------------------------------------------------------
  328.   def finish_wait
  329.     if FIN_WAIT.nil?
  330.       loop do update_skipwait end
  331.     else
  332.       wait(FIN_WAIT)
  333.     end
  334.   end
  335. end
复制代码


比较好的天气系统
  1. #screen.change_weather(13,7,0)
  2. #-------------------------------------------------------------------------------
  3. #  MAWS - Modified Advanced Weather Script for RPG Maker VX
  4. #  Version: 1.1.
  5. #  Based on Advanced Weather Script VX by Ccoa
  6. #  Modifications created by Agckuu Coceg
  7. #-------------------------------------------------------------------------------
  8. # Thanks DerWulfman to his help with VX version of script.
  9. #-------------------------------------------------------------------------------
  10. #  Weather Types:
  11. #    1 - 雨 (Ccoa)
  12. #    2 - 风暴 (Ccoa)
  13. #    3 - 雪 (Ccoa)
  14. #    4 - 冰雹 (Ccoa)
  15. #    5 - 雷阵雨 (Ccoa)
  16. #    6 - 下降棕色叶子 (Ccoa)
  17. #    7 - 吹棕色叶子 (Ccoa)
  18. #    8 - 袅袅棕色叶子 (Ccoa)
  19. #    9 - 下降绿色叶子 (Ccoa)
  20. #   10 - 樱花(樱)花瓣 (Ccoa)
  21. #   11 - 玫瑰花瓣 (Ccoa)
  22. #   12 - 羽毛 (Ccoa)
  23. #   13 - 血雨 (Ccoa)
  24. #   14 - 火花 (Ccoa)
  25. #   15 - 用户自定义
  26. #   16 - 吹雪 (Ccoa)
  27. #   17 - 流星雨 (Ccoa)
  28. #   18 - 落灰 (Ccoa)
  29. #   19 - 气泡 (Ccoa)
  30. #   20 - 气泡 2 (Ccoa)
  31. #   21 - 火花上升 (Ccoa)
  32. #-------------------------------------------------------------------------------
  33. # Version 1.0 addons
  34. #-------------------------------------------------------------------------------
  35. #   Leaves effects:
  36. #   22 - 吹绿叶 (Agckuu Coceg)
  37. #   23 - 袅袅的绿叶 (Agckuu Coceg)
  38. #   24 - 下降的黄叶 (Agckuu Coceg)
  39. #   25 - 吹黄叶 (Agckuu Coceg)
  40. #   26 - 袅袅的黄叶 (Agckuu Coceg)
  41. #   Rain effects:
  42. #   27 - 石油雨 (Agckuu Coceg)
  43. #   28 - 金雨 (Agckuu Coceg)
  44. #   Special effects:
  45. #   29 - 火焰流星雨 (Agckuu Coceg)
  46. #-------------------------------------------------------------------------------
  47. # Version 1.1 addons
  48. #-------------------------------------------------------------------------------
  49. #   Starburst effects addons:
  50. #   30 - 彩色星暴 v.2 (replaced Color Starburst)(Agckuu Coceg)
  51. #   31 - 升级版彩色星暴 v.2 (replaced Uprising color Starburst)
  52. #   (Agckuu Coceg)
  53. #   32 - 彩色星暴雨 v.2 (replaced Color Starburst rain)(Agckuu Coceg)
  54. #   33 - 单色暴 (Agckuu Coceg)
  55. #   34 - 升级版单色暴 (Agckuu Coceg)
  56. #   35 - 单色暴雨 (Agckuu Coceg)
  57. #   Rain effects:
  58. #   36 - 金雨雷电和闪光 (Agckuu Coceg)
  59. #   37 - 金色风暴 (Agckuu Coceg)
  60. #   38 - 石油风暴 (Agckuu Coceg)
  61. #   39 - 酸雨 (Agckuu Coceg)
  62. #   40 - 酸雨闪电和闪光 (Agckuu Coceg)
  63. #   41 - 酸雨风暴 (Agckuu Coceg)
  64. #   42 - 棕褐色雨 (Agckuu Coceg)
  65. #   43 - 棕褐色雨闪电和闪光 (Agckuu Coceg)
  66. #   44 - 棕褐色雨风暴 (Agckuu Coceg)
  67. #   45 - 现实风暴 (Agckuu Coceg)
  68. #   46 - 血雨赤红的闪电和雷声 (Agckuu Coceg)
  69. #   47 - 血雨风暴 (Agckuu Coceg)
  70. #   48 - 血暴雪 (Agckuu Coceg)
  71. #   New leaves effects:
  72. #   49 - 下降红枫叶 (Agckuu Coceg)
  73. #   50 - 吹红枫叶 (Agckuu Coceg)
  74. #   51 - 袅袅的红枫叶 (Agckuu Coceg)
  75. #   Special effects:
  76. #   52 - 水弹 (Agckuu Coceg)
  77. #   53 - 冰弹 (Agckuu Coceg)
  78. #   54 - 照明弹 (Agckuu Coceg)
  79. #-------------------------------------------------------------------------------
  80. #  Weather Power:
  81. #    An integer from 0-40.  0 = no weather, 40 = 400 sprites
  82. #-------------------------------------------------------------------------------
  83. #  Usage:
  84. #  Create a call script with the following: screen.weather(type, power, hue)
  85. #-------------------------------------------------------------------------------
  86. #  Usage of user-defined weather. Look at the following globals:
  87. $WEATHER_UPDATE = false   # the $WEATHER_IMAGES array has changed, please update
  88. $WEATHER_IMAGES = []      # the array of picture names to use
  89. $WEATHER_X = 0           # the number of pixels the image should move horizontally (positive = right, negative = left)
  90. $WEATHER_Y = 0            # the number of pizels the image should move vertically (positive = down, negative = up)
  91. $WEATHER_FADE = 0         # how much the image should fade each update (0 = no fade, 255 = fade instantly)
  92. $WEATHER_ANIMATED = true # whether or not the image should cycle through all the images

  93. # Take these out if you are using screen resolution script of Ccoa.
  94.   HEIGHT = 416
  95.   WIDTH = 544

  96. #==============================================================================
  97. # ** Spriteset_Weather
  98. #------------------------------------------------------------------------------

  99. class Spriteset_Weather
  100.   #--------------------------------------------------------------------------
  101.   # * Public Instance Variables
  102.   #--------------------------------------------------------------------------
  103.   attr_reader :type
  104.   attr_reader :power
  105.   attr_reader :ox
  106.   attr_reader :oy
  107.   #--------------------------------------------------------------------------
  108.   # * Object Initialization
  109.   #--------------------------------------------------------------------------
  110.   def initialize(viewport = nil)
  111.     @type = 0
  112.     @power = 0
  113.     @ox = 0
  114.     @oy = 0
  115.    
  116.     @count = 0
  117.     @current_pose = []
  118.     @info = []
  119.     @countarray = []
  120.    
  121.     make_bitmaps
  122.    
  123.     @sprites = []
  124.    
  125.     for i in 1..500
  126.       sprite = Sprite.new(viewport)
  127.       sprite.visible = false
  128.       sprite.opacity = 0
  129.       @sprites.push(sprite)
  130.       @current_pose.push(0)
  131.       @info.push(rand(50))
  132.       @countarray.push(rand(15))
  133.     end
  134.    
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # * Dispose
  138.   #--------------------------------------------------------------------------
  139.   def dispose
  140.     for sprite in @sprites
  141.       sprite.dispose
  142.     end
  143.     @rain_bitmap.dispose
  144.     @storm_bitmap.dispose
  145.     @snow_bitmap.dispose
  146.     @hail_bitmap.dispose
  147.     @petal_bitmap.dispose
  148.     @blood_rain_bitmap.dispose
  149.     @oil_rain_bitmap.dispose
  150.     @golden_rain_bitmap.dispose
  151.     @golden_storm_bitmap.dispose
  152.     @acid_rain_bitmap.dispose
  153.     @acid_storm_bitmap.dispose
  154.     @sepia_rain_bitmap.dispose
  155.     @sepia_storm_bitmap.dispose
  156.     @blood_storm_bitmap.dispose
  157.     @bloodblizz_bitmap.dispose
  158.     @meteor_bitmap.dispose
  159.     @flame_meteor_bitmap.dispose
  160.     @waterbomb_bitmap.dispose
  161.     @icybomb_bitmap.dispose
  162.     @flarebomb_bitmap.dispose
  163.     for image in @autumn_leaf_bitmaps
  164.       image.dispose
  165.     end
  166.     for image in @green_leaf_bitmaps
  167.       image.dispose
  168.     end
  169.     for image in @yellow_leaf_bitmaps
  170.       image.dispose
  171.     end
  172.     for image in @redmaple_leaf_bitmaps
  173.       image.dispose
  174.     end
  175.     for image in @rose_bitmaps
  176.       image.dispose
  177.     end
  178.     for image in @feather_bitmaps
  179.       image.dispose
  180.     end
  181.     for image in @sparkle_bitmaps
  182.       image.dispose
  183.     end
  184.     for image in @starburst_bitmaps
  185.       image.dispose
  186.     end
  187.     for image in @monostarburst_bitmaps
  188.       image.dispose
  189.     end
  190.     for image in @user_bitmaps
  191.       image.dispose
  192.     end
  193.     $WEATHER_UPDATE = true
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # * Set weather type
  197.   #     type : new weather type
  198.   #--------------------------------------------------------------------------
  199.   def type=(type)
  200.     return if @type == type
  201.     @type = type
  202.     case @type
  203.     when 1 # rain
  204.       bitmap = @rain_bitmap
  205.     when 2 # storm
  206.       bitmap = @storm_bitmap
  207.     when 3 # snow
  208.       bitmap = @snow_bitmap
  209.    when 4 # hail
  210.       bitmap = @hail_bitmap
  211.     when 5 # rain w/ thunder and lightning
  212.       bitmap = @rain_bitmap
  213.       @thunder = true
  214.     when 6 # falling autumn leaves
  215.       bitmap = @autumn_leaf_bitmaps[0]
  216.     when 7 # blowing autumn leaves
  217.       bitmap = @autumn_leaf_bitmaps[0]
  218.     when 8 # swirling autumn leaves
  219.       bitmap = @autumn_leaf_bitmaps[0]
  220.     when 9 # falling green leaves
  221.       bitmap = @green_leaf_bitmaps[0]
  222.     when 10 # sakura petals
  223.       bitmap = @petal_bitmap
  224.     when 11 # rose petals
  225.       bitmap = @rose_bitmaps[0]
  226.     when 12 # feathers
  227.       bitmap = @feather_bitmaps[0]
  228.     when 13 # blood rain
  229.       bitmap = @blood_rain_bitmap
  230.     when 14 # sparkles
  231.       bitmap = @sparkle_bitmaps[0]
  232.     when 15 # user-defined
  233.         bitmap = @user_bitmaps[rand(@user_bitmaps.size)]
  234.     when 16 # blowing snow
  235.       bitmap = @snow_bitmap
  236.     when 17 # meteors
  237.       bitmap = @meteor_bitmap
  238.     when 18 # falling ash
  239.       bitmap = @ash_bitmaps[rand(@ash_bitmaps.size)]
  240.     when 19 # bubbles
  241.       bitmap = @bubble_bitmaps[rand(@bubble_bitmaps.size)]
  242.     when 21 # sparkles up
  243.       bitmap = @sparkle_bitmaps[0]
  244.     when 22 # blowing green leaves
  245.       bitmap = @green_leaf_bitmaps[0]
  246.     when 23 # swirling green leaves
  247.       bitmap = @green_leaf_bitmaps[0]
  248.     when 24 # falling yellow leaves
  249.       bitmap = @yellow_leaf_bitmaps[0]
  250.     when 25 # blowing yellow leaves
  251.       bitmap = @yellow_leaf_bitmaps[0]
  252.     when 26 # swirling yellow leaves
  253.       bitmap = @yellow_leaf_bitmaps[0]
  254.     when 27 # oil rain
  255.        bitmap = @oil_rain_bitmap
  256.     when 28 # golden rain
  257.        bitmap = @golden_rain_bitmap
  258.     when 29 # flame meteors
  259.        bitmap = @flame_meteor_bitmap
  260.     when 30 # starburst
  261.       bitmap = @starburst_bitmaps[0]
  262.     when 31 # uprising starburst
  263.       bitmap = @starburst_bitmaps[0]
  264.     when 32 # starburst rain
  265.       bitmap = @starburst_bitmaps[0]
  266.     when 33 # mono-starburst
  267.       bitmap = @monostarburst_bitmaps[0]
  268.     when 34 # uprising mono-starburst
  269.       bitmap = @monostarburst_bitmaps[0]
  270.     when 35 # mono-starburst rain
  271.       bitmap = @monostarburst_bitmaps[0]
  272.     when 36 # Golden rain w\ thunder and ligthning
  273.       bitmap = @golden_rain_bitmap
  274.       @golden_thunder = true
  275.     when 37 # Golden storm
  276.       bitmap = @golden_storm_bitmap
  277.     when 38 # Oil storm
  278.       bitmap = @oil_storm_bitmap
  279.     when 39 # # Acid rain
  280.       bitmap = @acid_rain_bitmap
  281.     when 40 # Acid rain w\thunder and lightning
  282.       bitmap = @acid_rain_bitmap
  283.       @acid_thunder = true
  284.     when 41 # Acid storm
  285.       bitmap = @acid_storm_bitmap
  286.     when 42 # Sepia rain
  287.       bitmap = @sepia_rain_bitmap
  288.     when 43 # Sepia rain w\ thunder and lightning
  289.       bitmap = @sepia_rain_bitmap
  290.       @sepia_thunder = true
  291.     when 44 # Sepia storm
  292.       bitmap = @sepia_storm_bitmap
  293.     when 45 # Realistic storm
  294.       bitmap = @storm_bitmap
  295.       @real_storm = true
  296.     when 46 # Blood rain w\ thunder and lightning
  297.       bitmap = @blood_rain_bitmap
  298.       @crimson_thunder = true
  299.     when 47 # Blood storm
  300.       bitmap = @blood_storm_bitmap
  301.     when 48 # Blood blizzard
  302.       bitmap = @bloodblizz_bitmap
  303.     when 49 # Falling red maple leaves
  304.       bitmap = @redmaple_leaf_bitmaps[0]
  305.     when 50 # Blowing red maple leaves
  306.       bitmap = @redmaple_leaf_bitmaps[0]
  307.     when 51 # Swirling red maple leaves
  308.       bitmap = @redmaple_leaf_bitmaps[0]
  309.     when 52
  310.       bitmap = @waterbomb_bitmaps
  311.     when 53
  312.       bitmap = @icybomb_bitmaps
  313.     when 54
  314.       bitmap = @flarebomb_bitmaps
  315.     else
  316.       bitmap = nil
  317.     end
  318.    
  319.     if @type != 5
  320.       @thunder = false
  321.     end
  322.    
  323.     if @type != 36
  324.       @golden_thunder = false
  325.     end
  326.    
  327.     if @type != 40
  328.       @acid_thunder = false
  329.     end
  330.    
  331.     if @type != 43
  332.       @sepia_thunder = false
  333.     end
  334.    
  335.     if @type != 45
  336.       @real_storm = false
  337.     end
  338.    
  339.     if @type != 46
  340.       @crimson_thunder = false
  341.     end
  342.    
  343.     for i in [email]0...@sprites.size[/email]
  344.       sprite = @sprites[i]
  345.       sprite.visible = (i <= @power)
  346.       if @type == 19
  347.         sprite.bitmap = @bubble_bitmaps[rand(@bubble_bitmaps.size)]
  348.       elsif @type == 20
  349.         sprite.bitmap = @bubble2_bitmaps[rand(@bubble2_bitmaps.size)]
  350.       elsif @type == 3
  351.         r = rand(@snow_bitmaps.size)
  352.         @info[i] = r
  353.         sprite.bitmap = @snow_bitmaps[r]
  354.       else
  355.         sprite.bitmap = bitmap
  356.       end
  357.     end
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # * Set starting point X coordinate
  361.   #     ox : starting point X coordinate
  362.   #--------------------------------------------------------------------------
  363.   def ox=(ox)
  364.     return if @ox == ox;
  365.     @ox = ox
  366.     for sprite in @sprites
  367.       sprite.ox = @ox
  368.     end
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # * Set starting point Y coordinate
  372.   #     oy : starting point Y coordinate
  373.   #--------------------------------------------------------------------------
  374.   def oy=(oy)
  375.     return if @oy == oy;
  376.     @oy = oy
  377.     for sprite in @sprites
  378.       sprite.oy = @oy
  379.     end
  380.   end
  381.   #--------------------------------------------------------------------------
  382.   # * Set maximum number of sprites
  383.   #     max : maximum number of sprites
  384.   #--------------------------------------------------------------------------
  385.   def power=(power)
  386.     @power = power
  387.     for i in 1..40
  388.       sprite = @sprites[i]
  389.       sprite.visible = (i <= @power) if sprite != nil
  390.       if @type == 19
  391.           sprite.bitmap = @bubble_bitmaps[rand(@bubble_bitmaps.size)]
  392.         elsif @type == 20
  393.           sprite.bitmap = @bubble2_bitmaps[rand(@bubble2_bitmaps.size)]
  394.         elsif @type == 3
  395.           r = rand(@snow_bitmaps.size)
  396.           @info[i] = r
  397.           sprite.bitmap = @snow_bitmaps[r]
  398.         end
  399.     end
  400.   end
  401. #--------------------------------------------------------------------------
  402. # * Frame Update
  403. #--------------------------------------------------------------------------
  404.   def update
  405.     return if @type == 0
  406.     for i in 1..@power
  407.       sprite = @sprites[i]
  408.       if @type == 1 or @type == 5 or @type == 13 or @type == 27 or @type == 28 or @type == 36 or @type == 39 or @type == 40 or @type == 42 or @type == 43 or @type == 46 #rain
  409.         if sprite.opacity <= 150
  410.           if @current_pose[i] == 0
  411.             sprite.y += @rain_bitmap.height
  412.             sprite.x -= @rain_bitmap.width
  413.             if @type == 1 or @type == 5
  414.               sprite.bitmap = @rain_splash
  415.             else
  416.               sprite.bitmap = @blood_rain_splash
  417.             end
  418.             if @type == 27
  419.               sprite.bitmap = @oil_rain_splash
  420.             end
  421.             if @type == 28
  422.               sprite.bitmap = @golden_rain_splash
  423.             end
  424.             if @type == 36
  425.               sprite.bitmap = @golden_rain_splash
  426.             end
  427.             if @type == 39
  428.               sprite.bitmap = @acid_rain_splash
  429.             end
  430.             if @type == 40
  431.               sprite.bitmap = @acid_rain_splash
  432.             end
  433.             if @type == 42
  434.               sprite.bitmap = @sepia_rain_splash
  435.             end
  436.             if @type == 43
  437.               sprite.bitmap = @sepia_rain_splash
  438.             end
  439.             if @type == 46
  440.               sprite.bitmap = @blood_rain_splash
  441.             end
  442.             @current_pose[i] = 1
  443.           end
  444.         else
  445.           if @current_pose[i] == 1
  446.             if @type == 1 or @type == 5
  447.               sprite.bitmap = @rain_bitmap
  448.             else
  449.               sprite.bitmap = @blood_rain_bitmap
  450.             end
  451.             if @type == 27
  452.               sprite.bitmap = @oil_rain_bitmap
  453.             end
  454.             if @type == 28
  455.               sprite.bitmap = @golden_rain_bitmap
  456.             end
  457.             if @type == 36
  458.               sprite.bitmap = @golden_rain_bitmap
  459.             end
  460.             if @type == 39
  461.               sprite.bitmap = @acid_rain_bitmap
  462.             end
  463.             if @type == 40
  464.               sprite.bitmap = @acid_rain_bitmap
  465.             end
  466.             if @type == 42
  467.               sprite.bitmap = @sepia_rain_bitmap
  468.             end
  469.             if @type == 43
  470.               sprite.bitmap = @sepia_rain_bitmap
  471.             end
  472.             if @type == 46
  473.               sprite.bitmap = @blood_rain_bitmap
  474.             end
  475.             @current_pose[i] = 0
  476.           end
  477.           sprite.x -= 2
  478.           sprite.y += 16
  479.           if @thunder and (rand(8000 - @power) == 0)
  480.             $game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
  481.             Audio.se_play("Audio/SE/Thunder1")
  482.           end
  483.         if @golden_thunder and (rand(8000 - @power) == 0)
  484.             $game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
  485.             Audio.se_play("Audio/SE/Thunder1")
  486.           end
  487.        if @acid_thunder and (rand(5000 - @power) == 0)
  488.             $game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
  489.             Audio.se_play("Audio/SE/Thunder1")
  490.           end
  491.        if @sepia_thunder and (rand(8000 - @power) == 0)
  492.             $game_map.screen.start_flash(Color.new(169, 152, 142, 255), 5)
  493.             Audio.se_play("Audio/SE/Thunder1")
  494.           end
  495.        if @sepia_thunder and (rand(8000 - @power) == 0)
  496.             $game_map.screen.start_flash(Color.new(169, 152, 142, 255), 5)
  497.             Audio.se_play("Audio/SE/Thunder1")
  498.           end
  499.        if @crimson_thunder and (rand(8000 - @power) == 0)
  500.           $game_map.screen.start_flash(Color.new(141, 9, 9, 255), 5)
  501.           Audio.se_play("Audio/SE/Thunder1")
  502.           end
  503.         end
  504.         sprite.opacity -= 8
  505.       end
  506.       if @type == 2 or @type == 37 or @type == 38 or @type == 41 or @type == 44 or @type == 45 or @type == 47 # storm
  507.         sprite.x -= 8
  508.         sprite.y += 16
  509.         sprite.opacity -= 12
  510.       end
  511.         if @real_storm and (rand(5000 - @power) == 0)
  512.         $game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
  513.         $game_map.screen.start_shake(9, 4, 5)
  514.         Audio.se_play("Audio/SE/Thunder9")
  515.       end
  516.       if @type == 3 # snow
  517.         case @info[i]
  518.         when 0 # smallest flake, fall the slowest
  519.           sprite.y += 1
  520.         when 1
  521.           sprite.y += 3
  522.         when 2
  523.           sprite.y += 5
  524.         when 3
  525.           sprite.y += 7
  526.         end
  527.         sprite.opacity -= 3
  528.       end
  529.       if @type == 4 # hail
  530.         sprite.x -= 1
  531.         sprite.y += 18
  532.         sprite.opacity -= 15
  533.       end
  534.       if @type == 6 # falling autumn leaves
  535.         @count = rand(20)
  536.         if @count == 0
  537.           sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]]
  538.           @current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size
  539.         end
  540.         sprite.x -= 1
  541.         sprite.y += 1
  542.       end
  543.       if @type == 7 # blowing autumn leaves
  544.         @count = rand(20)
  545.         if @count == 0
  546.           sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]]
  547.           @current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size
  548.         end
  549.         sprite.x -= 10
  550.         sprite.y += (rand(4) - 2)
  551.       end
  552.       if @type == 8 # swirling autumn leaves
  553.         @count = rand(20)
  554.         if @count == 0
  555.           sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]]
  556.           @current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size
  557.         end
  558.         if @info[i] != 0
  559.           if @info[i] >= 1 and @info[i] <= 10
  560.             sprite.x -= 3
  561.             sprite.y -= 1
  562.           elsif @info[i] >= 11 and @info[i] <= 16
  563.             sprite.x -= 1
  564.             sprite.y -= 2
  565.           elsif @info[i] >= 17 and @info[i] <= 20
  566.             sprite.y -= 3
  567.           elsif @info[i] >= 21 and @info[i] <= 30
  568.             sprite.y -= 2
  569.             sprite.x += 1
  570.           elsif @info[i] >= 31 and @info[i] <= 36
  571.             sprite.y -= 1
  572.             sprite.x += 3
  573.           elsif @info[i] >= 37 and @info[i] <= 40
  574.             sprite.x += 5
  575.           elsif @info[i] >= 41 and @info[i] <= 46
  576.             sprite.y += 1
  577.             sprite.x += 3
  578.           elsif @info[i] >= 47 and @info[i] <= 58
  579.             sprite.y += 2
  580.             sprite.x += 1
  581.           elsif @info[i] >= 59 and @info[i] <= 64
  582.             sprite.y += 3
  583.           elsif @info[i] >= 65 and @info[i] <= 70
  584.             sprite.x -= 1
  585.             sprite.y += 2
  586.           elsif @info[i] >= 71 and @info[i] <= 81
  587.             sprite.x -= 3
  588.             sprite.y += 1
  589.           elsif @info[i] >= 82 and @info[i] <= 87
  590.             sprite.x -= 5
  591.           end
  592.           @info[i] = (@info[i] + 1) % 88
  593.         else
  594.           if rand(200) == 0
  595.             @info[i] = 1
  596.           end
  597.           sprite.x -= 5
  598.           sprite.y += 1
  599.         end
  600.       end
  601.         if @type == 49 # falling red maple leaves
  602.         @count = rand(20)
  603.         if @count == 0
  604.           sprite.bitmap = @redmaple_leaf_bitmaps[@current_pose[i]]
  605.           @current_pose[i] = (@current_pose[i] + 1) % @redmaple_leaf_bitmaps.size
  606.         end
  607.         sprite.x -= 1
  608.         sprite.y += 1
  609.       end
  610.       if @type == 50 # blowing red maple leaves
  611.         @count = rand(20)
  612.         if @count == 0
  613.           sprite.bitmap = @redmaple_leaf_bitmaps[@current_pose[i]]
  614.           @current_pose[i] = (@current_pose[i] + 1) % @redmaple_leaf_bitmaps.size
  615.         end
  616.         sprite.x -= 10
  617.         sprite.y += (rand(4) - 2)
  618.       end
  619.       if @type == 51 # swirling red maple leaves
  620.         @count = rand(20)
  621.         if @count == 0
  622.           sprite.bitmap = @redmaple_leaf_bitmaps[@current_pose[i]]
  623.           @current_pose[i] = (@current_pose[i] + 1) % @redmaple_leaf_bitmaps.size
  624.         end
  625.         if @info[i] != 0
  626.           if @info[i] >= 1 and @info[i] <= 10
  627.             sprite.x -= 3
  628.             sprite.y -= 1
  629.           elsif @info[i] >= 11 and @info[i] <= 16
  630.             sprite.x -= 1
  631.             sprite.y -= 2
  632.           elsif @info[i] >= 17 and @info[i] <= 20
  633.             sprite.y -= 3
  634.           elsif @info[i] >= 21 and @info[i] <= 30
  635.             sprite.y -= 2
  636.             sprite.x += 1
  637.           elsif @info[i] >= 31 and @info[i] <= 36
  638.             sprite.y -= 1
  639.             sprite.x += 3
  640.           elsif @info[i] >= 37 and @info[i] <= 40
  641.             sprite.x += 5
  642.           elsif @info[i] >= 41 and @info[i] <= 46
  643.             sprite.y += 1
  644.             sprite.x += 3
  645.           elsif @info[i] >= 47 and @info[i] <= 58
  646.             sprite.y += 2
  647.             sprite.x += 1
  648.           elsif @info[i] >= 59 and @info[i] <= 64
  649.             sprite.y += 3
  650.           elsif @info[i] >= 65 and @info[i] <= 70
  651.             sprite.x -= 1
  652.             sprite.y += 2
  653.           elsif @info[i] >= 71 and @info[i] <= 81
  654.             sprite.x -= 3
  655.             sprite.y += 1
  656.           elsif @info[i] >= 82 and @info[i] <= 87
  657.             sprite.x -= 5
  658.           end
  659.           @info[i] = (@info[i] + 1) % 88
  660.         else
  661.           if rand(200) == 0
  662.             @info[i] = 1
  663.           end
  664.           sprite.x -= 5
  665.           sprite.y += 1
  666.         end
  667.       end
  668.       if @type == 9 # falling green leaves
  669.         if @countarray[i] == 0
  670.           @current_pose[i] = (@current_pose[i] + 1) % @green_leaf_bitmaps.size
  671.           sprite.bitmap = @green_leaf_bitmaps[@current_pose[i]]
  672.           @countarray[i] = rand(15)
  673.         end
  674.         @countarray[i] = (@countarray[i] + 1) % 15
  675.         sprite.y += 1
  676.       end
  677.       if @type == 10 # sakura petals
  678.         if @info[i] < 25
  679.           sprite.x -= 1
  680.         else
  681.           sprite.x += 1
  682.         end
  683.         @info[i] = (@info[i] + 1) % 50
  684.         sprite.y += 1
  685.       end
  686.       if @type == 11 # rose petals
  687.         @count = rand(20)
  688.         if @count == 0
  689.           sprite.bitmap = @rose_bitmaps[@current_pose[i]]
  690.           @current_pose[i] = (@current_pose[i] + 1) % @rose_bitmaps.size
  691.         end
  692.         if @info[i] % 2 == 0
  693.           if @info[i] < 10
  694.             sprite.x -= 1
  695.           elsif
  696.             sprite.x += 1
  697.           end
  698.         end
  699.         sprite.y += 1
  700.       end
  701.       if @type == 12 # feathers
  702.         if @countarray[i] == 0
  703.           @current_pose[i] = (@current_pose[i] + 1) % @feather_bitmaps.size
  704.           sprite.bitmap = @feather_bitmaps[@current_pose[i]]
  705.         end
  706.         @countarray[i] = (@countarray[i] + 1) % 15
  707.         if rand(100) == 0
  708.           sprite.x -= 1
  709.         end
  710.         if rand(100) == 0
  711.           sprite.y -= 1
  712.         end
  713.         if @info[i] < 50
  714.           if rand(2) == 0
  715.             sprite.x -= 1
  716.           else
  717.             sprite.y -= 1
  718.           end
  719.         else
  720.           if rand(2) == 0
  721.             sprite.x += 1
  722.           else
  723.             sprite.y += 1
  724.           end
  725.         end
  726.         @info[i] = (@info[i] + 1) % 100
  727.       end
  728.       
  729.        if @type == 30 # starburst
  730.         if @countarray[i] == 0
  731.           @current_pose[i] = (@current_pose[i] + 1) % @starburst_bitmaps.size
  732.           sprite.bitmap = @starburst_bitmaps[@current_pose[i]]
  733.         end
  734.         @countarray[i] = (@countarray[i] + 1) % 15
  735.         sprite.y += 1
  736.         sprite.opacity -= 1
  737.       end
  738.       if @type == 31 # starburst up
  739.         if @countarray[i] == 0
  740.           @current_pose[i] = (@current_pose[i] + 1) % @starburst_bitmaps.size
  741.           sprite.bitmap = @starburst_bitmaps[@current_pose[i]]
  742.         end
  743.         @countarray[i] = (@countarray[i] + 1) % 15
  744.         sprite.y -= 1
  745.         sprite.opacity -= 1
  746.       end
  747.       if @type == 32 # starburst up
  748.         if @countarray[i] == 0
  749.           @current_pose[i] = (@current_pose[i] + 1) % @starburst_bitmaps.size
  750.           sprite.bitmap = @starburst_bitmaps[@current_pose[i]]
  751.         end
  752.         @countarray[i] = (@countarray[i] + 1) % 15
  753.         sprite.x -= 2
  754.         sprite.y += 8
  755.         sprite.opacity -= 1
  756.       end     
  757.       
  758.       if @type == 33 # mono-starburst
  759.         if @countarray[i] == 0
  760.           @current_pose[i] = (@current_pose[i] + 1) % @monostarburst_bitmaps.size
  761.           sprite.bitmap = @monostarburst_bitmaps[@current_pose[i]]
  762.         end
  763.         @countarray[i] = (@countarray[i] + 1) % 15
  764.         sprite.y += 1
  765.         sprite.opacity -= 1
  766.       end
  767.       if @type == 34 # mono-starburst up
  768.         if @countarray[i] == 0
  769.           @current_pose[i] = (@current_pose[i] + 1) % @monostarburst_bitmaps.size
  770.           sprite.bitmap = @monostarburst_bitmaps[@current_pose[i]]
  771.         end
  772.         @countarray[i] = (@countarray[i] + 1) % 15
  773.         sprite.y -= 1
  774.         sprite.opacity -= 1
  775.       end
  776.       if @type == 35 # mono-starburst rain
  777.         if @countarray[i] == 0
  778.           @current_pose[i] = (@current_pose[i] + 1) % @monostarburst_bitmaps.size
  779.           sprite.bitmap = @monostarburst_bitmaps[@current_pose[i]]
  780.         end
  781.         @countarray[i] = (@countarray[i] + 1) % 15
  782.         sprite.x -= 2
  783.         sprite.y += 8
  784.         sprite.opacity -= 1
  785.       end           
  786.         if @type == 29 # meteors
  787.         if @countarray[i] > 0
  788.           if rand(20) == 0
  789.             sprite.bitmap = @flame_impact_bitmap
  790.             @countarray[i] = -5
  791.           else
  792.             sprite.x -= 6
  793.             sprite.y += 10
  794.           end
  795.         else
  796.           @countarray[i] += 1
  797.           if @countarray[i] == 0
  798.             sprite.bitmap = @flame_meteor_bitmap
  799.             sprite.opacity = 0
  800.             @count_array = 1
  801.           end
  802.         end
  803.       end
  804.       if @type == 18 # ash
  805.         sprite.y += 2
  806.         case @countarray[i] % 3
  807.         when 0
  808.           sprite.x -= 1
  809.         when 1
  810.           sprite.x += 1
  811.         end
  812.       end      
  813.       
  814.       if @type == 14 # sparkles
  815.         if @countarray[i] == 0
  816.           @current_pose[i] = (@current_pose[i] + 1) % @sparkle_bitmaps.size
  817.           sprite.bitmap = @sparkle_bitmaps[@current_pose[i]]
  818.         end
  819.         @countarray[i] = (@countarray[i] + 1) % 15
  820.         sprite.y += 1
  821.         sprite.opacity -= 1
  822.       end
  823.       if @type == 15 # user-defined
  824.         if $WEATHER_UPDATE
  825.           update_user_defined
  826.           $WEATHER_UPDATE = false
  827.         end
  828.         if $WEATHER_ANIMATED and @countarray[i] == 0
  829.           @current_pose[i] = (@current_pose[i] + 1) % @user_bitmaps.size
  830.           sprite.bitmap = @user_bitmaps[@current_pose[i]]
  831.         end
  832.         sprite.x += $WEATHER_X
  833.         sprite.y += $WEATHER_Y
  834.         sprite.opacity -= $WEATHER_FADE
  835.       end
  836.       if @type == 16 # blowing snow
  837.         sprite.x -= 10
  838.         sprite.y += 6
  839.         sprite.opacity -= 4
  840.       end
  841.       if @type == 48 # blood blizzard
  842.         sprite.x -= 10
  843.         sprite.y += 6
  844.         sprite.opacity -= 4
  845.       end
  846.       if @type == 52 # water bombs
  847.         if @countarray[i] > 0
  848.           if rand(20) == 0
  849.             sprite.bitmap = @waterbomb_impact_bitmap
  850.             @countarray[i] = -5
  851.           else
  852.             sprite.x -= 3
  853.             sprite.y += 5
  854.           end
  855.         else
  856.           @countarray[i] += 1
  857.           if @countarray[i] == 0
  858.             sprite.bitmap = @waterbomb_bitmap
  859.             sprite.opacity = 0
  860.             @count_array = 1
  861.           end
  862.         end
  863.       end
  864.         if @type == 53 # icy bombs
  865.         if @countarray[i] > 0
  866.           if rand(20) == 0
  867.             sprite.bitmap = @icybomb_impact_bitmap
  868.             @countarray[i] = -5
  869.           else
  870.             sprite.x -= 3
  871.             sprite.y += 5
  872.           end
  873.         else
  874.           @countarray[i] += 1
  875.           if @countarray[i] == 0
  876.             sprite.bitmap = @icybomb_bitmap
  877.             sprite.opacity = 0
  878.             @count_array = 1
  879.           end
  880.         end
  881.       end
  882.       if @type == 54 # flare bombs
  883.         if @countarray[i] > 0
  884.           if rand(20) == 0
  885.             sprite.bitmap = @flarebomb_impact_bitmap
  886.             @countarray[i] = -5
  887.           else
  888.             sprite.x -= 3
  889.             sprite.y += 5
  890.           end
  891.         else
  892.           @countarray[i] += 1
  893.           if @countarray[i] == 0
  894.             sprite.bitmap = @flarebomb_bitmap
  895.             sprite.opacity = 0
  896.             @count_array = 1
  897.           end
  898.         end
  899.       end
  900.       if @type == 17 # meteors
  901.         if @countarray[i] > 0
  902.           if rand(20) == 0
  903.             sprite.bitmap = @impact_bitmap
  904.             @countarray[i] = -5
  905.           else
  906.             sprite.x -= 6
  907.             sprite.y += 10
  908.           end
  909.         else
  910.           @countarray[i] += 1
  911.           if @countarray[i] == 0
  912.             sprite.bitmap = @meteor_bitmap
  913.             sprite.opacity = 0
  914.             @count_array = 1
  915.           end
  916.         end
  917.       end
  918.       if @type == 18 # ash
  919.         sprite.y += 2
  920.         case @countarray[i] % 3
  921.         when 0
  922.           sprite.x -= 1
  923.         when 1
  924.           sprite.x += 1
  925.         end
  926.       end
  927.       if @type == 19 or @type == 20 # bubbles
  928.         switch = rand(75) + rand(75) + 1
  929.         if @info[i] < switch / 2
  930.           sprite.x -= 1
  931.         else
  932.           sprite.x += 1
  933.         end
  934.         @info[i] = (@info[i] + 1) % switch
  935.         sprite.y -= 1
  936.         if switch % 2 == 0
  937.           sprite.opacity -= 1
  938.         end
  939.       end
  940.       if @type == 21 # sparkles up
  941.         if @countarray[i] == 0
  942.           @current_pose[i] = (@current_pose[i] + 1) % @sparkle_bitmaps.size
  943.           sprite.bitmap = @sparkle_bitmaps[@current_pose[i]]
  944.         end
  945.         @countarray[i] = (@countarray[i] + 1) % 15
  946.         sprite.y -= 1
  947.         sprite.opacity -= 1
  948.       end
  949.          if @type == 24 # falling yellow leaves
  950.         @count = rand(20)
  951.         if @count == 0
  952.           sprite.bitmap = @yellow_leaf_bitmaps[@current_pose[i]]
  953.           @current_pose[i] = (@current_pose[i] + 1) % @yellow_leaf_bitmaps.size
  954.         end
  955.         sprite.x -= 1
  956.         sprite.y += 1
  957.       end
  958.        if @type == 22 # blowing green leaves
  959.         @count = rand(20)
  960.         if @count == 0
  961.           sprite.bitmap = @green_leaf_bitmaps[@current_pose[i]]
  962.           @current_pose[i] = (@current_pose[i] + 1) % @green_leaf_bitmaps.size
  963.         end
  964.         sprite.x -= 10
  965.         sprite.y += (rand(4) - 2)
  966.       end      
  967.       if @type == 23 # swirling green leaves
  968.         @count = rand(20)
  969.         if @count == 0
  970.           sprite.bitmap = @green_leaf_bitmaps[@current_pose[i]]
  971.           @current_pose[i] = (@current_pose[i] + 1) % @green_leaf_bitmaps.size
  972.         end
  973.         if @info[i] != 0
  974.           if @info[i] >= 1 and @info[i] <= 10
  975.             sprite.x -= 3
  976.             sprite.y -= 1
  977.           elsif @info[i] >= 11 and @info[i] <= 16
  978.             sprite.x -= 1
  979.             sprite.y -= 2
  980.           elsif @info[i] >= 17 and @info[i] <= 20
  981.             sprite.y -= 3
  982.           elsif @info[i] >= 21 and @info[i] <= 30
  983.             sprite.y -= 2
  984.             sprite.x += 1
  985.           elsif @info[i] >= 31 and @info[i] <= 36
  986.             sprite.y -= 1
  987.             sprite.x += 3
  988.           elsif @info[i] >= 37 and @info[i] <= 40
  989.             sprite.x += 5
  990.           elsif @info[i] >= 41 and @info[i] <= 46
  991.             sprite.y += 1
  992.             sprite.x += 3
  993.           elsif @info[i] >= 47 and @info[i] <= 58
  994.             sprite.y += 2
  995.             sprite.x += 1
  996.           elsif @info[i] >= 59 and @info[i] <= 64
  997.             sprite.y += 3
  998.           elsif @info[i] >= 65 and @info[i] <= 70
  999.             sprite.x -= 1
  1000.             sprite.y += 2
  1001.           elsif @info[i] >= 71 and @info[i] <= 81
  1002.             sprite.x -= 3
  1003.             sprite.y += 1
  1004.           elsif @info[i] >= 82 and @info[i] <= 87
  1005.             sprite.x -= 5
  1006.           end
  1007.           @info[i] = (@info[i] + 1) % 88
  1008.         else
  1009.           if rand(200) == 0
  1010.             @info[i] = 1
  1011.           end
  1012.           sprite.x -= 5
  1013.           sprite.y += 1
  1014.         end
  1015.       end
  1016.         if @type == 24 # falling yellow leaves
  1017.         @count = rand(20)
  1018.         if @count == 0
  1019.           sprite.bitmap = @yellow_leaf_bitmaps[@current_pose[i]]
  1020.           @current_pose[i] = (@current_pose[i] + 1) % @yellow_leaf_bitmaps.size
  1021.         end
  1022.         sprite.x -= 1
  1023.         sprite.y += 1
  1024.       end      
  1025.      if @type == 25 # blowing yellow leaves
  1026.         @count = rand(20)
  1027.         if @count == 0
  1028.           sprite.bitmap = @yellow_leaf_bitmaps[@current_pose[i]]
  1029.           @current_pose[i] = (@current_pose[i] + 1) % @yellow_leaf_bitmaps.size
  1030.         end
  1031.         sprite.x -= 10
  1032.         sprite.y += (rand(4) - 2)
  1033.       end
  1034.        if @type == 26 # swirling yellow leaves
  1035.         @count = rand(20)
  1036.         if @count == 0
  1037.           sprite.bitmap = @yellow_leaf_bitmaps[@current_pose[i]]
  1038.           @current_pose[i] = (@current_pose[i] + 1) % @yellow_leaf_bitmaps.size
  1039.         end
  1040.         if @info[i] != 0
  1041.           if @info[i] >= 1 and @info[i] <= 10
  1042.             sprite.x -= 3
  1043.             sprite.y -= 1
  1044.           elsif @info[i] >= 11 and @info[i] <= 16
  1045.             sprite.x -= 1
  1046.             sprite.y -= 2
  1047.           elsif @info[i] >= 17 and @info[i] <= 20
  1048.             sprite.y -= 3
  1049.           elsif @info[i] >= 21 and @info[i] <= 30
  1050.             sprite.y -= 2
  1051.             sprite.x += 1
  1052.           elsif @info[i] >= 31 and @info[i] <= 36
  1053.             sprite.y -= 1
  1054.             sprite.x += 3
  1055.           elsif @info[i] >= 37 and @info[i] <= 40
  1056.             sprite.x += 5
  1057.           elsif @info[i] >= 41 and @info[i] <= 46
  1058.             sprite.y += 1
  1059.             sprite.x += 3
  1060.           elsif @info[i] >= 47 and @info[i] <= 58
  1061.             sprite.y += 2
  1062.             sprite.x += 1
  1063.           elsif @info[i] >= 59 and @info[i] <= 64
  1064.             sprite.y += 3
  1065.           elsif @info[i] >= 65 and @info[i] <= 70
  1066.             sprite.x -= 1
  1067.             sprite.y += 2
  1068.           elsif @info[i] >= 71 and @info[i] <= 81
  1069.             sprite.x -= 3
  1070.             sprite.y += 1
  1071.           elsif @info[i] >= 82 and @info[i] <= 87
  1072.             sprite.x -= 5
  1073.           end
  1074.           @info[i] = (@info[i] + 1) % 88
  1075.         else
  1076.           if rand(200) == 0
  1077.             @info[i] = 1
  1078.           end
  1079.           sprite.x -= 5
  1080.           sprite.y += 1
  1081.         end
  1082.       end
  1083.       
  1084.       x = sprite.x - @ox
  1085.       y = sprite.y - @oy
  1086.       if sprite.opacity < 64 or x < -50 or x > 750 or y < -300 or y > 500
  1087.         sprite.x = rand(800) - 50 + @ox
  1088.         sprite.y = rand(800) - 200 + @oy
  1089.         sprite.opacity = 255
  1090.       end
  1091.     end
  1092.   end
  1093. #-------------------------------------------------------------------------------  
  1094.   def make_bitmaps
  1095.     color1 = Color.new(255, 255, 255, 255)
  1096.     color2 = Color.new(255, 255, 255, 128)
  1097.     @rain_bitmap = Bitmap.new(7, 56)
  1098.     for i in 0..6
  1099.       @rain_bitmap.fill_rect(6-i, i*8, 1, 8, color1)
  1100.     end
  1101.     @rain_splash = Bitmap.new(8, 5)
  1102.     @rain_splash.fill_rect(1, 0, 6, 1, color2)
  1103.     @rain_splash.fill_rect(1, 4, 6, 1, color2)
  1104.     @rain_splash.fill_rect(0, 1, 1, 3, color2)
  1105.     @rain_splash.fill_rect(7, 1, 1, 3, color2)
  1106.     @rain_splash.set_pixel(1, 0, color1)
  1107.     @rain_splash.set_pixel(0, 1, color1)
  1108. #-------------------------------------------------------------------------------   
  1109.     @storm_bitmap = Bitmap.new(34, 64)
  1110.     for i in 0..31
  1111.       @storm_bitmap.fill_rect(33-i, i*2, 1, 2, color2)
  1112.       @storm_bitmap.fill_rect(32-i, i*2, 1, 2, color1)
  1113.       @storm_bitmap.fill_rect(31-i, i*2, 1, 2, color2)
  1114.     end
  1115. #-------------------------------------------------------------------------------   
  1116.     @snow_bitmap = Bitmap.new(6, 6)
  1117.     @snow_bitmap.fill_rect(0, 1, 6, 4, color2)
  1118.     @snow_bitmap.fill_rect(1, 0, 4, 6, color2)
  1119.     @snow_bitmap.fill_rect(1, 2, 4, 2, color1)
  1120.     @snow_bitmap.fill_rect(2, 1, 2, 4, color1)
  1121.     @sprites = []   
  1122.     @snow_bitmaps = []
  1123.    
  1124.     color3 = Color.new(255, 255, 255, 204)
  1125.     @snow_bitmaps[0] = Bitmap.new(3, 3)
  1126.     @snow_bitmaps[0].fill_rect(0, 0, 3, 3, color2)
  1127.     @snow_bitmaps[0].fill_rect(0, 1, 3, 1, color3)
  1128.     @snow_bitmaps[0].fill_rect(1, 0, 1, 3, color3)
  1129.     @snow_bitmaps[0].set_pixel(1, 1, color1)
  1130.    
  1131.     @snow_bitmaps[1] = Bitmap.new(4, 4)
  1132.     @snow_bitmaps[1].fill_rect(0, 1, 4, 2, color2)
  1133.     @snow_bitmaps[1].fill_rect(1, 0, 2, 4, color2)
  1134.     @snow_bitmaps[1].fill_rect(1, 1, 2, 2, color1)
  1135.    
  1136.     @snow_bitmaps[2] = Bitmap.new(5, 5)
  1137.     @snow_bitmaps[1].fill_rect(0, 1, 5, 3, color3)
  1138.     @snow_bitmaps[1].fill_rect(1, 0, 3, 5, color3)
  1139.     @snow_bitmaps[1].fill_rect(1, 1, 3, 3, color2)
  1140.     @snow_bitmaps[1].fill_rect(2, 1, 3, 1, color1)
  1141.     @snow_bitmaps[1].fill_rect(1, 2, 1, 3, color1)
  1142.    
  1143.     @snow_bitmaps[3] = Bitmap.new(7, 7)
  1144.     @snow_bitmaps[1].fill_rect(1, 1, 5, 5, color3)
  1145.     @snow_bitmaps[1].fill_rect(2, 0, 7, 3, color3)
  1146.     @snow_bitmaps[1].fill_rect(0, 2, 3, 7, color3)
  1147.     @snow_bitmaps[1].fill_rect(2, 1, 5, 3, color2)
  1148.     @snow_bitmaps[1].fill_rect(1, 2, 3, 5, color2)
  1149.     @snow_bitmaps[1].fill_rect(2, 2, 3, 3, color1)
  1150.     @snow_bitmaps[1].fill_rect(3, 1, 5, 1, color1)
  1151.     @snow_bitmaps[1].fill_rect(1, 3, 1, 5, color1)
  1152. #-------------------------------------------------------------------------------   
  1153.     #hail
  1154.    
  1155.     blueGrey  = Color.new(215, 227, 227, 150)
  1156.     grey      = Color.new(214, 217, 217, 150)
  1157.     lightGrey = Color.new(233, 233, 233, 250)
  1158.     lightBlue = Color.new(222, 239, 243, 250)
  1159.    
  1160.     @hail_bitmap = Bitmap.new(4, 4)
  1161.     @hail_bitmap.fill_rect(1, 0, 2, 1, blueGrey)
  1162.     @hail_bitmap.fill_rect(0, 1, 1, 2, blueGrey)
  1163.     @hail_bitmap.fill_rect(3, 1, 1, 2, grey)
  1164.     @hail_bitmap.fill_rect(1, 3, 2, 1, grey)
  1165.     @hail_bitmap.fill_rect(1, 1, 2, 2, lightGrey)
  1166.     @hail_bitmap.set_pixel(1, 1, lightBlue)
  1167.    
  1168. #-------------------------------------------------------------------------------   
  1169.     #sakura petals

  1170.     color3 = Color.new(255, 167, 192, 255) # light pink
  1171.     color4 = Color.new(213, 106, 136, 255) # dark pink
  1172.     @petal_bitmap = Bitmap.new(4, 4) #This creates a new bitmap that is 4 x 4 pixels
  1173.     @petal_bitmap.fill_rect(0, 3, 1, 1, color3) # this makes a 1x1 pixel "rectangle" at the 0, 3 pixel of the image (upper left corner is 0, 0)
  1174.     @petal_bitmap.fill_rect(1, 2, 1, 1, color3)
  1175.     @petal_bitmap.fill_rect(2, 1, 1, 1, color3)
  1176.     @petal_bitmap.fill_rect(3, 0, 1, 1, color3)
  1177.     @petal_bitmap.fill_rect(1, 3, 1, 1, color4)
  1178.     @petal_bitmap.fill_rect(2, 2, 1, 1, color4)
  1179.     @petal_bitmap.fill_rect(3, 1, 1, 1, color4)
  1180.    
  1181. #-------------------------------------------------------------------------------   
  1182.     #autumn brown leaves
  1183.    
  1184.     brightOrange = Color.new(248, 88, 0, 255)  
  1185.     orangeBrown  = Color.new(144, 80, 56, 255)
  1186.     burntRed     = Color.new(152, 0, 0, 255)
  1187.     paleOrange   = Color.new(232, 160, 128, 255)
  1188.     darkBrown    = Color.new(72, 40, 0, 255)
  1189.    
  1190.     @autumn_leaf_bitmaps = []
  1191.    
  1192.     @autumn_leaf_bitmaps.push(Bitmap.new(8, 8))
  1193.     # draw the first of the leaf1 bitmaps
  1194.     @autumn_leaf_bitmaps[0].set_pixel(5, 1, orangeBrown)
  1195.     @autumn_leaf_bitmaps[0].set_pixel(6, 1, brightOrange)
  1196.     @autumn_leaf_bitmaps[0].set_pixel(7, 1, paleOrange)
  1197.     @autumn_leaf_bitmaps[0].set_pixel(3, 2, orangeBrown)
  1198.     @autumn_leaf_bitmaps[0].fill_rect(4, 2, 2, 1, brightOrange)
  1199.     @autumn_leaf_bitmaps[0].set_pixel(6, 2, paleOrange)
  1200.     @autumn_leaf_bitmaps[0].set_pixel(2, 3, orangeBrown)
  1201.     @autumn_leaf_bitmaps[0].set_pixel(3, 3, brightOrange)
  1202.     @autumn_leaf_bitmaps[0].fill_rect(4, 3, 2, 1, paleOrange)
  1203.     @autumn_leaf_bitmaps[0].set_pixel(1, 4, orangeBrown)
  1204.     @autumn_leaf_bitmaps[0].set_pixel(2, 4, brightOrange)
  1205.     @autumn_leaf_bitmaps[0].set_pixel(3, 4, paleOrange)
  1206.     @autumn_leaf_bitmaps[0].set_pixel(1, 5, brightOrange)
  1207.     @autumn_leaf_bitmaps[0].set_pixel(2, 5, paleOrange)
  1208.     @autumn_leaf_bitmaps[0].set_pixel(0, 6, orangeBrown)
  1209.     @autumn_leaf_bitmaps[0].set_pixel(1, 6, paleOrange)
  1210.     @autumn_leaf_bitmaps[0].set_pixel(0, 7, paleOrange)
  1211.    
  1212.     # draw the 2nd of the leaf1 bitmaps
  1213.     @autumn_leaf_bitmaps.push(Bitmap.new(8, 8))
  1214.     @autumn_leaf_bitmaps[1].set_pixel(3, 0, brightOrange)
  1215.     @autumn_leaf_bitmaps[1].set_pixel(7, 0, brightOrange)
  1216.     @autumn_leaf_bitmaps[1].set_pixel(3, 1, orangeBrown)
  1217.     @autumn_leaf_bitmaps[1].set_pixel(4, 1, burntRed)
  1218.     @autumn_leaf_bitmaps[1].set_pixel(6, 1, brightOrange)
  1219.     @autumn_leaf_bitmaps[1].set_pixel(0, 2, paleOrange)
  1220.     @autumn_leaf_bitmaps[1].set_pixel(1, 2, brightOrange)
  1221.     @autumn_leaf_bitmaps[1].set_pixel(2, 2, orangeBrown)
  1222.     @autumn_leaf_bitmaps[1].set_pixel(3, 2, burntRed)
  1223.     @autumn_leaf_bitmaps[1].set_pixel(4, 2, orangeBrown)
  1224.     @autumn_leaf_bitmaps[1].set_pixel(5, 2, brightOrange)
  1225.     @autumn_leaf_bitmaps[1].fill_rect(1, 3, 3, 1, orangeBrown)
  1226.     @autumn_leaf_bitmaps[1].fill_rect(4, 3, 2, 1, brightOrange)
  1227.     @autumn_leaf_bitmaps[1].set_pixel(6, 3, orangeBrown)
  1228.     @autumn_leaf_bitmaps[1].set_pixel(2, 4, burntRed)
  1229.     @autumn_leaf_bitmaps[1].fill_rect(3, 4, 3, 1, brightOrange)
  1230.     @autumn_leaf_bitmaps[1].set_pixel(6, 4, burntRed)
  1231.     @autumn_leaf_bitmaps[1].set_pixel(7, 4, darkBrown)
  1232.     @autumn_leaf_bitmaps[1].set_pixel(1, 5, orangeBrown)
  1233.     @autumn_leaf_bitmaps[1].fill_rect(2, 5, 2, 1, brightOrange)
  1234.     @autumn_leaf_bitmaps[1].set_pixel(4, 5, orangeBrown)
  1235.     @autumn_leaf_bitmaps[1].set_pixel(5, 5, burntRed)
  1236.     @autumn_leaf_bitmaps[1].fill_rect(1, 6, 2, 1, brightOrange)
  1237.     @autumn_leaf_bitmaps[1].fill_rect(4, 6, 2, 1, burntRed)
  1238.     @autumn_leaf_bitmaps[1].set_pixel(0, 7, brightOrange)
  1239.     @autumn_leaf_bitmaps[1].set_pixel(5, 7, darkBrown)
  1240.    
  1241.     # draw the 3rd of the leaf1 bitmaps
  1242.     @autumn_leaf_bitmaps.push(Bitmap.new(8, 8))
  1243.     @autumn_leaf_bitmaps[2].set_pixel(7, 1, paleOrange)
  1244.     @autumn_leaf_bitmaps[2].set_pixel(6, 2, paleOrange)
  1245.     @autumn_leaf_bitmaps[2].set_pixel(7, 2, orangeBrown)
  1246.     @autumn_leaf_bitmaps[2].set_pixel(5, 3, paleOrange)
  1247.     @autumn_leaf_bitmaps[2].set_pixel(6, 3, brightOrange)
  1248.     @autumn_leaf_bitmaps[2].set_pixel(4, 4, paleOrange)
  1249.     @autumn_leaf_bitmaps[2].set_pixel(5, 4, brightOrange)
  1250.     @autumn_leaf_bitmaps[2].set_pixel(6, 4, orangeBrown)
  1251.     @autumn_leaf_bitmaps[2].fill_rect(2, 5, 2, 1, paleOrange)
  1252.     @autumn_leaf_bitmaps[2].set_pixel(4, 5, brightOrange)
  1253.     @autumn_leaf_bitmaps[2].set_pixel(5, 5, orangeBrown)
  1254.     @autumn_leaf_bitmaps[2].set_pixel(1, 6, paleOrange)
  1255.     @autumn_leaf_bitmaps[2].fill_rect(2, 6, 2, 1, brightOrange)
  1256.     @autumn_leaf_bitmaps[2].set_pixel(4, 6, orangeBrown)
  1257.     @autumn_leaf_bitmaps[2].set_pixel(0, 7, paleOrange)
  1258.     @autumn_leaf_bitmaps[2].set_pixel(1, 7, brightOrange)
  1259.     @autumn_leaf_bitmaps[2].set_pixel(2, 7, orangeBrown)
  1260.    
  1261.     # draw the 4th of the leaf1 bitmaps
  1262.     @autumn_leaf_bitmaps.push(Bitmap.new(8, 8))
  1263.     @autumn_leaf_bitmaps[3].set_pixel(3, 0, brightOrange)
  1264.     @autumn_leaf_bitmaps[3].set_pixel(7, 0, brightOrange)
  1265.     @autumn_leaf_bitmaps[3].set_pixel(3, 1, orangeBrown)
  1266.     @autumn_leaf_bitmaps[3].set_pixel(4, 1, burntRed)
  1267.     @autumn_leaf_bitmaps[3].set_pixel(6, 1, brightOrange)
  1268.     @autumn_leaf_bitmaps[3].set_pixel(0, 2, paleOrange)
  1269.     @autumn_leaf_bitmaps[3].set_pixel(1, 2, brightOrange)
  1270.     @autumn_leaf_bitmaps[3].set_pixel(2, 2, orangeBrown)
  1271.     @autumn_leaf_bitmaps[3].set_pixel(3, 2, burntRed)
  1272.     @autumn_leaf_bitmaps[3].set_pixel(4, 2, orangeBrown)
  1273.     @autumn_leaf_bitmaps[3].set_pixel(5, 2, brightOrange)
  1274.     @autumn_leaf_bitmaps[3].fill_rect(1, 3, 3, 1, orangeBrown)
  1275.     @autumn_leaf_bitmaps[3].fill_rect(4, 3, 2, 1, brightOrange)
  1276.     @autumn_leaf_bitmaps[3].set_pixel(6, 3, orangeBrown)
  1277.     @autumn_leaf_bitmaps[3].set_pixel(2, 4, burntRed)
  1278.     @autumn_leaf_bitmaps[3].fill_rect(3, 4, 3, 1, brightOrange)
  1279.     @autumn_leaf_bitmaps[3].set_pixel(6, 4, burntRed)
  1280.     @autumn_leaf_bitmaps[3].set_pixel(7, 4, darkBrown)
  1281.     @autumn_leaf_bitmaps[3].set_pixel(1, 5, orangeBrown)
  1282.     @autumn_leaf_bitmaps[3].fill_rect(2, 5, 2, 1, brightOrange)
  1283.     @autumn_leaf_bitmaps[3].set_pixel(4, 5, orangeBrown)
  1284.     @autumn_leaf_bitmaps[3].set_pixel(5, 5, burntRed)
  1285.     @autumn_leaf_bitmaps[3].fill_rect(1, 6, 2, 1, brightOrange)
  1286.     @autumn_leaf_bitmaps[3].fill_rect(4, 6, 2, 1, burntRed)
  1287.     @autumn_leaf_bitmaps[3].set_pixel(0, 7, brightOrange)
  1288.     @autumn_leaf_bitmaps[3].set_pixel(5, 7, darkBrown)
  1289.    
  1290. #-------------------------------------------------------------------------------

  1291.     # Red maple leaves
  1292.    
  1293.     @redmaple_leaf_bitmaps = []
  1294.     brightRed = Color.new(255, 0, 0, 255)
  1295.     midRed    = Color.new(179, 17, 17, 255)
  1296.     darkRed   = Color.new(141, 9, 9, 255)
  1297.    
  1298.     @redmaple_leaf_bitmaps.push(Bitmap.new(8, 8))
  1299.     # draw the first of the red maple leaves bitmaps
  1300.     @redmaple_leaf_bitmaps[0].set_pixel(5, 1, darkRed)
  1301.     @redmaple_leaf_bitmaps[0].set_pixel(6, 1, brightRed)
  1302.     @redmaple_leaf_bitmaps[0].set_pixel(7, 1, midRed)
  1303.     @redmaple_leaf_bitmaps[0].set_pixel(3, 2, darkRed)
  1304.     @redmaple_leaf_bitmaps[0].fill_rect(4, 2, 2, 1, brightRed)
  1305.     @redmaple_leaf_bitmaps[0].set_pixel(6, 2, midRed)
  1306.     @redmaple_leaf_bitmaps[0].set_pixel(2, 3, darkRed)
  1307.     @redmaple_leaf_bitmaps[0].set_pixel(3, 3, brightRed)
  1308.     @redmaple_leaf_bitmaps[0].fill_rect(4, 3, 2, 1, midRed)
  1309.     @redmaple_leaf_bitmaps[0].set_pixel(1, 4, brightRed)
  1310.     @redmaple_leaf_bitmaps[0].set_pixel(2, 4, brightRed)
  1311.     @redmaple_leaf_bitmaps[0].set_pixel(3, 4, midRed)
  1312.     @redmaple_leaf_bitmaps[0].set_pixel(1, 5, brightRed)
  1313.     @redmaple_leaf_bitmaps[0].set_pixel(2, 5, midRed)
  1314.     @redmaple_leaf_bitmaps[0].set_pixel(0, 6, darkRed)
  1315.     @redmaple_leaf_bitmaps[0].set_pixel(1, 6, midRed)
  1316.     @redmaple_leaf_bitmaps[0].set_pixel(0, 7, midRed)
  1317.    
  1318.     # draw the 2nd of the red maple leaves bitmaps
  1319.     @redmaple_leaf_bitmaps.push(Bitmap.new(8, 8))
  1320.     @redmaple_leaf_bitmaps[1].set_pixel(3, 0, brightRed)
  1321.     @redmaple_leaf_bitmaps[1].set_pixel(7, 0, brightRed)
  1322.     @redmaple_leaf_bitmaps[1].set_pixel(3, 1, darkRed)
  1323.     @redmaple_leaf_bitmaps[1].set_pixel(4, 1, burntRed)
  1324.     @redmaple_leaf_bitmaps[1].set_pixel(6, 1, brightRed)
  1325.     @redmaple_leaf_bitmaps[1].set_pixel(0, 2, midRed)
  1326.     @redmaple_leaf_bitmaps[1].set_pixel(1, 2, brightRed)
  1327.     @redmaple_leaf_bitmaps[1].set_pixel(2, 2, darkRed)
  1328.     @redmaple_leaf_bitmaps[1].set_pixel(3, 2, burntRed)
  1329.     @redmaple_leaf_bitmaps[1].set_pixel(4, 2, darkRed)
  1330.     @redmaple_leaf_bitmaps[1].set_pixel(5, 2, brightRed)
  1331.     @redmaple_leaf_bitmaps[1].fill_rect(1, 3, 3, 1, darkRed)
  1332.     @redmaple_leaf_bitmaps[1].fill_rect(4, 3, 2, 1, brightRed)
  1333.     @redmaple_leaf_bitmaps[1].set_pixel(6, 3, darkRed)
  1334.     @redmaple_leaf_bitmaps[1].set_pixel(2, 4, burntRed)
  1335.     @redmaple_leaf_bitmaps[1].fill_rect(3, 4, 3, 1, brightRed)
  1336.     @redmaple_leaf_bitmaps[1].set_pixel(6, 4, burntRed)
  1337.     @redmaple_leaf_bitmaps[1].set_pixel(7, 4, darkRed)
  1338.     @redmaple_leaf_bitmaps[1].set_pixel(1, 5, darkRed)
  1339.     @redmaple_leaf_bitmaps[1].fill_rect(2, 5, 2, 1, brightRed)
  1340.     @redmaple_leaf_bitmaps[1].set_pixel(4, 5, darkRed)
  1341.     @redmaple_leaf_bitmaps[1].set_pixel(5, 5, burntRed)
  1342.     @redmaple_leaf_bitmaps[1].fill_rect(1, 6, 2, 1, brightRed)
  1343.     @redmaple_leaf_bitmaps[1].fill_rect(4, 6, 2, 1, burntRed)
  1344.     @redmaple_leaf_bitmaps[1].set_pixel(0, 7, brightRed)
  1345.     @autumn_leaf_bitmaps[1].set_pixel(5, 7, darkRed)
  1346.    
  1347.     # draw the 3rd of the red maple leaves bitmaps
  1348.     @redmaple_leaf_bitmaps.push(Bitmap.new(8, 8))
  1349.     @redmaple_leaf_bitmaps[2].set_pixel(7, 1, midRed)
  1350.     @redmaple_leaf_bitmaps[2].set_pixel(6, 2, midRed)
  1351.     @redmaple_leaf_bitmaps[2].set_pixel(7, 2, darkRed)
  1352.     @redmaple_leaf_bitmaps[2].set_pixel(5, 3, midRed)
  1353.     @redmaple_leaf_bitmaps[2].set_pixel(6, 3, brightRed)
  1354.     @redmaple_leaf_bitmaps[2].set_pixel(4, 4, midRed)
  1355.     @redmaple_leaf_bitmaps[2].set_pixel(5, 4, brightRed)
  1356.     @redmaple_leaf_bitmaps[2].set_pixel(6, 4, darkRed)
  1357.     @redmaple_leaf_bitmaps[2].fill_rect(2, 5, 2, 1, midRed)
  1358.     @redmaple_leaf_bitmaps[2].set_pixel(4, 5, brightRed)
  1359.     @redmaple_leaf_bitmaps[2].set_pixel(5, 5, darkRed)
  1360.     @redmaple_leaf_bitmaps[2].set_pixel(1, 6, midRed)
  1361.     @redmaple_leaf_bitmaps[2].fill_rect(2, 6, 2, 1, brightRed)
  1362.     @redmaple_leaf_bitmaps[2].set_pixel(4, 6, darkRed)
  1363.     @redmaple_leaf_bitmaps[2].set_pixel(0, 7, midRed)
  1364.     @redmaple_leaf_bitmaps[2].set_pixel(1, 7, brightRed)
  1365.     @redmaple_leaf_bitmaps[2].set_pixel(2, 7, darkRed)
  1366.    
  1367.     # draw the 4th of the red maple leaves bitmaps
  1368.     @redmaple_leaf_bitmaps.push(Bitmap.new(8, 8))
  1369.     @redmaple_leaf_bitmaps[3].set_pixel(3, 0, brightRed)
  1370.     @redmaple_leaf_bitmaps[3].set_pixel(7, 0, brightRed)
  1371.     @redmaple_leaf_bitmaps[3].set_pixel(3, 1, darkRed)
  1372.     @redmaple_leaf_bitmaps[3].set_pixel(4, 1, burntRed)
  1373.     @redmaple_leaf_bitmaps[3].set_pixel(6, 1, brightRed)
  1374.     @redmaple_leaf_bitmaps[3].set_pixel(0, 2, midRed)
  1375.     @redmaple_leaf_bitmaps[3].set_pixel(1, 2, brightRed)
  1376.     @redmaple_leaf_bitmaps[3].set_pixel(2, 2, darkRed)
  1377.     @redmaple_leaf_bitmaps[3].set_pixel(3, 2, burntRed)
  1378.     @redmaple_leaf_bitmaps[3].set_pixel(4, 2, darkRed)
  1379.     @redmaple_leaf_bitmaps[3].set_pixel(5, 2, brightRed)
  1380.     @redmaple_leaf_bitmaps[3].fill_rect(1, 3, 3, 1, darkRed)
  1381.     @redmaple_leaf_bitmaps[3].fill_rect(4, 3, 2, 1, brightRed)
  1382.     @redmaple_leaf_bitmaps[3].set_pixel(6, 3, darkRed)
  1383.     @redmaple_leaf_bitmaps[3].set_pixel(2, 4, burntRed)
  1384.     @redmaple_leaf_bitmaps[3].fill_rect(3, 4, 3, 1, brightRed)
  1385.     @redmaple_leaf_bitmaps[3].set_pixel(6, 4, burntRed)
  1386.     @redmaple_leaf_bitmaps[3].set_pixel(7, 4, darkRed)
  1387.     @redmaple_leaf_bitmaps[3].set_pixel(1, 5, darkRed)
  1388.     @redmaple_leaf_bitmaps[3].fill_rect(2, 5, 2, 1, brightRed)
  1389.     @redmaple_leaf_bitmaps[3].set_pixel(4, 5, darkRed)
  1390.     @redmaple_leaf_bitmaps[3].set_pixel(5, 5, burntRed)
  1391.     @redmaple_leaf_bitmaps[3].fill_rect(1, 6, 2, 1, brightRed)
  1392.     @redmaple_leaf_bitmaps[3].fill_rect(4, 6, 2, 1, burntRed)
  1393.     @redmaple_leaf_bitmaps[3].set_pixel(0, 7, brightRed)
  1394.     @redmaple_leaf_bitmaps[3].set_pixel(5, 7, darkRed)
  1395. #-------------------------------------------------------------------------------   
  1396.     #Green leaves

  1397.     @green_leaf_bitmaps = []
  1398.     darkGreen  = Color.new(62, 76, 31, 255)
  1399.     midGreen   = Color.new(76, 91, 43, 255)
  1400.     khaki      = Color.new(105, 114, 66, 255)
  1401.     lightGreen = Color.new(128, 136, 88, 255)
  1402.     mint       = Color.new(146, 154, 106, 255)
  1403.    
  1404.     # 1st leaf bitmap
  1405.     @green_leaf_bitmaps[0] = Bitmap.new(8, 8)
  1406.     @green_leaf_bitmaps[0].set_pixel(1, 0, darkGreen)
  1407.     @green_leaf_bitmaps[0].set_pixel(1, 1, midGreen)
  1408.     @green_leaf_bitmaps[0].set_pixel(2, 1, darkGreen)
  1409.     @green_leaf_bitmaps[0].set_pixel(2, 2, khaki)
  1410.     @green_leaf_bitmaps[0].set_pixel(3, 2, darkGreen)
  1411.     @green_leaf_bitmaps[0].set_pixel(4, 2, khaki)
  1412.     @green_leaf_bitmaps[0].fill_rect(2, 3, 3, 1, midGreen)
  1413.     @green_leaf_bitmaps[0].set_pixel(5, 3, khaki)
  1414.     @green_leaf_bitmaps[0].fill_rect(2, 4, 2, 1, midGreen)
  1415.     @green_leaf_bitmaps[0].set_pixel(4, 4, darkGreen)
  1416.     @green_leaf_bitmaps[0].set_pixel(5, 4, lightGreen)
  1417.     @green_leaf_bitmaps[0].set_pixel(6, 4, khaki)
  1418.     @green_leaf_bitmaps[0].set_pixel(3, 5, midGreen)
  1419.     @green_leaf_bitmaps[0].set_pixel(4, 5, darkGreen)
  1420.     @green_leaf_bitmaps[0].set_pixel(5, 5, khaki)
  1421.     @green_leaf_bitmaps[0].set_pixel(6, 5, lightGreen)
  1422.     @green_leaf_bitmaps[0].set_pixel(4, 6, midGreen)
  1423.     @green_leaf_bitmaps[0].set_pixel(5, 6, darkGreen)
  1424.     @green_leaf_bitmaps[0].set_pixel(6, 6, lightGreen)
  1425.     @green_leaf_bitmaps[0].set_pixel(6, 7, khaki)
  1426.    
  1427.     # 2nd leaf bitmap
  1428.     @green_leaf_bitmaps[1] = Bitmap.new(8, 8)
  1429.     @green_leaf_bitmaps[1].fill_rect(1, 1, 1, 2, midGreen)
  1430.     @green_leaf_bitmaps[1].fill_rect(2, 2, 2, 1, khaki)
  1431.     @green_leaf_bitmaps[1].set_pixel(4, 2, lightGreen)
  1432.     @green_leaf_bitmaps[1].fill_rect(2, 3, 2, 1, darkGreen)
  1433.     @green_leaf_bitmaps[1].fill_rect(4, 3, 2, 1, lightGreen)
  1434.     @green_leaf_bitmaps[1].set_pixel(2, 4, midGreen)
  1435.     @green_leaf_bitmaps[1].set_pixel(3, 4, darkGreen)
  1436.     @green_leaf_bitmaps[1].set_pixel(4, 4, khaki)
  1437.     @green_leaf_bitmaps[1].fill_rect(5, 4, 2, 1, lightGreen)
  1438.     @green_leaf_bitmaps[1].set_pixel(3, 5, midGreen)
  1439.     @green_leaf_bitmaps[1].set_pixel(4, 5, darkGreen)
  1440.     @green_leaf_bitmaps[1].set_pixel(5, 5, khaki)
  1441.     @green_leaf_bitmaps[1].set_pixel(6, 5, lightGreen)
  1442.     @green_leaf_bitmaps[1].set_pixel(5, 6, darkGreen)
  1443.     @green_leaf_bitmaps[1].fill_rect(6, 6, 2, 1, khaki)
  1444.    
  1445.     # 3rd leaf bitmap
  1446.     @green_leaf_bitmaps[2] = Bitmap.new(8, 8)
  1447.     @green_leaf_bitmaps[2].set_pixel(1, 1, darkGreen)
  1448.     @green_leaf_bitmaps[2].fill_rect(1, 2, 2, 1, midGreen)
  1449.     @green_leaf_bitmaps[2].set_pixel(2, 3, midGreen)
  1450.     @green_leaf_bitmaps[2].set_pixel(3, 3, darkGreen)
  1451.     @green_leaf_bitmaps[2].set_pixel(4, 3, midGreen)
  1452.     @green_leaf_bitmaps[2].fill_rect(2, 4, 2, 1, midGreen)
  1453.     @green_leaf_bitmaps[2].set_pixel(4, 4, darkGreen)
  1454.     @green_leaf_bitmaps[2].set_pixel(5, 4, lightGreen)
  1455.     @green_leaf_bitmaps[2].set_pixel(3, 5, midGreen)
  1456.     @green_leaf_bitmaps[2].set_pixel(4, 5, darkGreen)
  1457.     @green_leaf_bitmaps[2].fill_rect(5, 5, 2, 1, khaki)
  1458.     @green_leaf_bitmaps[2].fill_rect(4, 6, 2, 1, midGreen)
  1459.     @green_leaf_bitmaps[2].set_pixel(6, 6, lightGreen)
  1460.     @green_leaf_bitmaps[2].set_pixel(6, 7, khaki)
  1461.    
  1462.     # 4th leaf bitmap
  1463.     @green_leaf_bitmaps[3] = Bitmap.new(8, 8)
  1464.     @green_leaf_bitmaps[3].fill_rect(0, 3, 1, 2, darkGreen)
  1465.     @green_leaf_bitmaps[3].set_pixel(1, 4, midGreen)
  1466.     @green_leaf_bitmaps[3].set_pixel(2, 4, khaki)
  1467.     @green_leaf_bitmaps[3].set_pixel(3, 4, lightGreen)
  1468.     @green_leaf_bitmaps[3].set_pixel(4, 4, darkGreen)
  1469.     @green_leaf_bitmaps[3].set_pixel(7, 4, midGreen)
  1470.     @green_leaf_bitmaps[3].set_pixel(1, 5, darkGreen)
  1471.     @green_leaf_bitmaps[3].set_pixel(2, 5, midGreen)
  1472.     @green_leaf_bitmaps[3].set_pixel(3, 5, lightGreen)
  1473.     @green_leaf_bitmaps[3].set_pixel(4, 5, mint)
  1474.     @green_leaf_bitmaps[3].set_pixel(5, 5, lightGreen)
  1475.     @green_leaf_bitmaps[3].set_pixel(6, 5, khaki)
  1476.     @green_leaf_bitmaps[3].set_pixel(7, 5, midGreen)
  1477.     @green_leaf_bitmaps[3].fill_rect(2, 6, 2, 1, midGreen)
  1478.     @green_leaf_bitmaps[3].set_pixel(4, 6, lightGreen)
  1479.     @green_leaf_bitmaps[3].set_pixel(5, 6, khaki)
  1480.     @green_leaf_bitmaps[3].set_pixel(6, 6, midGreen)
  1481.    
  1482.     # 5th leaf bitmap
  1483.     @green_leaf_bitmaps[4] = Bitmap.new(8, 8)
  1484.     @green_leaf_bitmaps[4].set_pixel(6, 2, midGreen)
  1485.     @green_leaf_bitmaps[4].set_pixel(7, 2, darkGreen)
  1486.     @green_leaf_bitmaps[4].fill_rect(4, 3, 2, 1, midGreen)
  1487.     @green_leaf_bitmaps[4].set_pixel(6, 3, khaki)
  1488.     @green_leaf_bitmaps[4].set_pixel(2, 4, darkGreen)
  1489.     @green_leaf_bitmaps[4].fill_rect(3, 4, 2, 1, khaki)
  1490.     @green_leaf_bitmaps[4].set_pixel(5, 4, lightGreen)
  1491.     @green_leaf_bitmaps[4].set_pixel(6, 4, khaki)
  1492.     @green_leaf_bitmaps[4].set_pixel(1, 5, midGreen)
  1493.     @green_leaf_bitmaps[4].set_pixel(2, 5, khaki)
  1494.     @green_leaf_bitmaps[4].set_pixel(3, 5, lightGreen)
  1495.     @green_leaf_bitmaps[4].set_pixel(4, 5, mint)
  1496.     @green_leaf_bitmaps[4].set_pixel(5, 5, midGreen)
  1497.     @green_leaf_bitmaps[4].set_pixel(2, 6, darkGreen)
  1498.     @green_leaf_bitmaps[4].fill_rect(3, 6, 2, 1, midGreen)
  1499.    
  1500.     # 6th leaf bitmap
  1501.     @green_leaf_bitmaps[5] = Bitmap.new(8, 8)
  1502.     @green_leaf_bitmaps[5].fill_rect(6, 2, 2, 1, midGreen)
  1503.     @green_leaf_bitmaps[5].fill_rect(4, 3, 2, 1, midGreen)
  1504.     @green_leaf_bitmaps[5].set_pixel(6, 3, khaki)
  1505.     @green_leaf_bitmaps[5].set_pixel(3, 4, midGreen)
  1506.     @green_leaf_bitmaps[5].set_pixel(4, 4, khaki)
  1507.     @green_leaf_bitmaps[5].set_pixel(5, 4, lightGreen)
  1508.     @green_leaf_bitmaps[5].set_pixel(6, 4, mint)
  1509.     @green_leaf_bitmaps[5].set_pixel(1, 5, midGreen)
  1510.     @green_leaf_bitmaps[5].set_pixel(2, 5, khaki)
  1511.     @green_leaf_bitmaps[5].fill_rect(3, 5, 2, 1, mint)
  1512.     @green_leaf_bitmaps[5].set_pixel(5, 5, lightGreen)
  1513.     @green_leaf_bitmaps[5].set_pixel(2, 6, midGreen)
  1514.     @green_leaf_bitmaps[5].set_pixel(3, 6, khaki)
  1515.     @green_leaf_bitmaps[5].set_pixel(4, 6, lightGreen)
  1516.    
  1517.     # 7th leaf bitmap
  1518.     @green_leaf_bitmaps[6] = Bitmap.new(8, 8)
  1519.     @green_leaf_bitmaps[6].fill_rect(6, 1, 1, 2, midGreen)
  1520.     @green_leaf_bitmaps[6].fill_rect(4, 2, 2, 1, midGreen)
  1521.     @green_leaf_bitmaps[6].fill_rect(6, 2, 1, 2, darkGreen)
  1522.     @green_leaf_bitmaps[6].fill_rect(3, 3, 2, 1, midGreen)
  1523.     @green_leaf_bitmaps[6].set_pixel(5, 3, khaki)
  1524.     @green_leaf_bitmaps[6].set_pixel(2, 4, midGreen)
  1525.     @green_leaf_bitmaps[6].set_pixel(3, 4, khaki)
  1526.     @green_leaf_bitmaps[6].set_pixel(4, 4, lightGreen)
  1527.     @green_leaf_bitmaps[6].set_pixel(5, 4, midGreen)
  1528.     @green_leaf_bitmaps[6].set_pixel(1, 5, midGreen)
  1529.     @green_leaf_bitmaps[6].set_pixel(2, 5, khaki)
  1530.     @green_leaf_bitmaps[6].fill_rect(3, 5, 2, 1, midGreen)
  1531.     @green_leaf_bitmaps[6].set_pixel(1, 6, darkGreen)
  1532.     @green_leaf_bitmaps[6].set_pixel(2, 6, midGreen)
  1533.    
  1534.     # 8th leaf bitmap
  1535.     @green_leaf_bitmaps[7] = Bitmap.new(8, 8)
  1536.     @green_leaf_bitmaps[7].set_pixel(6, 1, midGreen)
  1537.     @green_leaf_bitmaps[7].fill_rect(4, 2, 3, 2, midGreen)
  1538.     @green_leaf_bitmaps[7].set_pixel(3, 3, darkGreen)
  1539.     @green_leaf_bitmaps[7].set_pixel(2, 4, darkGreen)
  1540.     @green_leaf_bitmaps[7].set_pixel(3, 4, midGreen)
  1541.     @green_leaf_bitmaps[7].fill_rect(4, 4, 2, 1, khaki)
  1542.     @green_leaf_bitmaps[7].set_pixel(1, 5, darkGreen)
  1543.     @green_leaf_bitmaps[7].set_pixel(2, 5, midGreen)
  1544.     @green_leaf_bitmaps[7].fill_rect(3, 5, 2, 1, lightGreen)
  1545.     @green_leaf_bitmaps[7].set_pixel(2, 6, midGreen)
  1546.     @green_leaf_bitmaps[7].set_pixel(3, 6, lightGreen)
  1547.    
  1548.     # 9th leaf bitmap
  1549.     @green_leaf_bitmaps[8] = Bitmap.new(8, 8)
  1550.     @green_leaf_bitmaps[8].fill_rect(6, 1, 1, 2, midGreen)
  1551.     @green_leaf_bitmaps[8].fill_rect(4, 2, 2, 1, midGreen)
  1552.     @green_leaf_bitmaps[8].fill_rect(6, 2, 1, 2, darkGreen)
  1553.     @green_leaf_bitmaps[8].fill_rect(3, 3, 2, 1, midGreen)
  1554.     @green_leaf_bitmaps[8].set_pixel(5, 3, khaki)
  1555.     @green_leaf_bitmaps[8].set_pixel(2, 4, midGreen)
  1556.     @green_leaf_bitmaps[8].set_pixel(3, 4, khaki)
  1557.     @green_leaf_bitmaps[8].set_pixel(4, 4, lightGreen)
  1558.     @green_leaf_bitmaps[8].set_pixel(5, 4, midGreen)
  1559.     @green_leaf_bitmaps[8].set_pixel(1, 5, midGreen)
  1560.     @green_leaf_bitmaps[8].set_pixel(2, 5, khaki)
  1561.     @green_leaf_bitmaps[8].fill_rect(3, 5, 2, 1, midGreen)
  1562.     @green_leaf_bitmaps[8].set_pixel(1, 6, darkGreen)
  1563.     @green_leaf_bitmaps[8].set_pixel(2, 6, midGreen)
  1564.    
  1565.     # 10th leaf bitmap
  1566.     @green_leaf_bitmaps[9] = Bitmap.new(8, 8)
  1567.     @green_leaf_bitmaps[9].fill_rect(6, 2, 2, 1, midGreen)
  1568.     @green_leaf_bitmaps[9].fill_rect(4, 3, 2, 1, midGreen)
  1569.     @green_leaf_bitmaps[9].set_pixel(6, 3, khaki)
  1570.     @green_leaf_bitmaps[9].set_pixel(3, 4, midGreen)
  1571.     @green_leaf_bitmaps[9].set_pixel(4, 4, khaki)
  1572.     @green_leaf_bitmaps[9].set_pixel(5, 4, lightGreen)
  1573.     @green_leaf_bitmaps[9].set_pixel(6, 4, mint)
  1574.     @green_leaf_bitmaps[9].set_pixel(1, 5, midGreen)
  1575.     @green_leaf_bitmaps[9].set_pixel(2, 5, khaki)
  1576.     @green_leaf_bitmaps[9].fill_rect(3, 5, 2, 1, mint)
  1577.     @green_leaf_bitmaps[9].set_pixel(5, 5, lightGreen)
  1578.     @green_leaf_bitmaps[9].set_pixel(2, 6, midGreen)
  1579.     @green_leaf_bitmaps[9].set_pixel(3, 6, khaki)
  1580.     @green_leaf_bitmaps[9].set_pixel(4, 6, lightGreen)
  1581.    
  1582.     # 11th leaf bitmap
  1583.     @green_leaf_bitmaps[10] = Bitmap.new(8, 8)
  1584.     @green_leaf_bitmaps[10].set_pixel(6, 2, midGreen)
  1585.     @green_leaf_bitmaps[10].set_pixel(7, 2, darkGreen)
  1586.     @green_leaf_bitmaps[10].fill_rect(4, 3, 2, 1, midGreen)
  1587.     @green_leaf_bitmaps[10].set_pixel(6, 3, khaki)
  1588.     @green_leaf_bitmaps[10].set_pixel(2, 4, darkGreen)
  1589.     @green_leaf_bitmaps[10].fill_rect(3, 4, 2, 1, khaki)
  1590.     @green_leaf_bitmaps[10].set_pixel(5, 4, lightGreen)
  1591.     @green_leaf_bitmaps[10].set_pixel(6, 4, khaki)
  1592.     @green_leaf_bitmaps[10].set_pixel(1, 5, midGreen)
  1593.     @green_leaf_bitmaps[10].set_pixel(2, 5, khaki)
  1594.     @green_leaf_bitmaps[10].set_pixel(3, 5, lightGreen)
  1595.     @green_leaf_bitmaps[10].set_pixel(4, 5, mint)
  1596.     @green_leaf_bitmaps[10].set_pixel(5, 5, midGreen)
  1597.     @green_leaf_bitmaps[10].set_pixel(2, 6, darkGreen)
  1598.     @green_leaf_bitmaps[10].fill_rect(3, 6, 2, 1, midGreen)
  1599.    
  1600.     # 12th leaf bitmap
  1601.     @green_leaf_bitmaps[11] = Bitmap.new(8, 8)
  1602.     @green_leaf_bitmaps[11].fill_rect(0, 3, 1, 2, darkGreen)
  1603.     @green_leaf_bitmaps[11].set_pixel(1, 4, midGreen)
  1604.     @green_leaf_bitmaps[11].set_pixel(2, 4, khaki)
  1605.     @green_leaf_bitmaps[11].set_pixel(3, 4, lightGreen)
  1606.     @green_leaf_bitmaps[11].set_pixel(4, 4, darkGreen)
  1607.     @green_leaf_bitmaps[11].set_pixel(7, 4, midGreen)
  1608.     @green_leaf_bitmaps[11].set_pixel(1, 5, darkGreen)
  1609.     @green_leaf_bitmaps[11].set_pixel(2, 5, midGreen)
  1610.     @green_leaf_bitmaps[11].set_pixel(3, 5, lightGreen)
  1611.     @green_leaf_bitmaps[11].set_pixel(4, 5, mint)
  1612.     @green_leaf_bitmaps[11].set_pixel(5, 5, lightGreen)
  1613.     @green_leaf_bitmaps[11].set_pixel(6, 5, khaki)
  1614.     @green_leaf_bitmaps[11].set_pixel(7, 5, midGreen)
  1615.     @green_leaf_bitmaps[11].fill_rect(2, 6, 2, 1, midGreen)
  1616.     @green_leaf_bitmaps[11].set_pixel(4, 6, lightGreen)
  1617.     @green_leaf_bitmaps[11].set_pixel(5, 6, khaki)
  1618.     @green_leaf_bitmaps[11].set_pixel(6, 6, midGreen)
  1619.    
  1620.     # 13th leaf bitmap
  1621.     @green_leaf_bitmaps[12] = Bitmap.new(8, 8)
  1622.     @green_leaf_bitmaps[12].set_pixel(1, 1, darkGreen)
  1623.     @green_leaf_bitmaps[12].fill_rect(1, 2, 2, 1, midGreen)
  1624.     @green_leaf_bitmaps[12].set_pixel(2, 3, midGreen)
  1625.     @green_leaf_bitmaps[12].set_pixel(3, 3, darkGreen)
  1626.     @green_leaf_bitmaps[12].set_pixel(4, 3, midGreen)
  1627.     @green_leaf_bitmaps[12].fill_rect(2, 4, 2, 1, midGreen)
  1628.     @green_leaf_bitmaps[12].set_pixel(4, 4, darkGreen)
  1629.     @green_leaf_bitmaps[12].set_pixel(5, 4, lightGreen)
  1630.     @green_leaf_bitmaps[12].set_pixel(3, 5, midGreen)
  1631.     @green_leaf_bitmaps[12].set_pixel(4, 5, darkGreen)
  1632.     @green_leaf_bitmaps[12].fill_rect(5, 5, 2, 1, khaki)
  1633.     @green_leaf_bitmaps[12].fill_rect(4, 6, 2, 1, midGreen)
  1634.     @green_leaf_bitmaps[12].set_pixel(6, 6, lightGreen)
  1635.     @green_leaf_bitmaps[12].set_pixel(6, 7, khaki)
  1636. #-------------------------------------------------------------------------------   
  1637.     #rose petals

  1638.     @rose_bitmaps = []
  1639.    
  1640.     # 1st rose petal bitmap
  1641.     @rose_bitmaps[0] = Bitmap.new(3, 3)
  1642.     @rose_bitmaps[0].fill_rect(1, 0, 2, 1, brightRed)
  1643.     @rose_bitmaps[0].fill_rect(0, 1, 1, 2, brightRed)
  1644.     @rose_bitmaps[0].fill_rect(1, 1, 2, 2, midRed)
  1645.     @rose_bitmaps[0].set_pixel(2, 2, darkRed)
  1646.    
  1647.     # 2nd rose petal bitmap
  1648.     @rose_bitmaps[1] = Bitmap.new(3, 3)
  1649.     @rose_bitmaps[1].set_pixel(0, 1, midRed)
  1650.     @rose_bitmaps[1].set_pixel(1, 1, brightRed)
  1651.     @rose_bitmaps[1].fill_rect(1, 2, 1, 2, midRed)
  1652. #-------------------------------------------------------------------------------   
  1653.     #Feathers

  1654.     @feather_bitmaps = []
  1655.     white = Color.new(255, 255, 255, 255)
  1656.    
  1657.     # 1st feather bitmap
  1658.     @feather_bitmaps[0] = Bitmap.new(3, 3)
  1659.     @feather_bitmaps[0].set_pixel(0, 2, white)
  1660.     @feather_bitmaps[0].set_pixel(1, 2, grey)
  1661.     @feather_bitmaps[0].set_pixel(2, 1, grey)
  1662.    
  1663.     # 2nd feather bitmap
  1664.     @feather_bitmaps[0] = Bitmap.new(3, 3)
  1665.     @feather_bitmaps[0].set_pixel(0, 0, white)
  1666.     @feather_bitmaps[0].set_pixel(0, 1, grey)
  1667.     @feather_bitmaps[0].set_pixel(1, 2, grey)
  1668.    
  1669.     # 3rd feather bitmap
  1670.     @feather_bitmaps[0] = Bitmap.new(3, 3)
  1671.     @feather_bitmaps[0].set_pixel(2, 0, white)
  1672.     @feather_bitmaps[0].set_pixel(1, 0, grey)
  1673.     @feather_bitmaps[0].set_pixel(0, 1, grey)
  1674.    
  1675.     # 4th feather bitmap
  1676.     @feather_bitmaps[0] = Bitmap.new(3, 3)
  1677.     @feather_bitmaps[0].set_pixel(2, 2, white)
  1678.     @feather_bitmaps[0].set_pixel(2, 1, grey)
  1679.     @feather_bitmaps[0].set_pixel(1, 0, grey)
  1680. #-------------------------------------------------------------------------------   
  1681.     #Blood rain
  1682.    
  1683.     @blood_rain_bitmap = Bitmap.new(7, 56)
  1684.     for i in 0..6
  1685.       @blood_rain_bitmap.fill_rect(6-i, i*8, 1, 8, darkRed)
  1686.     end
  1687.     @blood_rain_splash = Bitmap.new(8, 5)
  1688.     @blood_rain_splash.fill_rect(1, 0, 6, 1, darkRed)
  1689.     @blood_rain_splash.fill_rect(1, 4, 6, 1, darkRed)
  1690.     @blood_rain_splash.fill_rect(0, 1, 1, 3, darkRed)
  1691.     @blood_rain_splash.fill_rect(7, 1, 1, 3, darkRed)
  1692. #-------------------------------------------------------------------------------

  1693.     #Blood storm
  1694.    
  1695.     @blood_storm_bitmap = Bitmap.new(34, 64)
  1696.     for i in 0..31
  1697.       @blood_storm_bitmap.fill_rect(33-i, i*2, 1, 2, darkRed)
  1698.       @blood_storm_bitmap.fill_rect(32-i, i*2, 1, 2, darkRed)
  1699.       @blood_storm_bitmap.fill_rect(31-i, i*2, 1, 2, darkRed)
  1700.     end
  1701.    
  1702. #-------------------------------------------------------------------------------
  1703.     #Blood blizzard

  1704.     @bloodblizz_bitmap = Bitmap.new(6, 6)
  1705.     @bloodblizz_bitmap.fill_rect(0, 1, 6, 4, midRed)
  1706.     @bloodblizz_bitmap.fill_rect(1, 0, 4, 6, midRed)
  1707.     @bloodblizz_bitmap.fill_rect(1, 2, 4, 2, darkRed)
  1708.     @bloodblizz_bitmap.fill_rect(2, 1, 2, 4, darkRed)
  1709.     @sprites = []   
  1710.     @bloodblizz_bitmaps = []
  1711.    
  1712.     @bloodblizz_bitmaps[0] = Bitmap.new(3, 3)
  1713.     @bloodblizz_bitmaps[0].fill_rect(0, 0, 3, 3, midRed)
  1714.     @bloodblizz_bitmaps[0].fill_rect(0, 1, 3, 1, darkRed)
  1715.     @bloodblizz_bitmaps[0].fill_rect(1, 0, 1, 3, darkRed)
  1716.     @bloodblizz_bitmaps[0].set_pixel(1, 1, darkRed)
  1717.    
  1718.     @bloodblizz_bitmaps[1] = Bitmap.new(4, 4)
  1719.     @bloodblizz_bitmaps[1].fill_rect(0, 1, 4, 2, midRed)
  1720.     @bloodblizz_bitmaps[1].fill_rect(1, 0, 2, 4, midRed)
  1721.     @bloodblizz_bitmaps[1].fill_rect(1, 1, 2, 2, darkRed)
  1722.    
  1723.     @bloodblizz_bitmaps[2] = Bitmap.new(5, 5)
  1724.     @bloodblizz_bitmaps[1].fill_rect(0, 1, 5, 3, darkRed)
  1725.     @bloodblizz_bitmaps[1].fill_rect(1, 0, 3, 5, darkRed)
  1726.     @bloodblizz_bitmaps[1].fill_rect(1, 1, 3, 3, midRed)
  1727.     @bloodblizz_bitmaps[1].fill_rect(2, 1, 3, 1, darkRed)
  1728.     @bloodblizz_bitmaps[1].fill_rect(1, 2, 1, 3, darkRed)
  1729.    
  1730.     @bloodblizz_bitmaps[3] = Bitmap.new(7, 7)
  1731.     @bloodblizz_bitmaps[1].fill_rect(1, 1, 5, 5, darkRed)
  1732.     @bloodblizz_bitmaps[1].fill_rect(2, 0, 7, 3, darkRed)
  1733.     @bloodblizz_bitmaps[1].fill_rect(0, 2, 3, 7, darkRed)
  1734.     @bloodblizz_bitmaps[1].fill_rect(2, 1, 5, 3, midRed)
  1735.     @bloodblizz_bitmaps[1].fill_rect(1, 2, 3, 5, midRed)
  1736.     @bloodblizz_bitmaps[1].fill_rect(2, 2, 3, 3, darkRed)
  1737.     @bloodblizz_bitmaps[1].fill_rect(3, 1, 5, 1, darkRed)
  1738.     @bloodblizz_bitmaps[1].fill_rect(1, 3, 1, 5, darkRed)
  1739. #-------------------------------------------------------------------------------  

  1740.     # Oil rain
  1741.    
  1742.     darkgrey = Color.new(15, 15, 15, 255)
  1743.     black = Color.new(0, 0, 0, 255)
  1744.    
  1745.     @oil_rain_bitmap = Bitmap.new(7, 56)
  1746.     for i in 0..6
  1747.     @oil_rain_bitmap.fill_rect(6-i, i*8, 1, 8, darkgrey)
  1748.       end
  1749.     @oil_rain_splash = Bitmap.new(8, 5)
  1750.     @oil_rain_splash.fill_rect(1, 0, 6, 1, darkgrey)
  1751.     @oil_rain_splash.fill_rect(1, 4, 6, 1, darkgrey)
  1752.     @oil_rain_splash.fill_rect(0, 1, 1, 3, black)
  1753.     @oil_rain_splash.fill_rect(7, 1, 1, 3, black)
  1754. #-------------------------------------------------------------------------------

  1755.     # Oil storm
  1756.    
  1757.       @oil_storm_bitmap = Bitmap.new(34, 64)
  1758.     for i in 0..31
  1759.       @oil_storm_bitmap.fill_rect(33-i, i*2, 1, 2, darkgrey)
  1760.       @oil_storm_bitmap.fill_rect(32-i, i*2, 1, 2, darkgrey)
  1761.       @oil_storm_bitmap.fill_rect(31-i, i*2, 1, 2, darkgrey)
  1762.     end
  1763. #-------------------------------------------------------------------------------

  1764.     # Golden rain
  1765.    
  1766.     darkYellow  = Color.new(110, 104, 3, 255)
  1767.     midYellow   = Color.new(205, 194, 23, 255)
  1768.     darkYellowtwo  = Color.new(186, 176, 14, 255)
  1769.     lightYellow = Color.new(218, 207, 36, 255)
  1770.     lightYellowtwo = Color.new(227, 217, 56, 255)   
  1771.    
  1772.     @golden_rain_bitmap = Bitmap.new(7, 56)
  1773.     for i in 0..6
  1774.     @golden_rain_bitmap.fill_rect(6-i, i*8, 1, 8, lightYellow)
  1775.       end
  1776.     @golden_rain_splash = Bitmap.new(8, 5)
  1777.     @golden_rain_splash.fill_rect(1, 0, 6, 1, lightYellow)
  1778.     @golden_rain_splash.fill_rect(1, 4, 6, 1, lightYellow)
  1779.     @golden_rain_splash.fill_rect(0, 1, 1, 3, lightYellow)
  1780.     @golden_rain_splash.fill_rect(7, 1, 1, 3, lightYellow)
  1781. #-------------------------------------------------------------------------------

  1782.      # Golden storm

  1783.       @golden_storm_bitmap = Bitmap.new(34, 64)
  1784.     for i in 0..31
  1785.       @golden_storm_bitmap.fill_rect(33-i, i*2, 1, 2, lightYellow)
  1786.       @golden_storm_bitmap.fill_rect(32-i, i*2, 1, 2, lightYellow)
  1787.       @golden_storm_bitmap.fill_rect(31-i, i*2, 1, 2, lightYellow)
  1788.     end
  1789. #-------------------------------------------------------------------------------

  1790.     # Acid rain
  1791.          
  1792.     @acid_rain_bitmap = Bitmap.new(7, 56)
  1793.     for i in 0..6
  1794.     @acid_rain_bitmap.fill_rect(6-i, i*8, 1, 8, midGreen)
  1795.       end
  1796.     @acid_rain_splash = Bitmap.new(8, 5)
  1797.     @acid_rain_splash.fill_rect(1, 0, 6, 1, white)
  1798.     @acid_rain_splash.fill_rect(1, 4, 6, 1, white)
  1799.     @acid_rain_splash.fill_rect(0, 1, 1, 3, white)
  1800.     @acid_rain_splash.fill_rect(7, 1, 1, 3, white)
  1801. #-------------------------------------------------------------------------------

  1802.      # Acid storm

  1803.       @acid_storm_bitmap = Bitmap.new(34, 64)
  1804.     for i in 0..31
  1805.       @acid_storm_bitmap.fill_rect(33-i, i*2, 1, 2, khaki)
  1806.       @acid_storm_bitmap.fill_rect(32-i, i*2, 1, 2, khaki)
  1807.       @acid_storm_bitmap.fill_rect(31-i, i*2, 1, 2, midGreen)
  1808.     end
  1809. #-------------------------------------------------------------------------------

  1810.     # Sepia rain
  1811.    
  1812.     sepia_color = Color.new(167, 149, 139, 255)
  1813.     sepia_colortwo = Color.new(100, 75, 63, 255)
  1814.    
  1815.     @sepia_rain_bitmap = Bitmap.new(7, 56)
  1816.     for i in 0..6
  1817.     @sepia_rain_bitmap.fill_rect(6-i, i*8, 1, 8, sepia_colortwo)
  1818.       end
  1819.     @sepia_rain_splash = Bitmap.new(8, 5)
  1820.     @sepia_rain_splash.fill_rect(1, 0, 6, 1, sepia_colortwo)
  1821.     @sepia_rain_splash.fill_rect(1, 4, 6, 1, sepia_color)
  1822.     @sepia_rain_splash.fill_rect(0, 1, 1, 3, sepia_colortwo)
  1823.     @sepia_rain_splash.fill_rect(7, 1, 1, 3, sepia_color)
  1824. #-------------------------------------------------------------------------------

  1825.      # Sepia storm

  1826.       @sepia_storm_bitmap = Bitmap.new(34, 64)
  1827.     for i in 0..31
  1828.       @sepia_storm_bitmap.fill_rect(33-i, i*2, 1, 2, sepia_colortwo)
  1829.       @sepia_storm_bitmap.fill_rect(32-i, i*2, 1, 2, sepia_colortwo)
  1830.       @sepia_storm_bitmap.fill_rect(31-i, i*2, 1, 2, sepia_color)
  1831.     end
  1832. #-------------------------------------------------------------------------------

  1833.     # Yellow leaves

  1834.     @yellow_leaf_bitmaps = []
  1835.    
  1836.    # 1st leaf bitmap
  1837.     @yellow_leaf_bitmaps[0] = Bitmap.new(8, 8)
  1838.     @yellow_leaf_bitmaps[0].set_pixel(1, 0, darkYellow)
  1839.     @yellow_leaf_bitmaps[0].set_pixel(1, 1, midYellow)
  1840.     @yellow_leaf_bitmaps[0].set_pixel(2, 1, darkYellow)
  1841.     @yellow_leaf_bitmaps[0].set_pixel(2, 2, darkYellowtwo)
  1842.     @yellow_leaf_bitmaps[0].set_pixel(3, 2, darkYellow)
  1843.     @yellow_leaf_bitmaps[0].set_pixel(4, 2, darkYellowtwo)
  1844.     @yellow_leaf_bitmaps[0].fill_rect(2, 3, 3, 1, midYellow)
  1845.     @yellow_leaf_bitmaps[0].set_pixel(5, 3, darkYellowtwo)
  1846.     @yellow_leaf_bitmaps[0].fill_rect(2, 4, 2, 1, midYellow)
  1847.     @yellow_leaf_bitmaps[0].set_pixel(4, 4, darkYellow)
  1848.     @yellow_leaf_bitmaps[0].set_pixel(5, 4, lightYellow)
  1849.     @yellow_leaf_bitmaps[0].set_pixel(6, 4, darkYellowtwo)
  1850.     @yellow_leaf_bitmaps[0].set_pixel(3, 5, midYellow)
  1851.     @yellow_leaf_bitmaps[0].set_pixel(4, 5, darkYellow)
  1852.     @yellow_leaf_bitmaps[0].set_pixel(5, 5, darkYellowtwo)
  1853.     @yellow_leaf_bitmaps[0].set_pixel(6, 5, lightYellow)
  1854.     @yellow_leaf_bitmaps[0].set_pixel(4, 6, midYellow)
  1855.     @yellow_leaf_bitmaps[0].set_pixel(5, 6, darkYellow)
  1856.     @yellow_leaf_bitmaps[0].set_pixel(6, 6, lightYellow)
  1857.     @yellow_leaf_bitmaps[0].set_pixel(6, 7, darkYellowtwo)
  1858.    
  1859.     # 2nd leaf bitmap
  1860.     @yellow_leaf_bitmaps[1] = Bitmap.new(8, 8)
  1861.     @yellow_leaf_bitmaps[1].fill_rect(1, 1, 1, 2, midYellow)
  1862.     @yellow_leaf_bitmaps[1].fill_rect(2, 2, 2, 1, darkYellowtwo)
  1863.     @yellow_leaf_bitmaps[1].set_pixel(4, 2, lightYellow)
  1864.     @yellow_leaf_bitmaps[1].fill_rect(2, 3, 2, 1, darkYellow)
  1865.     @yellow_leaf_bitmaps[1].fill_rect(4, 3, 2, 1, lightYellow)
  1866.     @yellow_leaf_bitmaps[1].set_pixel(2, 4, midYellow)
  1867.     @yellow_leaf_bitmaps[1].set_pixel(3, 4, darkYellow)
  1868.     @yellow_leaf_bitmaps[1].set_pixel(4, 4, darkYellowtwo)
  1869.     @yellow_leaf_bitmaps[1].fill_rect(5, 4, 2, 1, lightYellow)
  1870.     @yellow_leaf_bitmaps[1].set_pixel(3, 5, midYellow)
  1871.     @yellow_leaf_bitmaps[1].set_pixel(4, 5, darkYellow)
  1872.     @yellow_leaf_bitmaps[1].set_pixel(5, 5, darkYellowtwo)
  1873.     @yellow_leaf_bitmaps[1].set_pixel(6, 5, lightYellow)
  1874.     @yellow_leaf_bitmaps[1].set_pixel(5, 6, darkYellow)
  1875.     @yellow_leaf_bitmaps[1].fill_rect(6, 6, 2, 1, darkYellowtwo)
  1876.    
  1877.     # 3rd leaf bitmap
  1878.     @yellow_leaf_bitmaps[2] = Bitmap.new(8, 8)
  1879.     @yellow_leaf_bitmaps[2].set_pixel(1, 1, darkYellow)
  1880.     @yellow_leaf_bitmaps[2].fill_rect(1, 2, 2, 1, midYellow)
  1881.     @yellow_leaf_bitmaps[2].set_pixel(2, 3, midYellow)
  1882.     @yellow_leaf_bitmaps[2].set_pixel(3, 3, darkYellow)
  1883.     @yellow_leaf_bitmaps[2].set_pixel(4, 3, midYellow)
  1884.     @yellow_leaf_bitmaps[2].fill_rect(2, 4, 2, 1, midYellow)
  1885.     @yellow_leaf_bitmaps[2].set_pixel(4, 4, darkYellow)
  1886.     @yellow_leaf_bitmaps[2].set_pixel(5, 4, lightYellow)
  1887.     @yellow_leaf_bitmaps[2].set_pixel(3, 5, midYellow)
  1888.     @yellow_leaf_bitmaps[2].set_pixel(4, 5, darkYellow)
  1889.     @yellow_leaf_bitmaps[2].fill_rect(5, 5, 2, 1, darkYellowtwo)
  1890.     @yellow_leaf_bitmaps[2].fill_rect(4, 6, 2, 1, midYellow)
  1891.     @yellow_leaf_bitmaps[2].set_pixel(6, 6, lightYellow)
  1892.     @yellow_leaf_bitmaps[2].set_pixel(6, 7, darkYellowtwo)
  1893.    
  1894.     # 4th leaf bitmap
  1895.     @yellow_leaf_bitmaps[3] = Bitmap.new(8, 8)
  1896.     @yellow_leaf_bitmaps[3].fill_rect(0, 3, 1, 2, darkYellow)
  1897.     @yellow_leaf_bitmaps[3].set_pixel(1, 4, midYellow)
  1898.     @yellow_leaf_bitmaps[3].set_pixel(2, 4, darkYellowtwo)
  1899.     @yellow_leaf_bitmaps[3].set_pixel(3, 4, lightYellow)
  1900.     @yellow_leaf_bitmaps[3].set_pixel(4, 4, darkYellow)
  1901.     @yellow_leaf_bitmaps[3].set_pixel(7, 4, midYellow)
  1902.     @yellow_leaf_bitmaps[3].set_pixel(1, 5, darkYellow)
  1903.     @yellow_leaf_bitmaps[3].set_pixel(2, 5, midYellow)
  1904.     @yellow_leaf_bitmaps[3].set_pixel(3, 5, lightYellow)
  1905.     @yellow_leaf_bitmaps[3].set_pixel(4, 5, lightYellowtwo)
  1906.     @yellow_leaf_bitmaps[3].set_pixel(5, 5, lightYellow)
  1907.     @yellow_leaf_bitmaps[3].set_pixel(6, 5, darkYellowtwo)
  1908.     @yellow_leaf_bitmaps[3].set_pixel(7, 5, midYellow)
  1909.     @yellow_leaf_bitmaps[3].fill_rect(2, 6, 2, 1, midYellow)
  1910.     @yellow_leaf_bitmaps[3].set_pixel(4, 6, lightYellow)
  1911.     @yellow_leaf_bitmaps[3].set_pixel(5, 6, darkYellowtwo)
  1912.     @yellow_leaf_bitmaps[3].set_pixel(6, 6, midYellow)
  1913.    
  1914.     # 5th leaf bitmap
  1915.     @yellow_leaf_bitmaps[4] = Bitmap.new(8, 8)
  1916.     @yellow_leaf_bitmaps[4].set_pixel(6, 2, midYellow)
  1917.     @yellow_leaf_bitmaps[4].set_pixel(7, 2, darkYellow)
  1918.     @yellow_leaf_bitmaps[4].fill_rect(4, 3, 2, 1, midYellow)
  1919.     @yellow_leaf_bitmaps[4].set_pixel(6, 3, darkYellowtwo)
  1920.     @yellow_leaf_bitmaps[4].set_pixel(2, 4, darkYellow)
  1921.     @yellow_leaf_bitmaps[4].fill_rect(3, 4, 2, 1, darkYellowtwo)
  1922.     @yellow_leaf_bitmaps[4].set_pixel(5, 4, lightYellow)
  1923.     @yellow_leaf_bitmaps[4].set_pixel(6, 4, darkYellowtwo)
  1924.     @yellow_leaf_bitmaps[4].set_pixel(1, 5, midYellow)
  1925.     @yellow_leaf_bitmaps[4].set_pixel(2, 5, darkYellowtwo)
  1926.     @yellow_leaf_bitmaps[4].set_pixel(3, 5, lightYellow)
  1927.     @yellow_leaf_bitmaps[4].set_pixel(4, 5, lightYellowtwo)
  1928.     @yellow_leaf_bitmaps[4].set_pixel(5, 5, midYellow)
  1929.     @yellow_leaf_bitmaps[4].set_pixel(2, 6, darkYellow)
  1930.     @yellow_leaf_bitmaps[4].fill_rect(3, 6, 2, 1, midYellow)
  1931.    
  1932.     # 6th leaf bitmap
  1933.     @yellow_leaf_bitmaps[5] = Bitmap.new(8, 8)
  1934.     @yellow_leaf_bitmaps[5].fill_rect(6, 2, 2, 1, midYellow)
  1935.     @yellow_leaf_bitmaps[5].fill_rect(4, 3, 2, 1, midYellow)
  1936.     @yellow_leaf_bitmaps[5].set_pixel(6, 3, darkYellowtwo)
  1937.     @yellow_leaf_bitmaps[5].set_pixel(3, 4, midYellow)
  1938.     @yellow_leaf_bitmaps[5].set_pixel(4, 4, darkYellowtwo)
  1939.     @yellow_leaf_bitmaps[5].set_pixel(5, 4, lightYellow)
  1940.     @yellow_leaf_bitmaps[5].set_pixel(6, 4, lightYellowtwo)
  1941.     @yellow_leaf_bitmaps[5].set_pixel(1, 5, midYellow)
  1942.     @yellow_leaf_bitmaps[5].set_pixel(2, 5, darkYellowtwo)
  1943.     @yellow_leaf_bitmaps[5].fill_rect(3, 5, 2, 1, lightYellowtwo)
  1944.     @yellow_leaf_bitmaps[5].set_pixel(5, 5, lightYellow)
  1945.     @yellow_leaf_bitmaps[5].set_pixel(2, 6, midYellow)
  1946.     @yellow_leaf_bitmaps[5].set_pixel(3, 6, darkYellowtwo)
  1947.     @yellow_leaf_bitmaps[5].set_pixel(4, 6, lightYellow)
  1948.    
  1949.     # 7th leaf bitmap
  1950.     @yellow_leaf_bitmaps[6] = Bitmap.new(8, 8)
  1951.     @yellow_leaf_bitmaps[6].fill_rect(6, 1, 1, 2, midYellow)
  1952.     @yellow_leaf_bitmaps[6].fill_rect(4, 2, 2, 1, midYellow)
  1953.     @yellow_leaf_bitmaps[6].fill_rect(6, 2, 1, 2, darkYellow)
  1954.     @yellow_leaf_bitmaps[6].fill_rect(3, 3, 2, 1, midYellow)
  1955.     @yellow_leaf_bitmaps[6].set_pixel(5, 3, darkYellowtwo)
  1956.     @yellow_leaf_bitmaps[6].set_pixel(2, 4, midYellow)
  1957.     @yellow_leaf_bitmaps[6].set_pixel(3, 4, darkYellowtwo)
  1958.     @yellow_leaf_bitmaps[6].set_pixel(4, 4, lightYellow)
  1959.     @yellow_leaf_bitmaps[6].set_pixel(5, 4, midYellow)
  1960.     @yellow_leaf_bitmaps[6].set_pixel(1, 5, midYellow)
  1961.     @yellow_leaf_bitmaps[6].set_pixel(2, 5, darkYellowtwo)
  1962.     @yellow_leaf_bitmaps[6].fill_rect(3, 5, 2, 1, midYellow)
  1963.     @yellow_leaf_bitmaps[6].set_pixel(1, 6, darkYellow)
  1964.     @yellow_leaf_bitmaps[6].set_pixel(2, 6, midYellow)
  1965.    
  1966.     # 8th leaf bitmap
  1967.     @yellow_leaf_bitmaps[7] = Bitmap.new(8, 8)
  1968.     @yellow_leaf_bitmaps[7].set_pixel(6, 1, midYellow)
  1969.     @yellow_leaf_bitmaps[7].fill_rect(4, 2, 3, 2, midYellow)
  1970.     @yellow_leaf_bitmaps[7].set_pixel(3, 3, darkYellow)
  1971.     @yellow_leaf_bitmaps[7].set_pixel(2, 4, darkYellow)
  1972.     @yellow_leaf_bitmaps[7].set_pixel(3, 4, midYellow)
  1973.     @yellow_leaf_bitmaps[7].fill_rect(4, 4, 2, 1, darkYellowtwo)
  1974.     @yellow_leaf_bitmaps[7].set_pixel(1, 5, darkYellow)
  1975.     @yellow_leaf_bitmaps[7].set_pixel(2, 5, midYellow)
  1976.     @yellow_leaf_bitmaps[7].fill_rect(3, 5, 2, 1, lightYellow)
  1977.     @yellow_leaf_bitmaps[7].set_pixel(2, 6, midYellow)
  1978.     @yellow_leaf_bitmaps[7].set_pixel(3, 6, lightYellow)
  1979.    
  1980.     # 9th leaf bitmap
  1981.     @yellow_leaf_bitmaps[8] = Bitmap.new(8, 8)
  1982.     @yellow_leaf_bitmaps[8].fill_rect(6, 1, 1, 2, midYellow)
  1983.     @yellow_leaf_bitmaps[8].fill_rect(4, 2, 2, 1, midYellow)
  1984.     @yellow_leaf_bitmaps[8].fill_rect(6, 2, 1, 2, darkYellow)
  1985.     @yellow_leaf_bitmaps[8].fill_rect(3, 3, 2, 1, midYellow)
  1986.     @yellow_leaf_bitmaps[8].set_pixel(5, 3, darkYellowtwo)
  1987.     @yellow_leaf_bitmaps[8].set_pixel(2, 4, midYellow)
  1988.     @yellow_leaf_bitmaps[8].set_pixel(3, 4, darkYellowtwo)
  1989.     @yellow_leaf_bitmaps[8].set_pixel(4, 4, lightYellow)
  1990.     @yellow_leaf_bitmaps[8].set_pixel(5, 4, midYellow)
  1991.     @yellow_leaf_bitmaps[8].set_pixel(1, 5, midYellow)
  1992.     @yellow_leaf_bitmaps[8].set_pixel(2, 5, darkYellowtwo)
  1993.     @yellow_leaf_bitmaps[8].fill_rect(3, 5, 2, 1, midYellow)
  1994.     @yellow_leaf_bitmaps[8].set_pixel(1, 6, darkYellow)
  1995.     @yellow_leaf_bitmaps[8].set_pixel(2, 6, midYellow)
  1996.    
  1997.     # 10th leaf bitmap
  1998.     @yellow_leaf_bitmaps[9] = Bitmap.new(8, 8)
  1999.     @yellow_leaf_bitmaps[9].fill_rect(6, 2, 2, 1, midYellow)
  2000.     @yellow_leaf_bitmaps[9].fill_rect(4, 3, 2, 1, midYellow)
  2001.     @yellow_leaf_bitmaps[9].set_pixel(6, 3, darkYellowtwo)
  2002.     @yellow_leaf_bitmaps[9].set_pixel(3, 4, midYellow)
  2003.     @yellow_leaf_bitmaps[9].set_pixel(4, 4, darkYellowtwo)
  2004.     @yellow_leaf_bitmaps[9].set_pixel(5, 4, lightYellow)
  2005.     @yellow_leaf_bitmaps[9].set_pixel(6, 4, lightYellowtwo)
  2006.     @yellow_leaf_bitmaps[9].set_pixel(1, 5, midYellow)
  2007.     @yellow_leaf_bitmaps[9].set_pixel(2, 5, darkYellowtwo)
  2008.     @yellow_leaf_bitmaps[9].fill_rect(3, 5, 2, 1, lightYellowtwo)
  2009.     @yellow_leaf_bitmaps[9].set_pixel(5, 5, lightYellow)
  2010.     @yellow_leaf_bitmaps[9].set_pixel(2, 6, midYellow)
  2011.     @yellow_leaf_bitmaps[9].set_pixel(3, 6, darkYellowtwo)
  2012.     @yellow_leaf_bitmaps[9].set_pixel(4, 6, lightYellow)
  2013.    
  2014.     # 11th leaf bitmap
  2015.     @yellow_leaf_bitmaps[10] = Bitmap.new(8, 8)
  2016.     @yellow_leaf_bitmaps[10].set_pixel(6, 2, midYellow)
  2017.     @yellow_leaf_bitmaps[10].set_pixel(7, 2, darkYellow)
  2018.     @yellow_leaf_bitmaps[10].fill_rect(4, 3, 2, 1, midYellow)
  2019.     @yellow_leaf_bitmaps[10].set_pixel(6, 3, darkYellowtwo)
  2020.     @yellow_leaf_bitmaps[10].set_pixel(2, 4, darkYellow)
  2021.     @yellow_leaf_bitmaps[10].fill_rect(3, 4, 2, 1, darkYellowtwo)
  2022.     @yellow_leaf_bitmaps[10].set_pixel(5, 4, lightYellow)
  2023.     @yellow_leaf_bitmaps[10].set_pixel(6, 4, darkYellowtwo)
  2024.     @yellow_leaf_bitmaps[10].set_pixel(1, 5, midYellow)
  2025.     @yellow_leaf_bitmaps[10].set_pixel(2, 5, darkYellowtwo)
  2026.     @yellow_leaf_bitmaps[10].set_pixel(3, 5, lightYellow)
  2027.     @yellow_leaf_bitmaps[10].set_pixel(4, 5, lightYellowtwo)
  2028.     @yellow_leaf_bitmaps[10].set_pixel(5, 5, midYellow)
  2029.     @yellow_leaf_bitmaps[10].set_pixel(2, 6, darkYellow)
  2030.     @yellow_leaf_bitmaps[10].fill_rect(3, 6, 2, 1, midYellow)
  2031.    
  2032.     # 12th leaf bitmap
  2033.     @yellow_leaf_bitmaps[11] = Bitmap.new(8, 8)
  2034.     @yellow_leaf_bitmaps[11].fill_rect(0, 3, 1, 2, darkYellow)
  2035.     @yellow_leaf_bitmaps[11].set_pixel(1, 4, midYellow)
  2036.     @yellow_leaf_bitmaps[11].set_pixel(2, 4, darkYellowtwo)
  2037.     @yellow_leaf_bitmaps[11].set_pixel(3, 4, lightYellow)
  2038.     @yellow_leaf_bitmaps[11].set_pixel(4, 4, darkYellow)
  2039.     @yellow_leaf_bitmaps[11].set_pixel(7, 4, midYellow)
  2040.     @yellow_leaf_bitmaps[11].set_pixel(1, 5, darkYellow)
  2041.     @yellow_leaf_bitmaps[11].set_pixel(2, 5, midYellow)
  2042.     @yellow_leaf_bitmaps[11].set_pixel(3, 5, lightYellow)
  2043.     @yellow_leaf_bitmaps[11].set_pixel(4, 5, lightYellowtwo)
  2044.     @yellow_leaf_bitmaps[11].set_pixel(5, 5, lightYellow)
  2045.     @yellow_leaf_bitmaps[11].set_pixel(6, 5, darkYellowtwo)
  2046.     @yellow_leaf_bitmaps[11].set_pixel(7, 5, midYellow)
  2047.     @yellow_leaf_bitmaps[11].fill_rect(2, 6, 2, 1, midYellow)
  2048.     @yellow_leaf_bitmaps[11].set_pixel(4, 6, lightYellow)
  2049.     @yellow_leaf_bitmaps[11].set_pixel(5, 6, darkYellowtwo)
  2050.     @yellow_leaf_bitmaps[11].set_pixel(6, 6, midYellow)
  2051.    
  2052.     # 13th leaf bitmap
  2053.     @yellow_leaf_bitmaps[12] = Bitmap.new(8, 8)
  2054.     @yellow_leaf_bitmaps[12].set_pixel(1, 1, darkYellow)
  2055.     @yellow_leaf_bitmaps[12].fill_rect(1, 2, 2, 1, midYellow)
  2056.     @yellow_leaf_bitmaps[12].set_pixel(2, 3, midYellow)
  2057.     @yellow_leaf_bitmaps[12].set_pixel(3, 3, darkYellow)
  2058.     @yellow_leaf_bitmaps[12].set_pixel(4, 3, midYellow)
  2059.     @yellow_leaf_bitmaps[12].fill_rect(2, 4, 2, 1, midYellow)
  2060.     @yellow_leaf_bitmaps[12].set_pixel(4, 4, darkYellow)
  2061.     @yellow_leaf_bitmaps[12].set_pixel(5, 4, lightYellow)
  2062.     @yellow_leaf_bitmaps[12].set_pixel(3, 5, midYellow)
  2063.     @yellow_leaf_bitmaps[12].set_pixel(4, 5, darkYellow)
  2064.     @yellow_leaf_bitmaps[12].fill_rect(5, 5, 2, 1, darkYellowtwo)
  2065.     @yellow_leaf_bitmaps[12].fill_rect(4, 6, 2, 1, midYellow)
  2066.     @yellow_leaf_bitmaps[12].set_pixel(6, 6, lightYellow)
  2067.     @yellow_leaf_bitmaps[12].set_pixel(6, 7, darkYellowtwo)
  2068.    
  2069. #-------------------------------------------------------------------------------   
  2070.     @sparkle_bitmaps = []
  2071.    
  2072.     lightBlue = Color.new(181, 244, 255, 255)
  2073.     midBlue   = Color.new(126, 197, 235, 255)
  2074.     darkBlue  = Color.new(77, 136, 225, 255)
  2075.    
  2076.     # 1st sparkle bitmap
  2077.     @sparkle_bitmaps[0] = Bitmap.new(7, 7)
  2078.     @sparkle_bitmaps[0].set_pixel(3, 3, darkBlue)
  2079.    
  2080.     # 2nd sparkle bitmap
  2081.     @sparkle_bitmaps[1] = Bitmap.new(7, 7)
  2082.     @sparkle_bitmaps[1].fill_rect(3, 2, 1, 3, darkBlue)
  2083.     @sparkle_bitmaps[1].fill_rect(2, 3, 3, 1, darkBlue)
  2084.     @sparkle_bitmaps[1].set_pixel(3, 3, midBlue)
  2085.    
  2086.     # 3rd sparkle bitmap
  2087.     @sparkle_bitmaps[2] = Bitmap.new(7, 7)
  2088.     @sparkle_bitmaps[2].set_pixel(1, 1, darkBlue)
  2089.     @sparkle_bitmaps[2].set_pixel(5, 1, darkBlue)
  2090.     @sparkle_bitmaps[2].set_pixel(2, 2, midBlue)
  2091.     @sparkle_bitmaps[2].set_pixel(4, 2, midBlue)
  2092.     @sparkle_bitmaps[2].set_pixel(3, 3, lightBlue)
  2093.     @sparkle_bitmaps[2].set_pixel(2, 4, midBlue)
  2094.     @sparkle_bitmaps[2].set_pixel(4, 4, midBlue)
  2095.     @sparkle_bitmaps[2].set_pixel(1, 5, darkBlue)
  2096.     @sparkle_bitmaps[2].set_pixel(5, 5, darkBlue)
  2097.    
  2098.     # 4th sparkle bitmap
  2099.     @sparkle_bitmaps[3] = Bitmap.new(7, 7)
  2100.     @sparkle_bitmaps[3].fill_rect(3, 1, 1, 5, darkBlue)
  2101.     @sparkle_bitmaps[3].fill_rect(1, 3, 5, 1, darkBlue)
  2102.     @sparkle_bitmaps[3].fill_rect(3, 2, 1, 3, midBlue)
  2103.     @sparkle_bitmaps[3].fill_rect(2, 3, 3, 1, midBlue)
  2104.     @sparkle_bitmaps[3].set_pixel(3, 3, lightBlue)
  2105.    
  2106.     # 5th sparkle bitmap
  2107.     @sparkle_bitmaps[4] = Bitmap.new(7, 7)
  2108.     @sparkle_bitmaps[4].fill_rect(2, 2, 3, 3, midBlue)
  2109.     @sparkle_bitmaps[4].fill_rect(3, 2, 1, 3, darkBlue)
  2110.     @sparkle_bitmaps[4].fill_rect(2, 3, 3, 1, darkBlue)
  2111.     @sparkle_bitmaps[4].set_pixel(3, 3, lightBlue)
  2112.     @sparkle_bitmaps[4].set_pixel(1, 1, darkBlue)
  2113.     @sparkle_bitmaps[4].set_pixel(5, 1, darkBlue)
  2114.     @sparkle_bitmaps[4].set_pixel(1, 5, darkBlue)
  2115.     @sparkle_bitmaps[4].set_pixel(5, 1, darkBlue)
  2116.    
  2117.     # 6th sparkle bitmap
  2118.     @sparkle_bitmaps[5] = Bitmap.new(7, 7)
  2119.     @sparkle_bitmaps[5].fill_rect(2, 1, 3, 5, darkBlue)
  2120.     @sparkle_bitmaps[5].fill_rect(1, 2, 5, 3, darkBlue)
  2121.     @sparkle_bitmaps[5].fill_rect(2, 2, 3, 3, midBlue)
  2122.     @sparkle_bitmaps[5].fill_rect(3, 1, 1, 5, midBlue)
  2123.     @sparkle_bitmaps[5].fill_rect(1, 3, 5, 1, midBlue)
  2124.     @sparkle_bitmaps[5].fill_rect(3, 2, 1, 3, lightBlue)
  2125.     @sparkle_bitmaps[5].fill_rect(2, 3, 3, 1, lightBlue)
  2126.     @sparkle_bitmaps[5].set_pixel(3, 3, white)
  2127.    
  2128.     # 7th sparkle bitmap
  2129.     @sparkle_bitmaps[6] = Bitmap.new(7, 7)
  2130.     @sparkle_bitmaps[6].fill_rect(2, 1, 3, 5, midBlue)
  2131.     @sparkle_bitmaps[6].fill_rect(1, 2, 5, 3, midBlue)
  2132.     @sparkle_bitmaps[6].fill_rect(3, 0, 1, 7, darkBlue)
  2133.     @sparkle_bitmaps[6].fill_rect(0, 3, 7, 1, darkBlue)
  2134.     @sparkle_bitmaps[6].fill_rect(2, 2, 3, 3, lightBlue)
  2135.     @sparkle_bitmaps[6].fill_rect(3, 2, 1, 3, midBlue)
  2136.     @sparkle_bitmaps[6].fill_rect(2, 3, 3, 1, midBlue)
  2137.     @sparkle_bitmaps[6].set_pixel(3, 3, white)
  2138. #-------------------------------------------------------------------------------   
  2139.     # Meteor bitmap
  2140.    
  2141.     @meteor_bitmap = Bitmap.new(14, 12)
  2142.     @meteor_bitmap.fill_rect(0, 8, 5, 4, paleOrange)
  2143.     @meteor_bitmap.fill_rect(1, 7, 6, 4, paleOrange)
  2144.     @meteor_bitmap.set_pixel(7, 8, paleOrange)
  2145.     @meteor_bitmap.fill_rect(1, 8, 2, 2, brightOrange)
  2146.     @meteor_bitmap.set_pixel(2, 7, brightOrange)
  2147.     @meteor_bitmap.fill_rect(3, 6, 2, 1, brightOrange)
  2148.     @meteor_bitmap.set_pixel(3, 8, brightOrange)
  2149.     @meteor_bitmap.set_pixel(3, 10, brightOrange)
  2150.     @meteor_bitmap.set_pixel(4, 9, brightOrange)
  2151.     @meteor_bitmap.fill_rect(5, 5, 1, 5, brightOrange)
  2152.     @meteor_bitmap.fill_rect(6, 4, 1, 5, brightOrange)
  2153.     @meteor_bitmap.fill_rect(7, 3, 1, 5, brightOrange)
  2154.     @meteor_bitmap.fill_rect(8, 6, 1, 2, brightOrange)
  2155.     @meteor_bitmap.set_pixel(9, 5, brightOrange)
  2156.     @meteor_bitmap.set_pixel(3, 8, midRed)
  2157.     @meteor_bitmap.fill_rect(4, 7, 1, 2, midRed)
  2158.     @meteor_bitmap.set_pixel(4, 5, midRed)
  2159.     @meteor_bitmap.set_pixel(5, 4, midRed)
  2160.     @meteor_bitmap.set_pixel(5, 6, midRed)
  2161.     @meteor_bitmap.set_pixel(6, 5, midRed)
  2162.     @meteor_bitmap.set_pixel(6, 7, midRed)
  2163.     @meteor_bitmap.fill_rect(7, 4, 1, 3, midRed)
  2164.     @meteor_bitmap.fill_rect(8, 3, 1, 3, midRed)
  2165.     @meteor_bitmap.fill_rect(9, 2, 1, 3, midRed)
  2166.     @meteor_bitmap.fill_rect(10, 1, 1, 3, midRed)
  2167.     @meteor_bitmap.fill_rect(11, 0, 1, 3, midRed)
  2168.     @meteor_bitmap.fill_rect(12, 0, 1, 2, midRed)
  2169.     @meteor_bitmap.set_pixel(13, 0, midRed)
  2170.    
  2171.     # Impact bitmap
  2172.    
  2173.     @impact_bitmap = Bitmap.new(22, 11)
  2174.     @impact_bitmap.fill_rect(0, 5, 1, 2, brightOrange)
  2175.     @impact_bitmap.set_pixel(1, 4, brightOrange)
  2176.     @impact_bitmap.set_pixel(1, 6, brightOrange)
  2177.     @impact_bitmap.set_pixel(2, 3, brightOrange)
  2178.     @impact_bitmap.set_pixel(2, 7, brightOrange)
  2179.     @impact_bitmap.set_pixel(3, 2, midRed)
  2180.     @impact_bitmap.set_pixel(3, 7, midRed)
  2181.     @impact_bitmap.set_pixel(4, 2, brightOrange)
  2182.     @impact_bitmap.set_pixel(4, 8, brightOrange)
  2183.     @impact_bitmap.set_pixel(5, 2, midRed)
  2184.     @impact_bitmap.fill_rect(5, 8, 3, 1, brightOrange)
  2185.     @impact_bitmap.set_pixel(6, 1, midRed)
  2186.     @impact_bitmap.fill_rect(7, 1, 8, 1, brightOrange)
  2187.     @impact_bitmap.fill_rect(7, 9, 8, 1, midRed)
  2188. #-------------------------------------------------------------------------------   
  2189.     # Flame meteor bitmap
  2190.    
  2191.     @flame_meteor_bitmap = Bitmap.new(14, 12)
  2192.     @flame_meteor_bitmap.fill_rect(0, 8, 5, 4, brightOrange)
  2193.     @flame_meteor_bitmap.fill_rect(1, 7, 6, 4, brightOrange)
  2194.     @flame_meteor_bitmap.set_pixel(7, 8, brightOrange)
  2195.     @flame_meteor_bitmap.fill_rect(1, 8, 2, 2, midYellow)
  2196.     @flame_meteor_bitmap.set_pixel(2, 7, midYellow)
  2197.     @flame_meteor_bitmap.fill_rect(3, 6, 2, 1, midYellow)
  2198.     @flame_meteor_bitmap.set_pixel(3, 8, midYellow)
  2199.     @flame_meteor_bitmap.set_pixel(3, 10, midYellow)
  2200.     @flame_meteor_bitmap.set_pixel(4, 9, midYellow)
  2201.     @flame_meteor_bitmap.fill_rect(5, 5, 1, 5, midYellow)
  2202.     @flame_meteor_bitmap.fill_rect(6, 4, 1, 5, midYellow)
  2203.     @flame_meteor_bitmap.fill_rect(7, 3, 1, 5, midYellow)
  2204.     @flame_meteor_bitmap.fill_rect(8, 6, 1, 2, midYellow)
  2205.     @flame_meteor_bitmap.set_pixel(9, 5, midYellow)
  2206.     @flame_meteor_bitmap.set_pixel(3, 8, lightYellow)
  2207.     @flame_meteor_bitmap.fill_rect(4, 7, 1, 2, lightYellowtwo)
  2208.     @flame_meteor_bitmap.set_pixel(4, 5, lightYellow)
  2209.     @flame_meteor_bitmap.set_pixel(5, 4, lightYellow)
  2210.     @flame_meteor_bitmap.set_pixel(5, 6, lightYellow)
  2211.     @flame_meteor_bitmap.set_pixel(6, 5, lightYellow)
  2212.     @flame_meteor_bitmap.set_pixel(6, 7, lightYellow)
  2213.     @flame_meteor_bitmap.fill_rect(7, 4, 1, 3, lightYellow)
  2214.     @flame_meteor_bitmap.fill_rect(8, 3, 1, 3, lightYellow)
  2215.     @flame_meteor_bitmap.fill_rect(9, 2, 1, 3, lightYellow)
  2216.     @flame_meteor_bitmap.fill_rect(10, 1, 1, 3, lightYellow)
  2217.     @flame_meteor_bitmap.fill_rect(11, 0, 1, 3, lightYellow)
  2218.     @flame_meteor_bitmap.fill_rect(12, 0, 1, 2, lightYellow)
  2219.     @flame_meteor_bitmap.set_pixel(13, 0, lightYellow)
  2220.    
  2221.     # Flame impact bitmap
  2222.    
  2223.     @flame_impact_bitmap = Bitmap.new(22, 11)
  2224.     @flame_impact_bitmap.fill_rect(0, 5, 1, 2, midYellow)
  2225.     @flame_impact_bitmap.set_pixel(1, 4, midYellow)
  2226.     @flame_impact_bitmap.set_pixel(1, 6, midYellow)
  2227.     @flame_impact_bitmap.set_pixel(2, 3, midYellow)
  2228.     @flame_impact_bitmap.set_pixel(2, 7, midYellow)
  2229.     @flame_impact_bitmap.set_pixel(3, 2, midYellow)
  2230.     @flame_impact_bitmap.set_pixel(3, 7, lightYellow)
  2231.     @flame_impact_bitmap.set_pixel(4, 2, brightOrange)
  2232.     @flame_impact_bitmap.set_pixel(4, 8, brightOrange)
  2233.     @flame_impact_bitmap.set_pixel(5, 2, lightYellow)
  2234.     @flame_impact_bitmap.fill_rect(5, 8, 3, 1, midYellow)
  2235.     @flame_impact_bitmap.set_pixel(6, 1, lightYellow)
  2236.     @flame_impact_bitmap.fill_rect(7, 1, 8, 1, midYellow)
  2237.     @flame_impact_bitmap.fill_rect(7, 9, 8, 1, lightYellow)
  2238. #-------------------------------------------------------------------------------   
  2239.    
  2240.     # Ash bitmaps
  2241.    
  2242.     @ash_bitmaps = []
  2243.     @ash_bitmaps[0] = Bitmap.new(3, 3)
  2244.     @ash_bitmaps[0].fill_rect(0, 1, 1, 3, lightGrey)
  2245.     @ash_bitmaps[0].fill_rect(1, 0, 3, 1, lightGrey)
  2246.     @ash_bitmaps[0].set_pixel(1, 1, white)
  2247.     @ash_bitmaps[1] = Bitmap.new(3, 3)
  2248.     @ash_bitmaps[1].fill_rect(0, 1, 1, 3, grey)
  2249.     @ash_bitmaps[1].fill_rect(1, 0, 3, 1, grey)
  2250.     @ash_bitmaps[1].set_pixel(1, 1, lightGrey)
  2251. #-------------------------------------------------------------------------------   

  2252.     # Bubble bitmaps
  2253.    
  2254.     @bubble_bitmaps = []
  2255.     darkBlue  = Color.new(77, 136, 225, 160)
  2256.     aqua = Color.new(197, 253, 254, 160)
  2257.     lavender = Color.new(225, 190, 244, 160)
  2258.    
  2259.     # first bubble bitmap
  2260.     @bubble_bitmaps[0] = Bitmap.new(24, 24)
  2261.     @bubble_bitmaps[0].fill_rect(0, 9, 24, 5, darkBlue)
  2262.     @bubble_bitmaps[0].fill_rect(1, 6, 22, 11, darkBlue)
  2263.     @bubble_bitmaps[0].fill_rect(2, 5, 20, 13, darkBlue)
  2264.     @bubble_bitmaps[0].fill_rect(3, 4, 18, 15, darkBlue)
  2265.     @bubble_bitmaps[0].fill_rect(4, 3, 16, 17, darkBlue)
  2266.     @bubble_bitmaps[0].fill_rect(5, 2, 14, 19, darkBlue)
  2267.     @bubble_bitmaps[0].fill_rect(6, 1, 12, 21, darkBlue)
  2268.     @bubble_bitmaps[0].fill_rect(9, 0, 5, 24, darkBlue)
  2269.     @bubble_bitmaps[0].fill_rect(2, 11, 20, 4, aqua)
  2270.     @bubble_bitmaps[0].fill_rect(3, 7, 18, 10, aqua)
  2271.     @bubble_bitmaps[0].fill_rect(4, 6, 16, 12, aqua)
  2272.     @bubble_bitmaps[0].fill_rect(5, 5, 14, 14, aqua)
  2273.     @bubble_bitmaps[0].fill_rect(6, 4, 12, 16, aqua)
  2274.     @bubble_bitmaps[0].fill_rect(9, 2, 4, 20, aqua)
  2275.     @bubble_bitmaps[0].fill_rect(5, 10, 1, 7, lavender)
  2276.     @bubble_bitmaps[0].fill_rect(6, 14, 1, 5, lavender)
  2277.     @bubble_bitmaps[0].fill_rect(7, 15, 1, 4, lavender)
  2278.     @bubble_bitmaps[0].fill_rect(8, 16, 1, 4, lavender)
  2279.     @bubble_bitmaps[0].fill_rect(9, 17, 1, 3, lavender)
  2280.     @bubble_bitmaps[0].fill_rect(10, 18, 4, 3, lavender)
  2281.     @bubble_bitmaps[0].fill_rect(14, 18, 1, 2, lavender)
  2282.     @bubble_bitmaps[0].fill_rect(13, 5, 4, 4, white)
  2283.     @bubble_bitmaps[0].fill_rect(14, 4, 2, 1, white)
  2284.     @bubble_bitmaps[0].set_pixel(17, 6, white)
  2285.    
  2286.     # second bubble bitmap
  2287.     @bubble_bitmaps[1] = Bitmap.new(14, 15)
  2288.     @bubble_bitmaps[1].fill_rect(0, 4, 14, 7, darkBlue)
  2289.     @bubble_bitmaps[1].fill_rect(1, 3, 12, 9, darkBlue)
  2290.     @bubble_bitmaps[1].fill_rect(2, 2, 10, 11, darkBlue)
  2291.     @bubble_bitmaps[1].fill_rect(3, 1, 8, 13, darkBlue)
  2292.     @bubble_bitmaps[1].fill_rect(5, 0, 4, 15, darkBlue)
  2293.     @bubble_bitmaps[1].fill_rect(1, 5, 12, 4, aqua)
  2294.     @bubble_bitmaps[1].fill_rect(2, 4, 10, 6, aqua)
  2295.     @bubble_bitmaps[1].fill_rect(3, 3, 8, 8, aqua)
  2296.     @bubble_bitmaps[1].fill_rect(4, 2, 6, 10, aqua)
  2297.     @bubble_bitmaps[1].fill_rect(1, 5, 12, 4, aqua)
  2298.     @bubble_bitmaps[1].fill_rect(3, 9, 1, 2, lavender)
  2299.     @bubble_bitmaps[1].fill_rect(4, 10, 1, 2, lavender)
  2300.     @bubble_bitmaps[1].fill_rect(5, 11, 4, 1, lavender)
  2301.     @bubble_bitmaps[1].fill_rect(6, 12, 2, 1, white)
  2302.     @bubble_bitmaps[1].fill_rect(8, 3, 2, 2, white)
  2303.     @bubble_bitmaps[1].set_pixel(7, 4, white)
  2304.     @bubble_bitmaps[1].set_pixel(8, 5, white)
  2305.    
  2306.     # Other option for bubbles
  2307.     @bubble2_bitmaps = Array.new
  2308.     darkSteelGray = Color.new(145, 150, 155, 160)
  2309.     midSteelGray = Color.new(180, 180, 185, 160)
  2310.     lightSteelGray = Color.new(225, 225, 235, 160)
  2311.     steelBlue = Color.new(145, 145, 165, 160)
  2312.     lightSteelBlue = Color.new(165, 170, 180, 160)
  2313.     transparentWhite = Color.new(255, 255, 255, 160)
  2314.    
  2315.     # first bubble 2 bitmap
  2316.     @bubble2_bitmaps[0] = Bitmap.new(6, 6)
  2317.     @bubble2_bitmaps[0].fill_rect(0, 0, 6, 6, darkSteelGray)
  2318.     @bubble2_bitmaps[0].fill_rect(0, 2, 6, 2, midSteelGray)
  2319.     @bubble2_bitmaps[0].fill_rect(2, 0, 2, 6, midSteelGray)
  2320.     @bubble2_bitmaps[0].fill_rect(2, 2, 2, 2, lightSteelGray)
  2321.    
  2322.     # second bubble 2 bitmap
  2323.     @bubble2_bitmaps[1] = Bitmap.new(8, 8)
  2324.     @bubble2_bitmaps[1].fill_rect(0, 2, 2, 4, steelBlue)
  2325.     @bubble2_bitmaps[1].fill_rect(2, 0, 4, 2, darkSteelGray)
  2326.     @bubble2_bitmaps[1].fill_rect(6, 2, 2, 2, darkSteelGray)
  2327.     @bubble2_bitmaps[1].fill_rect(2, 6, 2, 2, darkSteelGray)
  2328.     @bubble2_bitmaps[1].fill_rect(6, 4, 2, 2, midSteelGray)
  2329.     @bubble2_bitmaps[1].fill_rect(4, 6, 2, 2, midSteelGray)
  2330.     @bubble2_bitmaps[1].fill_rect(4, 4, 2, 2, lightSteelBlue)
  2331.     @bubble2_bitmaps[1].fill_rect(2, 4, 2, 2, lightSteelGray)
  2332.     @bubble2_bitmaps[1].fill_rect(4, 2, 2, 2, lightSteelGray)
  2333.     @bubble2_bitmaps[1].fill_rect(2, 2, 2, 2, transparentWhite)
  2334.    
  2335.     # third bubble 2 bitmap
  2336.     @bubble2_bitmaps[2] = Bitmap.new(8, 10)
  2337.     @bubble2_bitmaps[2].fill_rect(8, 2, 2, 4, steelBlue)
  2338.     @bubble2_bitmaps[2].fill_rect(2, 0, 8, 2, darkSteelGray)
  2339.     @bubble2_bitmaps[2].fill_rect(2, 6, 8, 2, darkSteelGray)
  2340.     @bubble2_bitmaps[2].fill_rect(4, 0, 2, 2, midSteelGray)
  2341.     @bubble2_bitmaps[2].fill_rect(4, 6, 2, 2, midSteelGray)
  2342.     @bubble2_bitmaps[2].fill_rect(0, 2, 2, 2, midSteelGray)
  2343.     @bubble2_bitmaps[2].fill_rect(0, 4, 2, 2, lightSteelBlue)
  2344.     @bubble2_bitmaps[2].fill_rect(2, 2, 6, 4, lightSteelGray)
  2345.     @bubble2_bitmaps[2].fill_rect(2, 2, 4, 2, transparentWhite)
  2346.     @bubble2_bitmaps[2].fill_rect(4, 4, 2, 2, transparentWhite)
  2347.    
  2348.     # fourth bubble 2 bitmap
  2349.     @bubble2_bitmaps[3] = Bitmap.new(14, 14)
  2350.     @bubble2_bitmaps[3].fill_rect(4, 0, 4, 2, steelBlue)
  2351.     @bubble2_bitmaps[3].fill_rect(0, 4, 2, 4, steelBlue)
  2352.     @bubble2_bitmaps[3].fill_rect(12, 4, 2, 4, steelBlue)
  2353.     @bubble2_bitmaps[3].fill_rect(8, 0, 2, 2, darkSteelGray)
  2354.     @bubble2_bitmaps[3].fill_rect(0, 6, 2, 2, darkSteelGray)
  2355.     @bubble2_bitmaps[3].fill_rect(12, 6, 2, 2, darkSteelGray)
  2356.     @bubble2_bitmaps[3].fill_rect(4, 12, 6, 2, darkSteelGray)
  2357.     @bubble2_bitmaps[3].fill_rect(8, 0, 2, 2, darkSteelGray)
  2358.     @bubble2_bitmaps[3].fill_rect(2, 2, 10, 10, midSteelGray)
  2359.     @bubble2_bitmaps[3].fill_rect(6, 12, 2, 2, midSteelGray)
  2360.     @bubble2_bitmaps[3].fill_rect(2, 4, 10, 6, lightSteelGray)
  2361.     @bubble2_bitmaps[3].fill_rect(4, 2, 2, 2, lightSteelGray)
  2362.     @bubble2_bitmaps[3].fill_rect(6, 10, 4, 2, lightSteelGray)
  2363.     @bubble2_bitmaps[3].fill_rect(6, 4, 2, 2, transparentWhite)
  2364.     @bubble2_bitmaps[3].fill_rect(4, 6, 2, 2, transparentWhite)
  2365. #-------------------------------------------------------------------------------
  2366.    
  2367.     # Water bombs bitmap
  2368.    
  2369.     @waterbomb_bitmap = Bitmap.new(8, 8)
  2370.     @waterbomb_bitmap.fill_rect(0, 2, 2, 4, aqua)
  2371.     @waterbomb_bitmap.fill_rect(2, 0, 4, 2, aqua)
  2372.     @waterbomb_bitmap.fill_rect(6, 2, 2, 2, aqua)
  2373.     @waterbomb_bitmap.fill_rect(2, 6, 2, 2, aqua)
  2374.     @waterbomb_bitmap.fill_rect(6, 4, 2, 2, aqua)
  2375.     @waterbomb_bitmap.fill_rect(4, 6, 2, 2, aqua)
  2376.     @waterbomb_bitmap.fill_rect(4, 4, 2, 2, aqua)
  2377.     @waterbomb_bitmap.fill_rect(2, 4, 2, 2, aqua)
  2378.     @waterbomb_bitmap.fill_rect(4, 2, 2, 2, aqua)
  2379.     @waterbomb_bitmap.fill_rect(2, 2, 2, 2, aqua)

  2380.    
  2381.     # Water bombs impact bitmap
  2382.    
  2383.     @waterbomb_impact_bitmap = Bitmap.new(8, 5)
  2384.     @waterbomb_impact_bitmap.fill_rect(1, 0, 6, 1, aqua)
  2385.     @waterbomb_impact_bitmap.fill_rect(1, 4, 6, 1, aqua)
  2386.     @waterbomb_impact_bitmap.fill_rect(0, 1, 1, 3, aqua)
  2387.     @waterbomb_impact_bitmap.fill_rect(7, 1, 1, 3, aqua)
  2388.     @waterbomb_impact_bitmap.set_pixel(1, 0, aqua)
  2389.     @waterbomb_impact_bitmap.set_pixel(0, 1, aqua)
  2390. #-------------------------------------------------------------------------------

  2391.    
  2392.     # Icy bombs bitmap
  2393.    
  2394.     @icybomb_bitmap = Bitmap.new(8, 8)
  2395.     @icybomb_bitmap.fill_rect(0, 2, 2, 4, lightBlue)
  2396.     @icybomb_bitmap.fill_rect(2, 0, 4, 2, lightBlue)
  2397.     @icybomb_bitmap.fill_rect(6, 2, 2, 2, lightBlue)
  2398.     @icybomb_bitmap.fill_rect(2, 6, 2, 2, lightBlue)
  2399.     @icybomb_bitmap.fill_rect(6, 4, 2, 2, lightBlue)
  2400.     @icybomb_bitmap.fill_rect(4, 6, 2, 2, lightBlue)
  2401.     @icybomb_bitmap.fill_rect(4, 4, 2, 2, lightBlue)
  2402.     @icybomb_bitmap.fill_rect(2, 4, 2, 2, lightBlue)
  2403.     @icybomb_bitmap.fill_rect(4, 2, 2, 2, lightBlue)
  2404.     @icybomb_bitmap.fill_rect(2, 2, 2, 2, lightBlue)

  2405.    
  2406.     # Icy bombs impact bitmap
  2407.    
  2408.     @icybomb_impact_bitmap = Bitmap.new(8, 5)
  2409.     @icybomb_impact_bitmap.fill_rect(1, 0, 6, 1, lightBlue)
  2410.     @icybomb_impact_bitmap.fill_rect(1, 4, 6, 1, lightBlue)
  2411.     @icybomb_impact_bitmap.fill_rect(0, 1, 1, 3, lightBlue)
  2412.     @icybomb_impact_bitmap.fill_rect(7, 1, 1, 3, lightBlue)
  2413.     @icybomb_impact_bitmap.set_pixel(1, 0, lightBlue)
  2414.     @icybomb_impact_bitmap.set_pixel(0, 1, lightBlue)
  2415. #-------------------------------------------------------------------------------

  2416.    
  2417.     # Flare bombs bitmap
  2418.    
  2419.     @flarebomb_bitmap = Bitmap.new(8, 8)
  2420.     @flarebomb_bitmap.fill_rect(0, 2, 2, 4, midYellow)
  2421.     @flarebomb_bitmap.fill_rect(2, 0, 4, 2, midYellow)
  2422.     @flarebomb_bitmap.fill_rect(6, 2, 2, 2, midYellow)
  2423.     @flarebomb_bitmap.fill_rect(2, 6, 2, 2, brightOrange)
  2424.     @flarebomb_bitmap.fill_rect(6, 4, 2, 2, brightOrange)
  2425.     @flarebomb_bitmap.fill_rect(4, 6, 2, 2, midYellow)
  2426.     @flarebomb_bitmap.fill_rect(4, 4, 2, 2, brightOrange)
  2427.     @flarebomb_bitmap.fill_rect(2, 4, 2, 2, midYellow)
  2428.     @flarebomb_bitmap.fill_rect(4, 2, 2, 2, midYellow)
  2429.     @flarebomb_bitmap.fill_rect(2, 2, 2, 2, midYellow)

  2430.     # Flare bomb impact bitmap
  2431.    
  2432.     @flarebomb_impact_bitmap = Bitmap.new(8, 5)
  2433.     @flarebomb_impact_bitmap.fill_rect(1, 0, 6, 1, brightOrange)
  2434.     @flarebomb_impact_bitmap.fill_rect(1, 4, 6, 1, brightOrange)
  2435.     @flarebomb_impact_bitmap.fill_rect(0, 1, 1, 3, midYellow)
  2436.     @flarebomb_impact_bitmap.fill_rect(7, 1, 1, 3, midYellow)
  2437.     @flarebomb_impact_bitmap.set_pixel(1, 0, midYellow)
  2438.     @flarebomb_impact_bitmap.set_pixel(0, 1, midYellow)
  2439. #-------------------------------------------------------------------------------

  2440.     # Starburst bitmaps

  2441.     @starburst_bitmaps = []
  2442.    
  2443.     starburst_yellow = Color.new(233, 210, 142, 255)
  2444.     starburst_yellowtwo = Color.new(219, 191, 95, 255)
  2445.     starburst_lightyellow = Color.new(242, 229, 190, 255)
  2446.     starburst_pink = Color.new(241, 185, 187, 255)
  2447.     starburst_red = Color.new(196, 55, 84, 255)
  2448.     starburst_redtwo = Color.new(178, 15, 56, 255)
  2449.     starburst_cyan = Color.new(189, 225, 242, 255)
  2450.     starburst_blue = Color.new(102, 181, 221, 255)
  2451.     starburst_bluetwo = Color.new(5, 88, 168, 255)
  2452.     starburst_lightgreen = Color.new(205, 246, 205, 255)
  2453.     starburst_green = Color.new(88, 221, 89, 255)
  2454.     starburst_greentwo = Color.new(44, 166, 0, 255)
  2455.     starburst_purple = Color.new(216, 197, 255, 255)
  2456.     starburst_violet = Color.new(155, 107, 255, 255)
  2457.     starburst_violettwo = Color.new(71, 0, 222, 255)
  2458.     starburst_lightorange = Color.new(255, 220, 177, 255)
  2459.     starburst_orange = Color.new(255, 180, 85, 255)
  2460.     starburst_orangetwo = Color.new(222, 124, 0, 255)
  2461.    
  2462.     # 1st starburst bitmap
  2463.     @starburst_bitmaps[0] = Bitmap.new(8, 8)
  2464.     @starburst_bitmaps[0].set_pixel(3, 3, starburst_lightyellow)
  2465.    
  2466.     # 2nd starburst bitmap
  2467.     @starburst_bitmaps[1] = Bitmap.new(8, 8)
  2468.     @starburst_bitmaps[1].fill_rect(3, 2, 1, 3, starburst_yellow)
  2469.     @starburst_bitmaps[1].fill_rect(2, 3, 3, 1, starburst_yellow)
  2470.     @starburst_bitmaps[1].set_pixel(3, 3, starburst_lightyellow)
  2471.    
  2472.     # 3rd starburst bitmap
  2473.     @starburst_bitmaps[2] = Bitmap.new(7, 7)
  2474.     @starburst_bitmaps[2].set_pixel(1, 1, starburst_yellow)
  2475.     @starburst_bitmaps[2].set_pixel(5, 1, starburst_yellow)
  2476.     @starburst_bitmaps[2].set_pixel(2, 2, starburst_yellowtwo)
  2477.     @starburst_bitmaps[2].set_pixel(4, 2, starburst_yellow)
  2478.     @starburst_bitmaps[2].set_pixel(3, 3, starburst_lightyellow)
  2479.     @starburst_bitmaps[2].set_pixel(2, 4, starburst_yellowtwo)
  2480.     @starburst_bitmaps[2].set_pixel(4, 4, starburst_yellowtwo)
  2481.     @starburst_bitmaps[2].set_pixel(1, 5, starburst_yellow)
  2482.     @starburst_bitmaps[2].set_pixel(5, 5, starburst_yellow)
  2483.    
  2484.     # 4th starburst bitmap
  2485.     @starburst_bitmaps[3] = Bitmap.new(7, 7)
  2486.     @starburst_bitmaps[3].fill_rect(3, 1, 1, 5, starburst_yellow)
  2487.     @starburst_bitmaps[3].fill_rect(1, 3, 5, 1, starburst_yellowtwo)
  2488.     @starburst_bitmaps[3].fill_rect(3, 2, 1, 3, starburst_yellow)
  2489.     @starburst_bitmaps[3].fill_rect(2, 3, 3, 1, starburst_yellowtwo)
  2490.     @starburst_bitmaps[3].set_pixel(3, 3, starburst_lightyellow)
  2491.    
  2492.     # 5th starburst bitmap
  2493.     @starburst_bitmaps[4] = Bitmap.new(7, 7)
  2494.     @starburst_bitmaps[4].fill_rect(2, 2, 3, 3, starburst_yellow)
  2495.     @starburst_bitmaps[4].fill_rect(3, 2, 1, 3, starburst_yellow)
  2496.     @starburst_bitmaps[4].fill_rect(2, 3, 3, 1, starburst_yellowtwo)
  2497.     @starburst_bitmaps[4].set_pixel(3, 3, starburst_lightyellow)
  2498.     @starburst_bitmaps[4].set_pixel(1, 1, starburst_yellow)
  2499.     @starburst_bitmaps[4].set_pixel(5, 1, starburst_yellow)
  2500.     @starburst_bitmaps[4].set_pixel(1, 5, starburst_yellowtwo)
  2501.     @starburst_bitmaps[4].set_pixel(5, 1, starburst_yellowtwo)
  2502.    
  2503.     # 6th starburst bitmap
  2504.     @starburst_bitmaps[5] = Bitmap.new(8, 8)
  2505.     @starburst_bitmaps[5].fill_rect(3, 2, 1, 3, starburst_yellow)
  2506.     @starburst_bitmaps[5].fill_rect(2, 3, 3, 1, starburst_yellow)
  2507.     @starburst_bitmaps[5].set_pixel(3, 3, starburst_lightyellow)
  2508.    
  2509.     # 7th starburst bitmap
  2510.     @starburst_bitmaps[6] = Bitmap.new(8, 8)
  2511.     @starburst_bitmaps[6].fill_rect(3, 2, 1, 3, starburst_green)
  2512.     @starburst_bitmaps[6].fill_rect(2, 3, 3, 1, starburst_green)
  2513.     @starburst_bitmaps[6].set_pixel(3, 3, starburst_lightgreen)
  2514.    
  2515.     # 8th starburst bitmap
  2516.     @starburst_bitmaps[7] = Bitmap.new(7, 7)
  2517.     @starburst_bitmaps[7].set_pixel(1, 1, starburst_greentwo)
  2518.     @starburst_bitmaps[7].set_pixel(5, 1, starburst_greentwo)
  2519.     @starburst_bitmaps[7].set_pixel(2, 2, starburst_greentwo)
  2520.     @starburst_bitmaps[7].set_pixel(4, 2, starburst_greentwo)
  2521.     @starburst_bitmaps[7].set_pixel(3, 3, starburst_green)
  2522.     @starburst_bitmaps[7].set_pixel(2, 4, starburst_green)
  2523.     @starburst_bitmaps[7].set_pixel(4, 4, starburst_green)
  2524.     @starburst_bitmaps[7].set_pixel(1, 5, starburst_green)
  2525.     @starburst_bitmaps[7].set_pixel(5, 5, starburst_lightgreen)
  2526.    
  2527.     # 9th starburst bitmap
  2528.     @starburst_bitmaps[8] = Bitmap.new(7, 7)
  2529.     @starburst_bitmaps[8].fill_rect(3, 1, 1, 5, starburst_greentwo)
  2530.     @starburst_bitmaps[8].fill_rect(1, 3, 5, 1, starburst_greentwo)
  2531.     @starburst_bitmaps[8].fill_rect(3, 2, 1, 3, starburst_green)
  2532.     @starburst_bitmaps[8].fill_rect(2, 3, 3, 1, starburst_green)
  2533.     @starburst_bitmaps[8].set_pixel(3, 3, starburst_lightgreen)
  2534.         
  2535.     # 10th starburst bitmap
  2536.     @starburst_bitmaps[9] = Bitmap.new(7, 7)
  2537.     @starburst_bitmaps[9].fill_rect(2, 1, 3, 5, starburst_greentwo)
  2538.     @starburst_bitmaps[9].fill_rect(1, 2, 5, 3, starburst_greentwo)
  2539.     @starburst_bitmaps[9].fill_rect(2, 2, 3, 3, starburst_green)
  2540.     @starburst_bitmaps[9].fill_rect(3, 1, 1, 5, starburst_green)
  2541.     @starburst_bitmaps[9].fill_rect(1, 3, 5, 1, starburst_green)
  2542.     @starburst_bitmaps[9].fill_rect(3, 2, 1, 3, starburst_lightgreen)
  2543.     @starburst_bitmaps[9].fill_rect(2, 3, 3, 1, starburst_lightgreen)
  2544.     @starburst_bitmaps[9].set_pixel(3, 3, starburst_lightgreen)
  2545.    
  2546.     # 11en starburst bitmap
  2547.     @starburst_bitmaps[10] = Bitmap.new(7, 7)
  2548.     @starburst_bitmaps[10].fill_rect(2, 2, 3, 3, starburst_greentwo)
  2549.     @starburst_bitmaps[10].fill_rect(3, 2, 1, 3, starburst_greentwo)
  2550.     @starburst_bitmaps[10].fill_rect(2, 3, 3, 1, starburst_green)
  2551.     @starburst_bitmaps[10].set_pixel(3, 3, starburst_lightgreen)
  2552.     @starburst_bitmaps[10].set_pixel(1, 1, starburst_green)
  2553.     @starburst_bitmaps[10].set_pixel(5, 1, starburst_green)
  2554.     @starburst_bitmaps[10].set_pixel(1, 5, starburst_greentwo)
  2555.     @starburst_bitmaps[10].set_pixel(5, 1, starburst_greentwo)
  2556.         
  2557.     # 12en starburst bitmap
  2558.     @starburst_bitmaps[11] = Bitmap.new(8, 8)
  2559.     @starburst_bitmaps[11].fill_rect(3, 2, 1, 3, starburst_green)
  2560.     @starburst_bitmaps[11].fill_rect(2, 3, 3, 1, starburst_green)
  2561.     @starburst_bitmaps[11].set_pixel(3, 3, starburst_lightgreen)
  2562.    
  2563.     # 13en starburst bitmap
  2564.     @starburst_bitmaps[12] = Bitmap.new(8, 8)
  2565.     @starburst_bitmaps[12].fill_rect(3, 2, 1, 3, starburst_blue)
  2566.     @starburst_bitmaps[12].fill_rect(2, 3, 3, 1, starburst_blue)
  2567.     @starburst_bitmaps[12].set_pixel(3, 3, starburst_cyan)
  2568.    
  2569.     # 14en starburst bitmap
  2570.     @starburst_bitmaps[13] = Bitmap.new(7, 7)
  2571.     @starburst_bitmaps[13].set_pixel(1, 1, starburst_bluetwo)
  2572.     @starburst_bitmaps[13].set_pixel(5, 1, starburst_bluetwo)
  2573.     @starburst_bitmaps[13].set_pixel(2, 2, starburst_bluetwo)
  2574.     @starburst_bitmaps[13].set_pixel(4, 2, starburst_bluetwo)
  2575.     @starburst_bitmaps[13].set_pixel(3, 3, starburst_blue)
  2576.     @starburst_bitmaps[13].set_pixel(2, 4, starburst_blue)
  2577.     @starburst_bitmaps[13].set_pixel(4, 4, starburst_blue)
  2578.     @starburst_bitmaps[13].set_pixel(1, 5, starburst_blue)
  2579.     @starburst_bitmaps[13].set_pixel(5, 5, starburst_cyan)
  2580.    
  2581.     # 15en starburst bitmap
  2582.     @starburst_bitmaps[14] = Bitmap.new(7, 7)
  2583.     @starburst_bitmaps[14].fill_rect(3, 1, 1, 5, starburst_bluetwo)
  2584.     @starburst_bitmaps[14].fill_rect(1, 3, 5, 1, starburst_bluetwo)
  2585.     @starburst_bitmaps[14].fill_rect(3, 2, 1, 3, starburst_blue)
  2586.     @starburst_bitmaps[14].fill_rect(2, 3, 3, 1, starburst_blue)
  2587.     @starburst_bitmaps[14].set_pixel(3, 3, starburst_cyan)
  2588.         
  2589.     # 16en starburst bitmap
  2590.     @starburst_bitmaps[15] = Bitmap.new(7, 7)
  2591.     @starburst_bitmaps[15].fill_rect(2, 1, 3, 5, starburst_bluetwo)
  2592.     @starburst_bitmaps[15].fill_rect(1, 2, 5, 3, starburst_bluetwo)
  2593.     @starburst_bitmaps[15].fill_rect(2, 2, 3, 3, starburst_blue)
  2594.     @starburst_bitmaps[15].fill_rect(3, 1, 1, 5, starburst_blue)
  2595.     @starburst_bitmaps[15].fill_rect(1, 3, 5, 1, starburst_blue)
  2596.     @starburst_bitmaps[15].fill_rect(3, 2, 1, 3, starburst_cyan)
  2597.     @starburst_bitmaps[15].fill_rect(2, 3, 3, 1, starburst_cyan)
  2598.     @starburst_bitmaps[15].set_pixel(3, 3, starburst_cyan)
  2599.    
  2600.     # 17en starburst bitmap
  2601.     @starburst_bitmaps[16] = Bitmap.new(8, 8)
  2602.     @starburst_bitmaps[16].fill_rect(3, 2, 1, 3, starburst_blue)
  2603.     @starburst_bitmaps[16].fill_rect(2, 3, 3, 1, starburst_blue)
  2604.     @starburst_bitmaps[16].set_pixel(3, 3, starburst_cyan)
  2605.    
  2606.     # 18en starburst bitmap
  2607.     @starburst_bitmaps[17] = Bitmap.new(8, 8)
  2608.     @starburst_bitmaps[17].fill_rect(3, 2, 1, 3, starburst_violet)
  2609.     @starburst_bitmaps[17].fill_rect(2, 3, 3, 1, starburst_violet)
  2610.     @starburst_bitmaps[17].set_pixel(3, 3, starburst_purple)
  2611.    
  2612.     # 19en starburst bitmap
  2613.     @starburst_bitmaps[18] = Bitmap.new(7, 7)
  2614.     @starburst_bitmaps[18].set_pixel(1, 1, starburst_violettwo)
  2615.     @starburst_bitmaps[18].set_pixel(5, 1, starburst_violettwo)
  2616.     @starburst_bitmaps[18].set_pixel(2, 2, starburst_violettwo)
  2617.     @starburst_bitmaps[18].set_pixel(4, 2, starburst_violettwo)
  2618.     @starburst_bitmaps[18].set_pixel(3, 3, starburst_violet)
  2619.     @starburst_bitmaps[18].set_pixel(2, 4, starburst_violet)
  2620.     @starburst_bitmaps[18].set_pixel(4, 4, starburst_violet)
  2621.     @starburst_bitmaps[18].set_pixel(1, 5, starburst_violet)
  2622.     @starburst_bitmaps[18].set_pixel(5, 5, starburst_purple)
  2623.    
  2624.     # 20y starburst bitmap
  2625.     @starburst_bitmaps[19] = Bitmap.new(7, 7)
  2626.     @starburst_bitmaps[19].fill_rect(3, 1, 1, 5, starburst_violettwo)
  2627.     @starburst_bitmaps[19].fill_rect(1, 3, 5, 1, starburst_violettwo)
  2628.     @starburst_bitmaps[19].fill_rect(3, 2, 1, 3, starburst_violet)
  2629.     @starburst_bitmaps[19].fill_rect(2, 3, 3, 1, starburst_violet)
  2630.     @starburst_bitmaps[19].set_pixel(3, 3, starburst_violet)
  2631.         
  2632.     # 21st starburst bitmap
  2633.     @starburst_bitmaps[20] = Bitmap.new(7, 7)
  2634.     @starburst_bitmaps[20].fill_rect(2, 1, 3, 5, starburst_violettwo)
  2635.     @starburst_bitmaps[20].fill_rect(1, 2, 5, 3, starburst_violettwo)
  2636.     @starburst_bitmaps[20].fill_rect(2, 2, 3, 3, starburst_violet)
  2637.     @starburst_bitmaps[20].fill_rect(3, 1, 1, 5, starburst_violet)
  2638.     @starburst_bitmaps[20].fill_rect(1, 3, 5, 1, starburst_violet)
  2639.     @starburst_bitmaps[20].fill_rect(3, 2, 1, 3, starburst_purple)
  2640.     @starburst_bitmaps[20].fill_rect(2, 3, 3, 1, starburst_purple)
  2641.     @starburst_bitmaps[20].set_pixel(3, 3, starburst_purple)
  2642.    
  2643.     # 22nd starburst bitmap
  2644.     @starburst_bitmaps[21] = Bitmap.new(7, 7)
  2645.     @starburst_bitmaps[21].fill_rect(2, 1, 3, 5, starburst_violet)
  2646.     @starburst_bitmaps[21].fill_rect(1, 2, 5, 3, starburst_violet)
  2647.     @starburst_bitmaps[21].fill_rect(3, 0, 1, 7, starburst_violettwo)
  2648.     @starburst_bitmaps[21].fill_rect(0, 3, 7, 1, starburst_violettwo)
  2649.     @starburst_bitmaps[21].fill_rect(2, 2, 3, 3, starburst_purple)
  2650.     @starburst_bitmaps[21].fill_rect(3, 2, 1, 3, starburst_violet)
  2651.     @starburst_bitmaps[21].fill_rect(2, 3, 3, 1, starburst_violet)
  2652.     @starburst_bitmaps[21].set_pixel(3, 3, starburst_purple)
  2653.    
  2654.     # 23d starburst bitmap
  2655.     @starburst_bitmaps[22] = Bitmap.new(8, 8)
  2656.     @starburst_bitmaps[22].fill_rect(3, 2, 1, 3, starburst_violet)
  2657.     @starburst_bitmaps[22].fill_rect(2, 3, 3, 1, starburst_violet)
  2658.     @starburst_bitmaps[22].set_pixel(3, 3, starburst_purple)
  2659.    
  2660.     # 24th starburst bitmap
  2661.     @starburst_bitmaps[23] = Bitmap.new(8, 8)
  2662.     @starburst_bitmaps[23].fill_rect(3, 2, 1, 3, starburst_red)
  2663.     @starburst_bitmaps[23].fill_rect(2, 3, 3, 1, starburst_red)
  2664.     @starburst_bitmaps[23].set_pixel(3, 3, starburst_pink)
  2665.    
  2666.     # 25th starburst bitmap
  2667.     @starburst_bitmaps[24] = Bitmap.new(7, 7)
  2668.     @starburst_bitmaps[24].set_pixel(1, 1, starburst_redtwo)
  2669.     @starburst_bitmaps[24].set_pixel(5, 1, starburst_redtwo)
  2670.     @starburst_bitmaps[24].set_pixel(2, 2, starburst_redtwo)
  2671.     @starburst_bitmaps[24].set_pixel(4, 2, starburst_redtwo)
  2672.     @starburst_bitmaps[24].set_pixel(3, 3, starburst_red)
  2673.     @starburst_bitmaps[24].set_pixel(2, 4, starburst_red)
  2674.     @starburst_bitmaps[24].set_pixel(4, 4, starburst_red)
  2675.     @starburst_bitmaps[24].set_pixel(1, 5, starburst_red)
  2676.     @starburst_bitmaps[24].set_pixel(5, 5, starburst_pink)
  2677.    
  2678.     # 26th starburst bitmap
  2679.     @starburst_bitmaps[25] = Bitmap.new(7, 7)
  2680.     @starburst_bitmaps[25].fill_rect(3, 1, 1, 5, starburst_redtwo)
  2681.     @starburst_bitmaps[25].fill_rect(1, 3, 5, 1, starburst_redtwo)
  2682.     @starburst_bitmaps[25].fill_rect(3, 2, 1, 3, starburst_red)
  2683.     @starburst_bitmaps[25].fill_rect(2, 3, 3, 1, starburst_red)
  2684.     @starburst_bitmaps[25].set_pixel(3, 3, starburst_pink)
  2685.         
  2686.     # 27th starburst bitmap
  2687.     @starburst_bitmaps[26] = Bitmap.new(7, 7)
  2688.     @starburst_bitmaps[26].fill_rect(2, 1, 3, 5, starburst_redtwo)
  2689.     @starburst_bitmaps[26].fill_rect(1, 2, 5, 3, starburst_redtwo)
  2690.     @starburst_bitmaps[26].fill_rect(2, 2, 3, 3, starburst_red)
  2691.     @starburst_bitmaps[26].fill_rect(3, 1, 1, 5, starburst_red)
  2692.     @starburst_bitmaps[26].fill_rect(1, 3, 5, 1, starburst_red)
  2693.     @starburst_bitmaps[26].fill_rect(3, 2, 1, 3, starburst_pink)
  2694.     @starburst_bitmaps[26].fill_rect(2, 3, 3, 1, starburst_pink)
  2695.     @starburst_bitmaps[26].set_pixel(3, 3, starburst_pink)
  2696.    
  2697.     # 28th starburst bitmap
  2698.     @starburst_bitmaps[27] = Bitmap.new(7, 7)
  2699.     @starburst_bitmaps[27].fill_rect(2, 1, 3, 5, starburst_red)
  2700.     @starburst_bitmaps[27].fill_rect(1, 2, 5, 3, starburst_red)
  2701.     @starburst_bitmaps[27].fill_rect(3, 0, 1, 7, starburst_redtwo)
  2702.     @starburst_bitmaps[27].fill_rect(0, 3, 7, 1, starburst_redtwo)
  2703.     @starburst_bitmaps[27].fill_rect(2, 2, 3, 3, starburst_pink)
  2704.     @starburst_bitmaps[27].fill_rect(3, 2, 1, 3, starburst_red)
  2705.     @starburst_bitmaps[27].fill_rect(2, 3, 3, 1, starburst_red)
  2706.     @starburst_bitmaps[27].set_pixel(3, 3, starburst_pink)
  2707.    
  2708.     # 29th starburst bitmap
  2709.     @starburst_bitmaps[28] = Bitmap.new(8, 8)
  2710.     @starburst_bitmaps[28].fill_rect(3, 2, 1, 3, starburst_red)
  2711.     @starburst_bitmaps[28].fill_rect(2, 3, 3, 1, starburst_red)
  2712.     @starburst_bitmaps[28].set_pixel(3, 3, starburst_pink)
  2713.    
  2714.     # 30y starburst bitmap
  2715.     @starburst_bitmaps[29] = Bitmap.new(8, 8)
  2716.     @starburst_bitmaps[29].fill_rect(3, 2, 1, 3, starburst_orange)
  2717.     @starburst_bitmaps[29].fill_rect(2, 3, 3, 1, starburst_orange)
  2718.     @starburst_bitmaps[29].set_pixel(3, 3, starburst_lightorange)
  2719.    
  2720.     # 31st starburst bitmap
  2721.     @starburst_bitmaps[30] = Bitmap.new(7, 7)
  2722.     @starburst_bitmaps[30].set_pixel(1, 1, starburst_orangetwo)
  2723.     @starburst_bitmaps[30].set_pixel(5, 1, starburst_orangetwo)
  2724.     @starburst_bitmaps[30].set_pixel(2, 2, starburst_orangetwo)
  2725.     @starburst_bitmaps[30].set_pixel(4, 2, starburst_orangetwo)
  2726.     @starburst_bitmaps[30].set_pixel(3, 3, starburst_orange)
  2727.     @starburst_bitmaps[30].set_pixel(2, 4, starburst_orange)
  2728.     @starburst_bitmaps[30].set_pixel(4, 4, starburst_orange)
  2729.     @starburst_bitmaps[30].set_pixel(1, 5, starburst_orange)
  2730.     @starburst_bitmaps[30].set_pixel(5, 5, starburst_lightorange)
  2731.    
  2732.     # 32nd starburst bitmap
  2733.     @starburst_bitmaps[31] = Bitmap.new(7, 7)
  2734.     @starburst_bitmaps[31].fill_rect(3, 1, 1, 5, starburst_orangetwo)
  2735.     @starburst_bitmaps[31].fill_rect(1, 3, 5, 1, starburst_orangetwo)
  2736.     @starburst_bitmaps[31].fill_rect(3, 2, 1, 3, starburst_orange)
  2737.     @starburst_bitmaps[31].fill_rect(2, 3, 3, 1, starburst_orange)
  2738.     @starburst_bitmaps[31].set_pixel(3, 3, starburst_lightorange)
  2739.         
  2740.     # 33d starburst bitmap
  2741.     @starburst_bitmaps[32] = Bitmap.new(7, 7)
  2742.     @starburst_bitmaps[32].fill_rect(2, 1, 3, 5, starburst_orangetwo)
  2743.     @starburst_bitmaps[32].fill_rect(1, 2, 5, 3, starburst_orangetwo)
  2744.     @starburst_bitmaps[32].fill_rect(2, 2, 3, 3, starburst_orange)
  2745.     @starburst_bitmaps[32].fill_rect(3, 1, 1, 5, starburst_orange)
  2746.     @starburst_bitmaps[32].fill_rect(1, 3, 5, 1, starburst_orange)
  2747.     @starburst_bitmaps[32].fill_rect(3, 2, 1, 3, starburst_lightorange)
  2748.     @starburst_bitmaps[32].fill_rect(2, 3, 3, 1, starburst_lightorange)
  2749.     @starburst_bitmaps[32].set_pixel(3, 3, starburst_lightorange)
  2750.    
  2751.     # 34th starburst bitmap
  2752.     @starburst_bitmaps[33] = Bitmap.new(7, 7)
  2753.     @starburst_bitmaps[33].fill_rect(2, 1, 3, 5, starburst_orange)
  2754.     @starburst_bitmaps[33].fill_rect(1, 2, 5, 3, starburst_orange)
  2755.     @starburst_bitmaps[33].fill_rect(3, 0, 1, 7, starburst_orangetwo)
  2756.     @starburst_bitmaps[33].fill_rect(0, 3, 7, 1, starburst_orangetwo)
  2757.     @starburst_bitmaps[33].fill_rect(2, 2, 3, 3, starburst_lightorange)
  2758.     @starburst_bitmaps[33].fill_rect(3, 2, 1, 3, starburst_orange)
  2759.     @starburst_bitmaps[33].fill_rect(2, 3, 3, 1, starburst_orange)
  2760.     @starburst_bitmaps[33].set_pixel(3, 3, starburst_lightorange)
  2761.    
  2762.     # 35th starburst bitmap
  2763.     @starburst_bitmaps[34] = Bitmap.new(8, 8)
  2764.     @starburst_bitmaps[34].fill_rect(3, 2, 1, 3, starburst_orange)
  2765.     @starburst_bitmaps[34].fill_rect(2, 3, 3, 1, starburst_orange)
  2766.     @starburst_bitmaps[34].set_pixel(3, 3, starburst_lightorange)
  2767.    
  2768.     # 36th starburst bitmap
  2769.     @starburst_bitmaps[35] = Bitmap.new(8, 8)
  2770.     @starburst_bitmaps[35].set_pixel(3, 3, starburst_lightorange)   
  2771. #-------------------------------------------------------------------------------      
  2772.     @monostarburst_bitmaps = []
  2773.    
  2774.     # 1st starburst bitmap
  2775.     @monostarburst_bitmaps[0] = Bitmap.new(8, 8)
  2776.     @monostarburst_bitmaps[0].set_pixel(3, 3, starburst_lightyellow)
  2777.    
  2778.     # 2nd starburst bitmap
  2779.     @monostarburst_bitmaps[1] = Bitmap.new(8, 8)
  2780.     @monostarburst_bitmaps[1].fill_rect(3, 2, 1, 3, starburst_yellow)
  2781.     @monostarburst_bitmaps[1].fill_rect(2, 3, 3, 1, starburst_yellow)
  2782.     @monostarburst_bitmaps[1].set_pixel(3, 3, starburst_lightyellow)
  2783.    
  2784.     # 3d starburst bitmap
  2785.     @monostarburst_bitmaps[2] = Bitmap.new(7, 7)
  2786.     @monostarburst_bitmaps[2].set_pixel(1, 1, starburst_yellowtwo)
  2787.     @monostarburst_bitmaps[2].set_pixel(5, 1, starburst_yellowtwo)
  2788.     @monostarburst_bitmaps[2].set_pixel(2, 2, starburst_yellowtwo)
  2789.     @monostarburst_bitmaps[2].set_pixel(4, 2, starburst_yellowtwo)
  2790.     @monostarburst_bitmaps[2].set_pixel(3, 3, starburst_yellow)
  2791.     @monostarburst_bitmaps[2].set_pixel(2, 4, starburst_yellow)
  2792.     @monostarburst_bitmaps[2].set_pixel(4, 4, starburst_yellow)
  2793.     @monostarburst_bitmaps[2].set_pixel(1, 5, starburst_yellow)
  2794.     @monostarburst_bitmaps[2].set_pixel(5, 5, starburst_lightyellow)
  2795.    
  2796.     # 4th starburst bitmap
  2797.     @monostarburst_bitmaps[3] = Bitmap.new(7, 7)
  2798.     @monostarburst_bitmaps[3].fill_rect(3, 1, 1, 5, starburst_yellowtwo)
  2799.     @monostarburst_bitmaps[3].fill_rect(1, 3, 5, 1, starburst_yellowtwo)
  2800.     @monostarburst_bitmaps[3].fill_rect(3, 2, 1, 3, starburst_yellow)
  2801.     @monostarburst_bitmaps[3].fill_rect(2, 3, 3, 1, starburst_yellow)
  2802.     @monostarburst_bitmaps[3].set_pixel(3, 3, starburst_lightyellow)
  2803.         
  2804.     # 5th starburst bitmap
  2805.     @monostarburst_bitmaps[4] = Bitmap.new(7, 7)
  2806.     @monostarburst_bitmaps[4].fill_rect(2, 1, 3, 5, starburst_yellowtwo)
  2807.     @monostarburst_bitmaps[4].fill_rect(1, 2, 5, 3, starburst_yellowtwo)
  2808.     @monostarburst_bitmaps[4].fill_rect(2, 2, 3, 3, starburst_yellow)
  2809.     @monostarburst_bitmaps[4].fill_rect(3, 1, 1, 5, starburst_yellow)
  2810.     @monostarburst_bitmaps[4].fill_rect(1, 3, 5, 1, starburst_yellow)
  2811.     @monostarburst_bitmaps[4].fill_rect(3, 2, 1, 3, starburst_lightyellow)
  2812.     @monostarburst_bitmaps[4].fill_rect(2, 3, 3, 1, starburst_lightyellow)
  2813.     @monostarburst_bitmaps[4].set_pixel(3, 3, starburst_lightyellow)
  2814.    
  2815.     # 6th starburst bitmap
  2816.     @monostarburst_bitmaps[5] = Bitmap.new(7, 7)
  2817.     @monostarburst_bitmaps[5].fill_rect(2, 1, 3, 5, starburst_yellow)
  2818.     @monostarburst_bitmaps[5].fill_rect(1, 2, 5, 3, starburst_yellow)
  2819.     @monostarburst_bitmaps[5].fill_rect(3, 0, 1, 7, starburst_yellowtwo)
  2820.     @monostarburst_bitmaps[5].fill_rect(0, 3, 7, 1, starburst_yellowtwo)
  2821.     @monostarburst_bitmaps[5].fill_rect(2, 2, 3, 3, starburst_lightyellow)
  2822.     @monostarburst_bitmaps[5].fill_rect(3, 2, 1, 3, starburst_yellow)
  2823.     @monostarburst_bitmaps[5].fill_rect(2, 3, 3, 1, starburst_yellow)
  2824.     @monostarburst_bitmaps[5].set_pixel(3, 3, starburst_lightyellow)
  2825.    
  2826.     # 7th starburst bitmap
  2827.     @monostarburst_bitmaps[6] = Bitmap.new(8, 8)
  2828.     @monostarburst_bitmaps[6].fill_rect(3, 2, 1, 3, starburst_yellow)
  2829.     @monostarburst_bitmaps[6].fill_rect(2, 3, 3, 1, starburst_yellow)
  2830.     @monostarburst_bitmaps[6].set_pixel(3, 3, starburst_lightyellow)
  2831.    
  2832.     # 8th starburst bitmap
  2833.     @monostarburst_bitmaps[7] = Bitmap.new(8, 8)
  2834.     @monostarburst_bitmaps[7].set_pixel(3, 3, starburst_lightyellow)
  2835. #-------------------------------------------------------------------------------   
  2836.    
  2837.     @user_bitmaps = []
  2838.     update_user_defined
  2839.   end
  2840.   
  2841.   def update_user_defined
  2842.     for image in @user_bitmaps
  2843.       image.dispose
  2844.     end
  2845.    
  2846.     #user-defined bitmaps
  2847.     for name in $WEATHER_IMAGES
  2848.       @user_bitmaps.push(RPG::Cache.picture(name))
  2849.     end
  2850.     for sprite in @sprites
  2851.       sprite.bitmap = @user_bitmaps[rand(@user_bitmaps.size)]
  2852.     end
  2853.   end
  2854. end

  2855. class Scene_Map
  2856.   def change_weather
  2857.     @spriteset.change_weather  
  2858.   end
  2859. end

  2860. class Spriteset_Map
  2861.   attr_accessor :change_weather
  2862. end
复制代码


战斗天气:与上面那个能完美融合哦
  1. =begin
  2.       RGSS3
  3.       
  4.       ★ 戦闘内天候持ち越し ★

  5.       天候を戦闘にも反映させます。
  6.       
  7.       ver1.00

  8.       Last Update : 2011/12/17
  9.       12/17 : RGSS2からの移植
  10.       
  11.       ろかん   [url]http://kaisou-ryouiki.sakura.ne.jp/[/url]
  12. =end

  13. #===================================
  14. #  ●設定箇所
  15. #===================================
  16. module BattleWeather
  17.   # 戦闘中に天候が変更された場合、戦闘後のマップにも反映させるかどうか
  18.   BCEMW = true
  19. end
  20. #===================================
  21. #  ここまで
  22. #===================================

  23. $rsi ||= {}
  24. $rsi["戦闘内天候持ち越し"] = true

  25. class Game_Screen
  26.   #--------------------------------------------------------------------------
  27.   # ● 公開インスタンス変数
  28.   #--------------------------------------------------------------------------
  29.   attr_writer   :weather_type
  30.   attr_writer   :weather_power
  31. end

  32. class Game_Interpreter
  33.   #--------------------------------------------------------------------------
  34.   # ● 天候の設定   ※再定義
  35.   #--------------------------------------------------------------------------
  36.   def command_236
  37.     screen.change_weather(@params[0], @params[1], @params[2])
  38.     wait(@params[2]) if @params[3]
  39.   end
  40. end

  41. class Spriteset_Battle
  42.   #--------------------------------------------------------------------------
  43.   # ● インクルード BattleWeather
  44.   #--------------------------------------------------------------------------
  45.   include BattleWeather
  46.   #--------------------------------------------------------------------------
  47.   # ● オブジェクト初期化
  48.   #--------------------------------------------------------------------------
  49.   alias battle_weather_initialize initialize
  50.   def initialize
  51.     battle_weather_initialize
  52.     create_weather
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ● 天候の作成
  56.   #--------------------------------------------------------------------------
  57.   def create_weather
  58.     $game_troop.screen.weather_type = $game_map.screen.weather_type
  59.     $game_troop.screen.weather_power = $game_map.screen.weather_power
  60.     @weather = Spriteset_Weather.new(@viewport2)
  61.     @weather.update
  62.     Graphics.update
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # ● 解放
  66.   #--------------------------------------------------------------------------
  67.   alias battle_weather_dispose dispose
  68.   def dispose
  69.     if BCEMW
  70.       $game_map.screen.weather_type = @weather.type
  71.       $game_map.screen.weather_power = @weather.power
  72.     end
  73.     dispose_weather
  74.     battle_weather_dispose
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● 天候の解放
  78.   #--------------------------------------------------------------------------
  79.   def dispose_weather
  80.     @weather.dispose
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● フレーム更新
  84.   #--------------------------------------------------------------------------
  85.   alias update_battle_weather update
  86.   def update
  87.     update_battle_weather
  88.     update_weather
  89.   end
  90.   #--------------------------------------------------------------------------
  91.   # ● 天候の更新
  92.   #--------------------------------------------------------------------------
  93.   def update_weather
  94.     if @weather
  95.       @weather.type = $game_troop.screen.weather_type
  96.       @weather.power = $game_troop.screen.weather_power
  97.       @weather.update
  98.     end
  99.   end
  100. end
复制代码


状态信息

  1. # ステ―ト詳細確認ウィンドウ
  2. #
  3. # 戦闘時、パーティコマンドに付与されているステートの詳細を確認するためのコマンド
  4. # を追加します。

  5. $imported_yana_scripts ||= {}
  6. $imported_yana_scripts["StateHelpWindow"] = true

  7. module StateHelp
  8.   Buffs = {}
  9.   States = []
  10.   
  11. # 请按照下面的描写进行备注

  12.   Buffs[[0,:up]] = "HP+25%,最高5级\n持续5回合"
  13.   Buffs[[1,:up]] = "MP+25%,最高5级\n持续5回合"
  14.   Buffs[[2,:up]] = "物攻+25%,最高5级\n持续5回合"
  15.   Buffs[[3,:up]] = "物防+25%,最高5级\n持续5回合"
  16.   Buffs[[4,:up]] = "魔攻+25%,最高5级\n持续5回合"
  17.   Buffs[[5,:up]] = "魔防+25%,最高5级\n持续5回合"
  18.   Buffs[[6,:up]] = "敏捷+25%,最高5级\n持续5回合"
  19.   Buffs[[7,:up]] = "幸运+25%,最高5级\n持续5回合"
  20.   
  21.   Buffs[[0,:down]] = "HP-25%,最高5级\n持续5回合"
  22.   Buffs[[1,:down]] = "MP-25%,最高5级\n持续5回合"
  23.   Buffs[[2,:down]] = "物攻-25%,最高5级\n持续5回合"
  24.   Buffs[[3,:down]] = "物防-25%,最高5级\n持续5回合"
  25.   Buffs[[4,:down]] = "魔攻-25%,最高5级\n持续5回合"
  26.   Buffs[[5,:down]] = "魔防-25%,最高5级\n持续5回合"
  27.   Buffs[[6,:down]] = "敏捷-25%,最高5级\n持续5回合"
  28.   Buffs[[7,:down]] = "幸运-25%,最高5级\n持续5回合"

  29.   States[1]  = "无法战斗:死亡。"
  30.   States[2]  = "毒:生命再生-10%\n永续。"
  31.   States[3]  = "致盲:物理命中率-60%\n2~4回合。"
  32.   States[4]  = "沉默:无法使用技能\n2~3回合。"
  33.   States[5]  = "混乱:会攻击双方人物\n2~4回合。"
  34.   States[6]  = "睡眠:无法使用法术技能受到伤害立刻解除\n3~5回合。"
  35.   States[7]  = "麻痹:无法行动,不会闪避任何伤害30%解除\n4~6回合。"
  36.   States[8]  = "眩晕:无法行动,20%解除\n1~2回合。"
  37.   States[53]  = "秘剑:(被动技能)\n技能增加全属性值,减少伤害比例。永续。"
  38.   States[14]  = "体力再生:每回合回复5%体力值\n2回合。"
  39.   States[15]  = "魔力再生:每回合回复5%魔力值\n2回合。"
  40.   States[16]  = "特技再生:每回合回复5%特技值\n2回合。"
  41.   States[24]  = "免疫异常:免疫所有异常状态\n5回合。"
  42.   States[26]  = "月读:攻击附加多种异常状态\n2回合。"
  43.   States[25]  = "魔法回路:减少魔法消耗\n5回合。"
  44.   States[28]  = "雷电天牢:无法行动,每回合减少2%HP\n2回合。"
  45.   States[29]  = "血继限界:(被动技能)\n增加属性百分比,受到伤害反射中毒。永续。"
  46.   States[51]  = "禁锢:无法行动\n2回合。"
  47.   States[52]  = "压制:无法行动,全属性降低5%\n2回合。"
  48.   States[35]  = "仙人模式:增加2%HP MP 攻击 魔攻 防御 特防和5%再生率\n3-5回合。"
  49.   States[45]  = "焚烧:每回合扣除1%HP MP\n2-5回合。"
  50.   States[56]  = "石化:无法行动,增加被伤害值60%减少闪避率20%一定几率解除。\n2-4回合。"
  51.   States[57]  = "永恒睡眠:无法行动,增加150%防御特防和生命上限,增加再生率10%\n4回合。"
  52.   States[59]  = "失魂:无法使用任何类型的技能\n2回合。"
  53.   States[50]  = "王之宝库:增加2次普攻,每次普攻几率附加天之锁状态\n永续。"
  54.   States[48]  = "Gate of Babylon:增加一次普攻,25%增加一次行动\n永续。"
  55.   States[37]  = "仙人屏障:(被动技能)\n增加再生率,增加闪避率和反射率。永续。"
  56.   States[47]  = "圣灵:(被动技能)\n增加20%的攻击魔攻防御特防。永续。"
  57.   States[18]  = "魔法闪避:增加80%魔法闪避\n3回合。"
  58.   States[19]  = "魔法反射:增加80%魔法反射\n3回合。"
  59.   States[60]  = "技能延迟:释放延迟类技能会出现的1回合行动后解除\n1回合。"
  60.   States[58]  = "仙法*天牢:无法行动,每回合减少3%HP\n2-4回合。"
  61.   States[61]  = "无限月读:无法行动,减少全属性20%受到攻击10%会解除或等到6回合后。"
  62.   States[62]  = "神眼:(被动技能)增加暴击率和命中率10%减少魔法消耗20%并减少自身伤害\n永续。"
  63.   States[63]  = "虚弱:减少所有属性20%\n2回合。"
  64.   States[64]  = "连射模式:增加自身攻击次数2次,同时攻击会附加剧毒\n2回合。"
  65.   States[65]  = "神鹰之眼:被动技能:增加暴击率和攻击力15%。命中率30%\n每回合提供5能量暴击造成150%伤害。"
  66.   States[66]  = "免伤:获得减免伤害30%\n1回合。"
  67.   States[67]  = "轮回血印吸收:获得伤害吸收\n1回合。"
  68.   States[68]  = "仙法*轮回之力:大大提高自身的能力。"
  69.   States[69]  = "仙法*反印结:(被动技能)提高伤害反射10%\n永续。"
  70.   States[70]  = "灵魂掌控:(被动技能)提高免疫异常的能力\n永续。"
  71.   States[71]  = "魔法盾术:可以将法力来挡伤害。\n 1MP吸收15比率为50%。"
  72.   States[72]  = "阴之力:大幅度增加双抗,回血回蓝,免疫异常。\n3回合。"
  73.   States[73]  = "阳之力:大幅度增加双攻,增加暴击率,普攻附带虚弱。\n3回合。"
  74.   States[74]  = "免死:免疫死亡。\n1-2回合。"
  75.   States[75]  = "火系附加:攻击附加火属性。\n永续。"
  76.   States[76]  = "冰系附加:攻击附加冰属性。\n永续。"
  77.   States[77]  = "雷系附加:攻击附加雷属性。\n永续。"
  78.   States[78]  = "土系附加:攻击附加土属性。\n永续。"
  79.   States[79]  = "风系附加:攻击附加风属性。\n永续。"
  80.   States[80]  = "时空结界:暂停时间。\n3回合。"
  81.   States[80]  = "时空结界:暂停时间。\n3回合。"
  82.   States[81]  = "圣之时空:增加双抗10%并且增加治疗效果\n每次自己对队友(包括自己使用技能目标回血0-150)"
  83.   States[82]  = "魔之时空:增加双闪避,反击率10%,暴击率30%每回合扣除2%血量\n新被动:每次攻击敌人伤害增加30%+敏捷*2"
  84.   States[83]  = "时空人格变数:攻击附加各种非停止行动的状态。\n永续。"
  85.   States[84]  = "时空暂停:暂停时间。\n1-2回合。"
  86.   States[85]  = "时空倒流:死亡后直接复活。\n3回合。"
  87.   States[86]  = "燃烧时空盾:减少30%,减免蓝的10%伤害并且反射。\n3回合。"
  88.   States[87]  = "时空连接:将伤害连接,可以传达伤害。\n3回合。"
  89.   States[88]  = "被链接:将积蓄的伤害20%传达给这个单位。\n3回合。"
  90.   States[89]  = "永生本能:减少0-70%的伤害,危急生命每次扣血会回复血量。\n被动技能。"
  91.   States[90]  = "灼热之痕:减少命中、闪避、必杀率5%。\n2回合。"
  92.   States[91]  = "金:攻击附加敏捷*3的伤害。\n增加10%MP上限。"
  93.   States[92]  = "木:每次伤害回血。\n增加5%敏捷。"
  94.   States[93]  = "水:每次伤害回蓝。\n增加10%MP上限。"
  95.   States[94]  = "火:每次伤害附加双攻的伤害*2。\n增加双攻10%。"
  96.   States[95]  = "土:减少伤害,反射防御力*2的伤害。\n增加双抗10%。"
  97.   States[96]  = "反馈:受到伤害在回合结束时,给对方给予一定伤害。"
  98.   States[97]  = "嗜血收割:伤害增加1.5倍,提高80%双攻。\n2回合"
  99.   States[98]  = "狩猎打击:每回合扣血伤害值。\n2回合"
  100.   States[99]  = "强弩之翼攻击:增加攻击+敏捷的伤害。"
  101.   States[100]  = "强弩之翼防御:减少伤害,反射敏捷*2+防御*2的伤害。"
  102.   States[101]  = "强狙速影:攻击 敏捷 物抗提高30%。"
  103.   States[102]  = "空间回溯:2次行动后回复到之前的回血。"
  104.   States[103]  = "影杀:技能必定暴击"
  105.   States[104]  = "时空穿梭:10%几率行动两次,5%几率行动三次"
  106.   States[115]  = "灵魂掌控:减少强控几率30%"
  107.   States[116]  = "缭乱写轮眼:暴击+10%免伤+20%魔法消耗-20%命中+10%\n法强+50%物攻+50%法抗+50%"
  108.   States[117]  = "秘境之眼:多行动一次,暴击+20%命中+20%"
  109.   States[118]  = "光明降生:每回合回血300回蓝100"
  110.   States[125]  = "空间折叠:必杀闪避,物理闪避,魔法闪避+10%\n3回合内每回合回复50+0-200血量"
  111.   States[126]  = "空间结界:免疫基础强控"
  112.   States[127]  = "幻术*魔镜幻巷:15%多行动一次,免疫剧毒沉默睡眠焚烧"
  113.   States[132]  = "六道之力:增加物品掉落几率和金币双倍\n增加恢复能力,每次攻击随机获得三回治疗"
  114.   States[133]  = "混沌之力:攻击附加双方全属性"
  115.   States[134]  = "时空掌握:附加15%暴击率和命中率,5%反射力"
  116.   States[135]  = "时空混乱:每回合扣除全属性的血量"
  117.   


  118. end

  119. class Game_BattlerBase
  120.   attr_reader :buffs
  121. end

  122. class Window_State < Window_Selectable
  123.   def initialize(help_window)
  124.     super(0,0,32,32)
  125. #~     self.x = [Graphics.width / 2 - self.width / 2,0].max
  126. #~     self.y = [Graphics.height / 2 - self.height / 2,help_window.height].max
  127.     self.openness = 0
  128.     @help_window = help_window
  129.     refresh
  130.   end
  131.   def all_battle_members;($game_party.battle_members + $game_troop.members).select{|m| m.exist? };end
  132.   def row_max;all_battle_members.size;end
  133.   def col_max
  134.     m = all_battle_members.max_by{|a| a.state_icons.size + a.buff_icons.size }
  135.     [m.state_icons.size + m.buff_icons.size,1].max
  136.   end
  137.   def item_max;row_max*col_max;end
  138.   def item_height; line_height + 2 ; end
  139.   def item_width; line_height + 2 ; end
  140.    
  141.   def fitting_window
  142.     self.height = item_height * row_max + standard_padding*2
  143.     self.width = 144+(col_max*item_width) + standard_padding*2
  144.     self.x = [Graphics.width / 2 - self.width / 2,0].max
  145.     self.y = [Graphics.height / 2 - self.height / 2,help_window.height].max
  146.   end
  147.   def refresh
  148.     fitting_window
  149.     make_data
  150.     create_contents
  151.     all_battle_members.each_with_index{|a,i|
  152.       draw_actor_name(a,0,i*item_height+1)
  153.       draw_text(128,i*item_height+1,20,line_height,":")
  154.       draw_icons(a, 144, i*item_height+1, contents.width - 144)
  155.     }
  156.   end
  157.   
  158.   def draw_icons(subject, x, y, width = 96)
  159.     icons = (subject.state_icons + subject.buff_icons)[0, width / item_width]
  160.     icons.each_with_index {|n, i| draw_icon(n, x + item_width * i, y) }
  161.   end
  162.   
  163.   def item_rect(index)
  164.     rect = Rect.new
  165.     rect.width = item_width
  166.     rect.height = item_height
  167.     rect.x = index % col_max * item_width + 143
  168.     rect.y = index / col_max * item_height
  169.     rect
  170.   end
  171.   
  172.   def update_help
  173.     @help_window.set_text(description)
  174.   end
  175.   
  176.   def make_data
  177.     @data = all_battle_members.inject([]){|r,m|
  178.       a = []
  179.       a += m.states.select{|st| st.icon_index != 0 }
  180.       bf = []
  181.       m.buffs.each_with_index{|b,i| bf.push([i,b > 0 ? :up : :down]) if b != 0}
  182.       a += bf
  183.       a += Array.new(col_max - a.size){nil} if col_max > a.size
  184.       r += a
  185.     }
  186.   end
  187.   
  188.   def description
  189.     return "" unless @data[index]
  190.     if @data[index].is_a?(Array)
  191.       return StateHelp::Buffs[@data[index]]
  192.     else
  193.       return StateHelp::States[@data[index].id]
  194.     end
  195.   end
  196.   def cursor_down(wrap = false)
  197.     return if @data.compact.empty?
  198.     loop do
  199.       select((index + col_max) % item_max)
  200.       break if @data[index]
  201.     end
  202.   end
  203.   def cursor_up(wrap = false)
  204.     return if @data.compact.empty?
  205.     loop do
  206.       select((index - col_max + item_max) % item_max)
  207.       break if @data[index]
  208.     end
  209.   end
  210.   def cursor_right(wrap = false)
  211.     return if @data.compact.empty?
  212.     loop do
  213.       select((index + 1) % item_max)
  214.       break if @data[index]
  215.     end
  216.   end
  217.   def cursor_left(wrap = false)
  218.     return if @data.compact.empty?
  219.     loop do
  220.       select((index - 1 + item_max) % item_max)
  221.       break if @data[index]
  222.     end
  223.   end
  224.   def smooth_select
  225.     return select(0) if @data.compact.empty?
  226.     @data.each_with_index{|d,i|
  227.       if d
  228.         select(i)
  229.         return
  230.       end
  231.     }
  232.   end
  233. end

  234. class Window_PartyCommand < Window_Command
  235.   alias _ex_state_make_command_list make_command_list
  236.   def make_command_list
  237.     _ex_state_make_command_list
  238.     add_command("状态信息",  :state)
  239.   end
  240. end

  241. class Scene_Battle < Scene_Base
  242.   alias _ex_state_create_all_windows create_all_windows
  243.   def create_all_windows
  244.     _ex_state_create_all_windows
  245.     create_state_window
  246.   end
  247.   alias _ex_state_create_party_command_window create_party_command_window
  248.   def create_party_command_window
  249.     _ex_state_create_party_command_window
  250.     @party_command_window.set_handler(:state, method(:command_state))
  251.   end

  252.   def create_state_window
  253.     @state_window = Window_State.new(@help_window)
  254.     @state_window.set_handler(:ok,  method(:command_state_cancel))
  255.     @state_window.set_handler(:cancel, method(:command_state_cancel))
  256.     @state_window.unselect
  257.   end
  258.   
  259.   def command_state
  260.     @party_command_window.deactivate
  261.     @state_window.refresh
  262.     @state_window.open.activate.smooth_select
  263.     @help_window.show
  264.   end
  265.   
  266.   def command_state_cancel
  267.     @state_window.deactivate.close.unselect
  268.     @party_command_window.activate
  269.     @help_window.hide
  270.   end
  271. end
复制代码


随机技能
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Random Skill Invoke v1.00
  4. # -- Last Updated: 2011.12.17
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-RandomSkillInvoke"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2011.12.17 - Started Script and Finished.
  15. #
  16. #==============================================================================
  17. # ▼ Introduction
  18. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  19. # This script grants the option, that when designated skills with random
  20. # invokes are used, they have the ability to result in other skills (within the
  21. # skill's designated random pool). Only valid skills are capable of being used
  22. # (meaning that they must meet the conditions to be used).
  23. #
  24. #==============================================================================
  25. # ▼ Instructions
  26. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  27. # To install this script, open up your script editor and copy/paste this script
  28. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  29. #
  30. # -----------------------------------------------------------------------------
  31. # Skill Notetags - These notetags go in the skills notebox in the database.
  32. # -----------------------------------------------------------------------------
  33. # <random invoke: x>举个例子比如在1号技能上备注<random invoke: 2>代表你使用1号技能可能会放1号技能或者2号技能
  34. # <random invoke: x, x>
  35. # This adds skill x to the random invoke pool (which includes the base skill
  36. # itself, too). When the base skill is used, it will random select from all of
  37. # the skills within the random invoke pool and use one. Only skills that meet
  38. # the requirements of being used can be selected (meaning the battler must have
  39. # sufficient MP costs, TP costs, no states that seal it, etc.). Multiples of
  40. # this tag may be used to add more skills, and multiples of the same skill may
  41. # be added to the random invoke pool.
  42. #
  43. #==============================================================================
  44. # ▼ Compatibility
  45. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  46. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  47. # it will run with RPG Maker VX without adjusting.
  48. #
  49. #==============================================================================
  50. # ▼ Editting anything past this point may potentially result in causing
  51. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  52. # halitosis so edit at your own risk.
  53. #==============================================================================

  54. module YEA
  55.   module REGEXP
  56.   module SKILL
  57.    
  58.     RANDOM_INVOKE =
  59.       /<(?:RANDOM_INVOKE|random invoke):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  60.    
  61.   end # SKILL
  62.   end # REGEXP
  63. end # YEA

  64. #==============================================================================
  65. # ■ DataManager
  66. #==============================================================================

  67. module DataManager
  68.   
  69.   #--------------------------------------------------------------------------
  70.   # alias method: load_database
  71.   #--------------------------------------------------------------------------
  72.   class <<self; alias load_database_rsi load_database; end
  73.   def self.load_database
  74.     load_database_rsi
  75.     load_notetags_rsi
  76.   end
  77.   
  78.   #--------------------------------------------------------------------------
  79.   # new method: load_notetags_rsi
  80.   #--------------------------------------------------------------------------
  81.   def self.load_notetags_rsi
  82.     for skill in $data_skills
  83.       next if skill.nil?
  84.       skill.load_notetags_rsi
  85.     end
  86.   end
  87.   
  88. end # DataManager

  89. #==============================================================================
  90. # ■ RPG::Skill
  91. #==============================================================================

  92. class RPG::Skill < RPG::UsableItem
  93.   
  94.   #--------------------------------------------------------------------------
  95.   # public instance variables
  96.   #--------------------------------------------------------------------------
  97.   attr_accessor :random_invoke
  98.   
  99.   #--------------------------------------------------------------------------
  100.   # common cache: load_notetags_rsi
  101.   #--------------------------------------------------------------------------
  102.   def load_notetags_rsi
  103.     @random_invoke = []
  104.     #---
  105.     self.note.split(/[\r\n]+/).each { |line|
  106.       case line
  107.       #---
  108.       when YEA::REGEXP::SKILL::RANDOM_INVOKE
  109.         $1.scan(/\d+/).each { |num|
  110.         @random_invoke.push(num.to_i) if num.to_i > 0 }
  111.       #---
  112.       end
  113.     } # self.note.split
  114.     #---
  115.   end
  116.   
  117. end # RPG::Weapon

  118. #==============================================================================
  119. # ■ Game_Battler
  120. #==============================================================================

  121. class Game_Battler < Game_BattlerBase
  122.   
  123.   #--------------------------------------------------------------------------
  124.   # new method: invoke_random_skill
  125.   #--------------------------------------------------------------------------
  126.   def invoke_random_skill
  127.     return unless current_action.item.is_a?(RPG::Skill)
  128.     valid_skills = [current_action.item]
  129.     for random_skill_id in current_action.item.random_invoke
  130.       next unless usable?($data_skills[random_skill_id])
  131.       valid_skills.push($data_skills[random_skill_id])
  132.     end
  133.     skill_id = valid_skills.sample.id
  134.     current_action.set_skill(skill_id)
  135.   end
  136.   
  137. end # Game_Battler

  138. #==============================================================================
  139. # ■ Scene_Battle
  140. #==============================================================================

  141. class Scene_Battle < Scene_Base
  142.   
  143.   #--------------------------------------------------------------------------
  144.   # alias method: use_item
  145.   #--------------------------------------------------------------------------
  146.   alias scene_battle_use_item_rsi use_item
  147.   def use_item
  148.     @subject.invoke_random_skill
  149.     scene_battle_use_item_rsi
  150.   end
  151.   
  152. end # Scene_Battle

  153. #==============================================================================
  154. #
  155. # ▼ End of File
  156. #
  157. #==============================================================================
复制代码


敌人信息显示
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Enemy Target Info v1.02
  4. # -- Last Updated: 2012.01.01
  5. # -- Level: Normal
  6. # -- Requires: YEA - Ace Battle Engine v1.10+.
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-EnemyTargetInfo"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.01 - Bug Fixed: <scan info: all> didn't work properly.
  15. # 2011.12.30 - Bug Fixed: Crash when using Ace Battle Engine's F8 debug.
  16. # 2011.12.29 - Started Script and Finished.
  17. #
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # The enemy target info window can be activated in battle to show enemy data
  22. # at the bottom of the screen. Information can be revealed straight from the
  23. # start or requires the player to actively reveal the information on their own
  24. # through either defeating the enemies, using skills on them, or scanning them
  25. # in various ways produced by the script.
  26. #
  27. #==============================================================================
  28. # ▼ Instructions
  29. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  30. # To install this script, open up your script editor and copy/paste this script
  31. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  32. #
  33. # -----------------------------------------------------------------------------
  34. # Skill Notetags - These notetags go in the skill notebox in the database.
  35. # -----------------------------------------------------------------------------
  36. # <scan info: all>
  37. # This will scan the target enemy of all properties that are shown in the
  38. # comparison windows. Unless the enemy has a permanent hide tag, all of the
  39. # data becomes available.
  40. #
  41. # <scan info: parameters>
  42. # This will scan the target enemy's parameters and reveal them to the player
  43. # unless the enemy has a permanent hide tag.
  44. #
  45. # <scan info: elements>
  46. # This will scan the target enemy's elemental resistances and reveal them to
  47. # the player unless the enemy has a permanent hide tag.
  48. #
  49. # <scan info: states>
  50. # This will scan the target enemy's state resistances and reveal them to the
  51. # player unless the enemy has a permanent hide tag.
  52. #
  53. # <scan element: x>
  54. # <scan element: x, x>
  55. # This will scan the target enemy's elemental resistance for element x. Insert
  56. # multiple of these tags to scan more elements. If you have the automatic scan
  57. # element setting on in the module, all skills and items will automatically
  58. # scan whatever element the skill or item deals damage with innately.
  59. #
  60. # <scan state: x>
  61. # <scan state: x, x>
  62. # This will scan the target enemy's state resistance for element x. Insert
  63. # multiple of these tags to scan more states. If you have the automatic scan
  64. # state setting on in the module, all skills and items will automatically
  65. # scan whatever state the skill or item inflicts innately.
  66. #
  67. # -----------------------------------------------------------------------------
  68. # Item Notetags - These notetags go in the item notebox in the database.
  69. # -----------------------------------------------------------------------------
  70. # <scan info: all>
  71. # This will scan the target enemy of all properties that are shown in the
  72. # comparison windows. Unless the enemy has a permanent hide tag, all of the
  73. # data becomes available.
  74. #
  75. # <scan info: parameters>
  76. # This will scan the target enemy's parameters and reveal them to the player
  77. # unless the enemy has a permanent hide tag.
  78. #
  79. # <scan info: elements>
  80. # This will scan the target enemy's elemental resistances and reveal them to
  81. # the player unless the enemy has a permanent hide tag.
  82. #
  83. # <scan info: states>
  84. # This will scan the target enemy's state resistances and reveal them to the
  85. # player unless the enemy has a permanent hide tag.
  86. #
  87. # <scan element: x>
  88. # <scan element: x, x>
  89. # This will scan the target enemy's elemental resistance for element x. Insert
  90. # multiple of these tags to scan more elements. If you have the automatic scan
  91. # element setting on in the module, all skills and items will automatically
  92. # scan whatever element the skill or item deals damage with innately.
  93. #
  94. # <scan state: x>
  95. # <scan state: x, x>
  96. # This will scan the target enemy's state resistance for element x. Insert
  97. # multiple of these tags to scan more states. If you have the automatic scan
  98. # state setting on in the module, all skills and items will automatically
  99. # scan whatever state the skill or item inflicts innately.
  100. #
  101. # -----------------------------------------------------------------------------
  102. # Enemy Notetags - These notetags go in the enemies notebox in the database.
  103. # -----------------------------------------------------------------------------
  104. # <hide info: all>
  105. # <show info: all>
  106. # These notetags will set the enemy to either always hide all of their battle
  107. # information or to always show all of their info. The tags will override
  108. # each other if both are used simultaneously.
  109. #
  110. # <hide info: parameters>
  111. # <show info: parameters>
  112. # These notetags will set the enemy to either always hide their parameter
  113. # information or to always show their parameter info. The tags will override
  114. # each other if both are used simultaneously.
  115. #
  116. # <hide info: elements>
  117. # <show info: elements>
  118. # These notetags will set the enemy to either always hide their element
  119. # information or to always show their element info. The tags will override
  120. # each other if both are used simultaneously.
  121. #
  122. # <hide info: states>
  123. # <show info: states>
  124. # These notetags will set the enemy to either always hide their state
  125. # information or to always show their state info. The tags will override
  126. # each other if both are used simultaneously.
  127. #
  128. #==============================================================================
  129. # ▼ Compatibility
  130. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  131. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  132. # it will run with RPG Maker VX without adjusting.
  133. #
  134. # This script requires Yanfly Engine Ace - Ace Battle Engine v1.10+ and the
  135. # script must be placed under Ace Battle Engine in the script listing.
  136. #
  137. #==============================================================================

  138. module YEA
  139.   module ENEMY_INFO
  140.    
  141.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  142.     # - Info Window Settings -
  143.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  144.     # These are the general settings revolving around the info windows shown in
  145.     # battle such as the sound effect played, the button used to open up the
  146.     # menus, the page orders, and the info text.
  147.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  148.     INFO_SFX = RPG::SE.new("Book2", 80, 150) # SFX played for Info Window.
  149.    
  150.     # Button used to toggle the Info Window. Keep in mind that L and R are
  151.     # used for moving between pages so it's best to not use those.
  152.     INFO_BUTTON = :SHIFT
  153.    
  154.     # This sets the page order in which data is displayed for the player. The
  155.     # player can switch pages by pressing L or R.
  156.     PAGE_ORDER =[
  157.       :parameters,
  158.       :elements,
  159.       :states,
  160.     ] # Do not remove this.
  161.    
  162.     # If testplay is being used, reveal all battle information for non-hidden
  163.     # enemy information?
  164.     SHOW_DEBUG_ALL = true
  165.    
  166.     # The follow adjusts the settings regarding the help window. If this
  167.     # setting is on, the the help info will be displayed.
  168.     SHOW_HELP_INFO = true
  169.     HELP_WINDOW_Y  = 72    # Y location of the help window.
  170.    
  171.     # This is the text displayed to let the player know how to activate and
  172.     # show the info windows.
  173.     HELP_INFO_SHOW = "\e}按 \eC[4]SHIFT键\eC[0] 查看信息."
  174.    
  175.     # This is the text displayed to let the player know how to switch between
  176.     # pages for the info windows.
  177.     HELP_INFO_SWITCH = "\e}按 \eC[4]L键\eC[0] or \eC[4]R键\eC[0] 查看其他信息."
  178.    
  179.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  180.     # - General Page Settings -
  181.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  182.     # The general page shows the stats of the battlers. The player can compare
  183.     # and contrast the stats of both battlers relative to each other. The
  184.     # settings here adjust the font size, the text displayed if parameters are
  185.     # hidden, and whether or not to show parameters by default?
  186.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  187.     PARAM_FONT_SIZE     = 20       # Font size used for parameters.
  188.     HIDDEN_PARAM_TEXT   = "???"    # Text used if parameters are hidden.
  189.    
  190.     # Show the parameters by default? If false, the enemy must be defeated once
  191.     # or scanned to show the those parameters.
  192.     DEFAULT_SHOW_PARAMS = false
  193.    
  194.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  195.     # - Element Page Settings -
  196.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  197.     # The elements page shows the elemental resistances of the battlers. The
  198.     # player can compare and contrast the resistances relative to each other.
  199.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  200.     ELE_FONT_SIZE   = 20       # Font size used for element resistances.
  201.     HIDDEN_ELE_TEXT = "???"    # Text used if element resistances are hidden.
  202.     SHOWN_ELEMENTS  = [3..10]  # Elements shown. Maximum of 8 can be shown.
  203.     ELEMENT_ICONS   ={         # Contains element icon information.
  204.     # Element ID => Icon,
  205.                3 =>  96, # Fire
  206.                4 =>  97, # Ice
  207.                5 =>  98, # Thunder
  208.                6 =>  99, # Water
  209.                7 => 100, # Earth
  210.                8 => 101, # Wind
  211.                9 => 102, # Holy
  212.               10 => 103, # Dark
  213.     } # Do not remove this.
  214.    
  215.     # Show the elemental resistances by default? If false, a skill with the
  216.     # specific element must be used on the enemy to reveal the element data if
  217.     # the AUTO_SCAN_ELEMENT setting is set to true.
  218.     DEFAULT_SHOW_ELEMENTS = false
  219.    
  220.     # If this is set to true, then skills with elemental properties will
  221.     # automatically scan the specific elemental resistance of that enemy type
  222.     # when used against that enemy.
  223.     AUTO_SCAN_ELEMENT = true
  224.    
  225.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  226.     # - States Page Settings -
  227.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  228.     # The states page shows the state resistances of the battlers. The player
  229.     # can compare and contrast the resistances relative to each other.
  230.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  231.     STATE_FONT_SIZE   = 20     # Font size used for state resistances.
  232.     HIDDEN_STATE_TEXT = "???"  # Text used if state resistances are hidden.
  233.     SHOWN_STATES = [7..14]     # States shown. Maximum of 8 can be shown.
  234.    
  235.     # Show the state resistances by default? If false, a skill with the
  236.     # specific state must be used on the enemy to reveal the element data if
  237.     # the AUTO_SCAN_STATES setting is set to true.
  238.     DEFAULT_SHOW_STATES = false
  239.    
  240.     # If this is set to true, then skills with state applying properties will
  241.     # automatically scan the specific state resistance of that enemy type
  242.     # when used against that enemy.
  243.     AUTO_SCAN_STATES = true
  244.    
  245.   end # ENEMY_INFO
  246. end # YEA

  247. #==============================================================================
  248. # ▼ Editting anything past this point may potentially result in causing
  249. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  250. # halitosis so edit at your own risk.
  251. #==============================================================================

  252. if $imported["YEA-BattleEngine"]

  253. module YEA
  254.   module ENEMY_INFO
  255.     module_function
  256.     #--------------------------------------------------------------------------
  257.     # convert_integer_array
  258.     #--------------------------------------------------------------------------
  259.     def convert_integer_array(array)
  260.       result = []
  261.       array.each { |i|
  262.         case i
  263.         when Range; result |= i.to_a
  264.         when Integer; result |= [i]
  265.         end }
  266.       return result
  267.     end
  268.     #--------------------------------------------------------------------------
  269.     # converted_contants
  270.     #--------------------------------------------------------------------------
  271.     SHOWN_ELEMENTS = convert_integer_array(SHOWN_ELEMENTS)
  272.     SHOWN_STATES = convert_integer_array(SHOWN_STATES)
  273.   end # ENEMY_INFO
  274.   module REGEXP
  275.   module ENEMY
  276.    
  277.     HIDE_INFO = /<(?:HIDE_INFO|hide info):[ ](.*)>/i
  278.     SHOW_INFO = /<(?:SHOW_INFO|show info):[ ](.*)>/i
  279.    
  280.   end # ENEMY
  281.   module USABLEITEM
  282.    
  283.     SCAN_INFO = /<(?:SCAN_INFO|scan info):[ ](.*)>/i
  284.     SCAN_ELE = /<(?:SCAN_ELE|scan ele|scan element):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  285.     SCAN_STATE = /<(?:SCAN_STATE|scan state):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  286.    
  287.   end # USABLEITEM
  288.   end # REGEXP
  289. end # YEA

  290. #==============================================================================
  291. # ■ Icon
  292. #==============================================================================

  293. module Icon
  294.   
  295.   #--------------------------------------------------------------------------
  296.   # self.element
  297.   #--------------------------------------------------------------------------
  298.   def self.element(id)
  299.     return 0 unless YEA::ENEMY_INFO::ELEMENT_ICONS.include?(id)
  300.     return YEA::ENEMY_INFO::ELEMENT_ICONS[id]
  301.   end
  302.    
  303. end # Icon

  304. #==============================================================================
  305. # ■ Numeric
  306. #==============================================================================

  307. class Numeric
  308.   
  309.   #--------------------------------------------------------------------------
  310.   # new method: group_digits
  311.   #--------------------------------------------------------------------------
  312.   unless $imported["YEA-CoreEngine"]
  313.   def group; return self.to_s; end
  314.   end # $imported["YEA-CoreEngine"]
  315.    
  316. end # Numeric

  317. #==============================================================================
  318. # ■ DataManager
  319. #==============================================================================

  320. module DataManager
  321.   
  322.   #--------------------------------------------------------------------------
  323.   # alias method: load_database
  324.   #--------------------------------------------------------------------------
  325.   class <<self; alias load_database_eti load_database; end
  326.   def self.load_database
  327.     load_database_eti
  328.     load_notetags_etin
  329.   end
  330.   
  331.   #--------------------------------------------------------------------------
  332.   # new method: load_notetags_etin
  333.   #--------------------------------------------------------------------------
  334.   def self.load_notetags_etin
  335.     groups = [$data_enemies, $data_skills, $data_items]
  336.     for group in groups
  337.       for obj in group
  338.         next if obj.nil?
  339.         obj.load_notetags_etin
  340.       end
  341.     end
  342.   end
  343.   
  344. end # DataManager

  345. #==============================================================================
  346. # ■ RPG::Enemy
  347. #==============================================================================

  348. class RPG::Enemy < RPG::BaseItem
  349.   
  350.   #--------------------------------------------------------------------------
  351.   # public instance variables
  352.   #--------------------------------------------------------------------------
  353.   attr_accessor :hide_info
  354.   attr_accessor :show_info
  355.   
  356.   #--------------------------------------------------------------------------
  357.   # common cache: load_notetags_etin
  358.   #--------------------------------------------------------------------------
  359.   def load_notetags_etin
  360.     @hide_info = []
  361.     @show_info = []
  362.     #---
  363.     self.note.split(/[\r\n]+/).each { |line|
  364.       case line
  365.       #---
  366.       when YEA::REGEXP::ENEMY::HIDE_INFO
  367.         case $1.upcase
  368.         when "PARAM", "PARAMETER", "PARAMETERS"
  369.           @hide_info.push(:param)
  370.           @show_info.delete(:param)
  371.         when "ELE", "ELEMENT", "ELEMENTS"
  372.           @hide_info.push(:ele)
  373.           @show_info.delete(:ele)
  374.         when "STATE", "STATES"
  375.           @hide_info.push(:state)
  376.           @show_info.delete(:state)
  377.         when "ALL"
  378.           @hide_info.push(:all)
  379.           @show_info.delete(:all)
  380.         end
  381.       #---
  382.       when YEA::REGEXP::ENEMY::SHOW_INFO
  383.         case $1.upcase
  384.         when "PARAM", "PARAMETER", "PARAMETERS"
  385.           @show_info.push(:param)
  386.           @hide_info.delete(:param)
  387.         when "ELE", "ELEMENT", "ELEMENTS"
  388.           @show_info.push(:ele)
  389.           @hide_info.delete(:ele)
  390.         when "STATE", "STATES"
  391.           @show_info.push(:state)
  392.           @hide_info.delete(:state)
  393.         when "ALL"
  394.           @show_info.push(:all)
  395.           @hide_info.delete(:all)
  396.         end
  397.       #---
  398.       end
  399.     } # self.note.split
  400.     #---
  401.   end
  402.   
  403. end # RPG::Enemy

  404. #==============================================================================
  405. # ■ RPG::UsableItem
  406. #==============================================================================

  407. class RPG::UsableItem < RPG::BaseItem
  408.   
  409.   #--------------------------------------------------------------------------
  410.   # public instance variables
  411.   #--------------------------------------------------------------------------
  412.   attr_accessor :scan_info
  413.   attr_accessor :scan_ele
  414.   attr_accessor :scan_state
  415.   
  416.   #--------------------------------------------------------------------------
  417.   # common cache: load_notetags_etin
  418.   #--------------------------------------------------------------------------
  419.   def load_notetags_etin
  420.     @scan_info = []
  421.     @scan_ele = []
  422.     @scan_state = []
  423.     #---
  424.     self.note.split(/[\r\n]+/).each { |line|
  425.       case line
  426.       #---
  427.       when YEA::REGEXP::USABLEITEM::SCAN_INFO
  428.         case $1.upcase
  429.         when "PARAM", "PARAMETER", "PARAMETERS"
  430.           @scan_info.push(:param)
  431.         when "ELE", "ELEMENT", "ELEMENTS"
  432.           @scan_info.push(:ele)
  433.         when "STATE", "STATES"
  434.           @scan_info.push(:state)
  435.         when "ALL"
  436.           @scan_info.push(:all)
  437.         end
  438.       #---
  439.       when YEA::REGEXP::USABLEITEM::SCAN_ELE
  440.         $1.scan(/\d+/).each { |num|
  441.         @scan_ele.push(num.to_i) if num.to_i > 0 }
  442.       when YEA::REGEXP::USABLEITEM::SCAN_STATE
  443.         $1.scan(/\d+/).each { |num|
  444.         @scan_state.push(num.to_i) if num.to_i > 0 }
  445.       #---
  446.       end
  447.     } # self.note.split
  448.     #---
  449.     @scan_ele.push(self.damage.element_id) if YEA::ENEMY_INFO::AUTO_SCAN_ELEMENT
  450.     if YEA::ENEMY_INFO::AUTO_SCAN_STATES
  451.       for effect in @effects
  452.         next unless effect.code == 21
  453.         next unless effect.data_id > 0
  454.         @scan_state.push(effect.data_id)
  455.       end
  456.     end
  457.   end
  458.   
  459. end # RPG::UsableItem

  460. #==============================================================================
  461. # ■ Game_System
  462. #==============================================================================

  463. class Game_System
  464.   
  465.   #--------------------------------------------------------------------------
  466.   # alias method: initialize
  467.   #--------------------------------------------------------------------------
  468.   alias game_system_initialize_eti initialize
  469.   def initialize
  470.     game_system_initialize_eti
  471.     initialize_enemy_info_data
  472.   end
  473.   
  474.   #--------------------------------------------------------------------------
  475.   # new method: initialize_enemy_info_data
  476.   #--------------------------------------------------------------------------
  477.   def initialize_enemy_info_data
  478.     @param_enemies = [] if @param_enemies.nil?
  479.     @ele_enemies = {} if @ele_enemies.nil?
  480.     @state_enemies = {} if @state_enemies.nil?
  481.   end
  482.   
  483.   #--------------------------------------------------------------------------
  484.   # new method: info_param_enemies
  485.   #--------------------------------------------------------------------------
  486.   def info_param_enemies
  487.     initialize_enemy_info_data if @param_enemies.nil?
  488.     return @param_enemies
  489.   end
  490.   
  491.   #--------------------------------------------------------------------------
  492.   # new method: add_info_param_enemies
  493.   #--------------------------------------------------------------------------
  494.   def add_info_param_enemies(id)
  495.     initialize_enemy_info_data if @param_enemies.nil?
  496.     @param_enemies.push(id) unless @param_enemies.include?(id)
  497.   end
  498.   
  499.   #--------------------------------------------------------------------------
  500.   # new method: info_ele_enemies
  501.   #--------------------------------------------------------------------------
  502.   def info_ele_enemies(ele_id)
  503.     initialize_enemy_info_data if @ele_enemies.nil?
  504.     @ele_enemies[ele_id] = [] if @ele_enemies[ele_id].nil?
  505.     return @ele_enemies[ele_id]
  506.   end
  507.   
  508.   #--------------------------------------------------------------------------
  509.   # new method: add_info_ele_enemies
  510.   #--------------------------------------------------------------------------
  511.   def add_info_ele_enemies(ele_id, id)
  512.     initialize_enemy_info_data if @ele_enemies.nil?
  513.     @ele_enemies[ele_id] = [] if @ele_enemies[ele_id].nil?
  514.     @ele_enemies[ele_id].push(id) unless @ele_enemies[ele_id].include?(id)
  515.   end
  516.   
  517.   #--------------------------------------------------------------------------
  518.   # new method: info_state_enemies
  519.   #--------------------------------------------------------------------------
  520.   def info_state_enemies(state_id)
  521.     initialize_enemy_info_data if @state_enemies.nil?
  522.     @state_enemies[state_id] = [] if @state_enemies[state_id].nil?
  523.     return @state_enemies[state_id]
  524.   end
  525.   
  526.   #--------------------------------------------------------------------------
  527.   # new method: add_info_state_enemies
  528.   #--------------------------------------------------------------------------
  529.   def add_info_state_enemies(state_id, id)
  530.     initialize_enemy_info_data if @state_enemies.nil?
  531.     @state_enemies[state_id] = [] if @state_enemies[state_id].nil?
  532.     @state_enemies[state_id].push(id) if !@state_enemies[state_id].include?(id)
  533.   end
  534.   
  535. end # Game_System

  536. #==============================================================================
  537. # ■ Game_BattlerBase
  538. #==============================================================================

  539. class Game_BattlerBase
  540.   
  541.   #--------------------------------------------------------------------------
  542.   # new method: show_info_param?
  543.   #--------------------------------------------------------------------------
  544.   def show_info_param?
  545.     return true if YEA::ENEMY_INFO::SHOW_DEBUG_ALL && ($TEST || $BTEST)
  546.     return YEA::ENEMY_INFO::DEFAULT_SHOW_PARAMS
  547.   end
  548.   
  549.   #--------------------------------------------------------------------------
  550.   # new method: show_info_element?
  551.   #--------------------------------------------------------------------------
  552.   def show_info_element?(ele_id)
  553.     return true if YEA::ENEMY_INFO::SHOW_DEBUG_ALL && ($TEST || $BTEST)
  554.     return YEA::ENEMY_INFO::DEFAULT_SHOW_ELEMENTS
  555.   end
  556.   
  557.   #--------------------------------------------------------------------------
  558.   # new method: show_info_state?
  559.   #--------------------------------------------------------------------------
  560.   def show_info_state?(state_id)
  561.     return true if YEA::ENEMY_INFO::SHOW_DEBUG_ALL && ($TEST || $BTEST)
  562.     return YEA::ENEMY_INFO::DEFAULT_SHOW_STATES
  563.   end
  564.   
  565. end # Game_BattlerBase

  566. #==============================================================================
  567. # ■ Game_Battler
  568. #==============================================================================

  569. class Game_Battler < Game_BattlerBase
  570.   
  571.   #--------------------------------------------------------------------------
  572.   # alias method: die
  573.   #--------------------------------------------------------------------------
  574.   alias game_battler_die_eti die
  575.   def die
  576.     game_battler_die_eti
  577.     return if actor?
  578.     $game_system.add_info_param_enemies(@enemy_id)
  579.   end
  580.   
  581.   #--------------------------------------------------------------------------
  582.   # alias method: item_user_effect
  583.   #--------------------------------------------------------------------------
  584.   alias game_battler_item_user_effect_eti item_user_effect
  585.   def item_user_effect(user, item)
  586.     game_battler_item_user_effect_eti(user, item)
  587.     scan_enemy_info_effect(user, item)
  588.   end
  589.   
  590.   #--------------------------------------------------------------------------
  591.   # new method: scan_enemy_info_effect
  592.   #--------------------------------------------------------------------------
  593.   def scan_enemy_info_effect(user, item)
  594.     return if self.actor?
  595.     return unless user.actor?
  596.     #---
  597.     for info in item.scan_info
  598.       case info
  599.       when :all
  600.         $game_system.add_info_param_enemies(@enemy_id)
  601.         for i in 0...$data_system.elements.size
  602.           $game_system.add_info_ele_enemies(i, @enemy_id)
  603.         end
  604.         for i in 0...$data_states.size
  605.           $game_system.add_info_state_enemies(i, @enemy_id)
  606.         end
  607.       when :param
  608.         $game_system.add_info_param_enemies(@enemy_id)
  609.       when :ele
  610.         for i in 0...$data_system.elements.size
  611.           $game_system.add_info_ele_enemies(i, @enemy_id)
  612.         end
  613.       when :state
  614.         for i in 0...$data_states.size
  615.           $game_system.add_info_state_enemies(i, @enemy_id)
  616.         end
  617.       end
  618.     end
  619.     #---
  620.     for ele_id in item.scan_ele
  621.       $game_system.add_info_ele_enemies(ele_id, @enemy_id)
  622.     end
  623.     for state_id in item.scan_state
  624.       $game_system.add_info_state_enemies(state_id, @enemy_id)
  625.     end
  626.   end
  627.   
  628. end # Game_Battler

  629. #==============================================================================
  630. # ■ Game_Actor
  631. #==============================================================================

  632. class Game_Actor < Game_Battler
  633.   
  634.   #--------------------------------------------------------------------------
  635.   # new method: show_info_param?
  636.   #--------------------------------------------------------------------------
  637.   def show_info_param?
  638.     return true
  639.   end
  640.   
  641.   #--------------------------------------------------------------------------
  642.   # new method: show_info_element?
  643.   #--------------------------------------------------------------------------
  644.   def show_info_element?(ele_id)
  645.     return true
  646.   end
  647.   
  648.   #--------------------------------------------------------------------------
  649.   # new method: show_info_state?
  650.   #--------------------------------------------------------------------------
  651.   def show_info_state?(state_id)
  652.     return true
  653.   end
  654.   
  655. end # Game_Actor

  656. #==============================================================================
  657. # ■ Game_Enemy
  658. #==============================================================================

  659. class Game_Enemy < Game_Battler
  660.   
  661.   #--------------------------------------------------------------------------
  662.   # new method: show_info_param?
  663.   #--------------------------------------------------------------------------
  664.   def show_info_param?
  665.     return false if enemy.hide_info.include?(:param)
  666.     return false if enemy.hide_info.include?(:all)
  667.     return true if enemy.show_info.include?(:param)
  668.     return true if enemy.show_info.include?(:all)
  669.     return true if $game_system.info_param_enemies.include?(@enemy_id)
  670.     return super
  671.   end
  672.   
  673.   #--------------------------------------------------------------------------
  674.   # new method: show_info_element?
  675.   #--------------------------------------------------------------------------
  676.   def show_info_element?(ele_id)
  677.     return false if enemy.hide_info.include?(:ele)
  678.     return false if enemy.hide_info.include?(:all)
  679.     return true if enemy.show_info.include?(:ele)
  680.     return true if enemy.show_info.include?(:all)
  681.     return true if $game_system.info_ele_enemies(ele_id).include?(@enemy_id)
  682.     return super(ele_id)
  683.   end
  684.   
  685.   #--------------------------------------------------------------------------
  686.   # new method: show_info_state?
  687.   #--------------------------------------------------------------------------
  688.   def show_info_state?(state_id)
  689.     return false if enemy.hide_info.include?(:state)
  690.     return false if enemy.hide_info.include?(:all)
  691.     return true if enemy.show_info.include?(:state)
  692.     return true if enemy.show_info.include?(:all)
  693.     return true if $game_system.info_state_enemies(state_id).include?(@enemy_id)
  694.     return super(state_id)
  695.   end
  696.   
  697. end # Game_Enemy

  698. #==============================================================================
  699. # ■ Window_Comparison
  700. #==============================================================================

  701. class Window_Comparison < Window_Base
  702.   
  703.   #--------------------------------------------------------------------------
  704.   # initialize
  705.   #--------------------------------------------------------------------------
  706.   def initialize(type)
  707.     dx = type == :actor ? 0 : Graphics.width / 2
  708.     dh = fitting_height(4)
  709.     super(dx, Graphics.height - dh, Graphics.width / 2, dh)
  710.     @button = YEA::ENEMY_INFO::INFO_BUTTON
  711.     @battler = nil
  712.     @type = type
  713.     @page = 0
  714.     hide
  715.   end
  716.   
  717.   #--------------------------------------------------------------------------
  718.   # update
  719.   #--------------------------------------------------------------------------
  720.   def update
  721.     super
  722.     return unless @type == :enemy
  723.     process_enemy_window_input
  724.     return unless self.visible
  725.     reveal(SceneManager.scene.enemy_window.enemy)
  726.   end
  727.   
  728.   #--------------------------------------------------------------------------
  729.   # process_enemy_window_input
  730.   #--------------------------------------------------------------------------
  731.   def process_enemy_window_input
  732.     return unless SceneManager.scene_is?(Scene_Battle)
  733.     return unless SceneManager.scene.enemy_window.active
  734.     return if SceneManager.scene.enemy_window.select_all?
  735.     SceneManager.scene.toggle_enemy_info if Input.trigger?(@button)
  736.     return unless self.visible
  737.     SceneManager.scene.enemy_info_page_up if Input.trigger?(:L)
  738.     SceneManager.scene.enemy_info_page_down if Input.trigger?(:R)
  739.   end
  740.   
  741.   #--------------------------------------------------------------------------
  742.   # reveal
  743.   #--------------------------------------------------------------------------
  744.   def reveal(battler)
  745.     return if @battler == battler
  746.     @battler = battler
  747.     refresh
  748.     show
  749.   end
  750.   
  751.   #--------------------------------------------------------------------------
  752.   # clear
  753.   #--------------------------------------------------------------------------
  754.   def clear
  755.     @battler = nil
  756.     @page = 0
  757.     hide
  758.   end
  759.   
  760.   #--------------------------------------------------------------------------
  761.   # actor
  762.   #--------------------------------------------------------------------------
  763.   def actor; return BattleManager.actor; end
  764.   
  765.   #--------------------------------------------------------------------------
  766.   # enemy
  767.   #--------------------------------------------------------------------------
  768.   def enemy; return SceneManager.scene.enemy_window.enemy; end
  769.   
  770.   #--------------------------------------------------------------------------
  771.   # page_up
  772.   #--------------------------------------------------------------------------
  773.   def page_up
  774.     @page = @page == 0 ? YEA::ENEMY_INFO::PAGE_ORDER.size - 1 : @page - 1
  775.     refresh
  776.   end
  777.   
  778.   #--------------------------------------------------------------------------
  779.   # page_down
  780.   #--------------------------------------------------------------------------
  781.   def page_down
  782.     @page = @page == YEA::ENEMY_INFO::PAGE_ORDER.size - 1 ? 0 : @page + 1
  783.     refresh
  784.   end
  785.   
  786.   #--------------------------------------------------------------------------
  787.   # refresh
  788.   #--------------------------------------------------------------------------
  789.   def refresh
  790.     contents.clear
  791.     reset_font_settings
  792.     draw_page(@page)
  793.   end
  794.   
  795.   #--------------------------------------------------------------------------
  796.   # draw_page
  797.   #--------------------------------------------------------------------------
  798.   def draw_page(page_id)
  799.     return if @battler.nil?
  800.     case YEA::ENEMY_INFO::PAGE_ORDER[page_id]
  801.     when :parameters
  802.       @battler = actor if @type == :actor
  803.       draw_parameters
  804.     when :elements
  805.       @battler = enemy if @type == :actor
  806.       draw_parameters if @type == :actor
  807.       draw_elements if @type == :enemy
  808.     when :states
  809.       @battler = enemy if @type == :actor
  810.       draw_parameters if @type == :actor
  811.       draw_states if @type == :enemy
  812.     end
  813.   end
  814.   
  815.   #--------------------------------------------------------------------------
  816.   # draw_parameters
  817.   #--------------------------------------------------------------------------
  818.   def draw_parameters
  819.     draw_text(4, 0, contents.width, line_height, @battler.name)
  820.     dx = contents.width / 2
  821.     contents.font.size = YEA::ENEMY_INFO::PARAM_FONT_SIZE
  822.     draw_param(2, 0, line_height*1); draw_param(3, dx, line_height*1)
  823.     draw_param(4, 0, line_height*2); draw_param(5, dx, line_height*2)
  824.     draw_param(6, 0, line_height*3); draw_param(7, dx, line_height*3)
  825.   end
  826.   
  827.   #--------------------------------------------------------------------------
  828.   # draw_param
  829.   #--------------------------------------------------------------------------
  830.   def draw_param(param_id, dx, dy)
  831.     dw = contents.width / 2
  832.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  833.     rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
  834.     contents.fill_rect(rect, colour)
  835.     #---
  836.     change_color(system_color)
  837.     draw_text(dx+4, dy, dw-8, line_height, Vocab::param(param_id))
  838.     change_color(normal_color)
  839.     if @battler.show_info_param?
  840.       text = @battler.param(param_id).group
  841.     else
  842.       text = YEA::ENEMY_INFO::HIDDEN_PARAM_TEXT
  843.     end
  844.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  845.   end
  846.   
  847.   #--------------------------------------------------------------------------
  848.   # draw_elements
  849.   #--------------------------------------------------------------------------
  850.   def draw_elements
  851.     dx = 0; dy = 0
  852.     contents.font.size = YEA::ENEMY_INFO::ELE_FONT_SIZE
  853.     for ele_id in YEA::ENEMY_INFO::SHOWN_ELEMENTS
  854.       draw_element_info(ele_id, dx, dy)
  855.       dx = dx == 0 ? contents.width / 2 : 0
  856.       dy += dx == 0 ? line_height : 0
  857.     end
  858.   end
  859.   
  860.   #--------------------------------------------------------------------------
  861.   # draw_element_info
  862.   #--------------------------------------------------------------------------
  863.   def draw_element_info(ele_id, dx, dy)
  864.     dw = contents.width / 2
  865.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  866.     rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
  867.     contents.fill_rect(rect, colour)
  868.     #---
  869.     draw_icon(Icon.element(ele_id), dx, dy)
  870.     change_color(system_color)
  871.     draw_text(dx+24, dy, dw-24, line_height, $data_system.elements[ele_id])
  872.     change_color(normal_color)
  873.     if @battler.show_info_element?(ele_id)
  874.       text = sprintf("%d%%", (@battler.element_rate(ele_id) * 100).to_i)
  875.     else
  876.       text = YEA::ENEMY_INFO::HIDDEN_ELE_TEXT
  877.     end
  878.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  879.   end
  880.   
  881.   #--------------------------------------------------------------------------
  882.   # draw_states
  883.   #--------------------------------------------------------------------------
  884.   def draw_states
  885.     dx = 0; dy = 0
  886.     contents.font.size = YEA::ENEMY_INFO::ELE_FONT_SIZE
  887.     for state_id in YEA::ENEMY_INFO::SHOWN_STATES
  888.       draw_state_info(state_id, dx, dy)
  889.       dx = dx == 0 ? contents.width / 2 : 0
  890.       dy += dx == 0 ? line_height : 0
  891.     end
  892.   end
  893.   
  894.   #--------------------------------------------------------------------------
  895.   # draw_state_info
  896.   #--------------------------------------------------------------------------
  897.   def draw_state_info(state_id, dx, dy)
  898.     dw = contents.width / 2
  899.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  900.     rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
  901.     contents.fill_rect(rect, colour)
  902.     #---
  903.     draw_icon($data_states[state_id].icon_index, dx, dy)
  904.     change_color(system_color)
  905.     draw_text(dx+24, dy, dw-24, line_height, $data_states[state_id].name)
  906.     change_color(normal_color)
  907.     if @battler.show_info_state?(state_id)
  908.       text = sprintf("%d%%", (@battler.state_rate(state_id) * 100).to_i)
  909.     else
  910.       text = YEA::ENEMY_INFO::HIDDEN_STATE_TEXT
  911.     end
  912.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  913.   end
  914.   
  915. end # Window_Comparison

  916. #==============================================================================
  917. # ■ Window_ComparisonHelp
  918. #==============================================================================

  919. class Window_ComparisonHelp < Window_Base
  920.   
  921.   #--------------------------------------------------------------------------
  922.   # initialize
  923.   #--------------------------------------------------------------------------
  924.   def initialize(info_window)
  925.     dy = YEA::ENEMY_INFO::HELP_WINDOW_Y
  926.     super(-12, dy, Graphics.width + 24, fitting_height(1))
  927.     @info_window = info_window
  928.     self.opacity = 0
  929.     self.z = 300
  930.     @text = ""
  931.     hide
  932.   end
  933.   
  934.   #--------------------------------------------------------------------------
  935.   # update
  936.   #--------------------------------------------------------------------------
  937.   def update
  938.     super
  939.     return unless YEA::ENEMY_INFO::SHOW_HELP_INFO
  940.     update_visibility
  941.     update_text
  942.   end
  943.   
  944.   #--------------------------------------------------------------------------
  945.   # update_visibility
  946.   #--------------------------------------------------------------------------
  947.   def update_visibility
  948.     return unless SceneManager.scene_is?(Scene_Battle)
  949.     return if SceneManager.scene.enemy_window.select_all?
  950.     self.visible = SceneManager.scene.enemy_window.active
  951.   end
  952.   
  953.   #--------------------------------------------------------------------------
  954.   # update_text
  955.   #--------------------------------------------------------------------------
  956.   def update_text
  957.     return unless self.visible
  958.     if @info_window.visible
  959.       text = YEA::ENEMY_INFO::HELP_INFO_SWITCH
  960.     else
  961.       text = YEA::ENEMY_INFO::HELP_INFO_SHOW
  962.     end
  963.     return if @text == text
  964.     @text = text
  965.     refresh
  966.   end
  967.   
  968.   #--------------------------------------------------------------------------
  969.   # refresh
  970.   #--------------------------------------------------------------------------
  971.   def refresh
  972.     contents.clear
  973.     reset_font_settings
  974.     draw_background
  975.     draw_text_ex(4, 0, @text)
  976.   end
  977.   
  978.   #--------------------------------------------------------------------------
  979.   # draw_background
  980.   #--------------------------------------------------------------------------
  981.   def draw_background
  982.     temp_rect = Rect.new(0, 0, contents.width / 2, contents.height)
  983.     colour1 = Color.new(0, 0, 0, 192)
  984.     colour2 = Color.new(0, 0, 0, 0)
  985.     contents.gradient_fill_rect(temp_rect, colour1, colour2)
  986.   end
  987.   
  988. end # Window_ComparisonHelp

  989. #==============================================================================
  990. # ■ Scene_Battle
  991. #==============================================================================

  992. class Scene_Battle < Scene_Base
  993.   
  994.   #--------------------------------------------------------------------------
  995.   # alias method: create_all_windows
  996.   #--------------------------------------------------------------------------
  997.   alias scene_battle_create_all_windows_eti create_all_windows
  998.   def create_all_windows
  999.     scene_battle_create_all_windows_eti
  1000.     create_comparison_windows
  1001.   end
  1002.   
  1003.   #--------------------------------------------------------------------------
  1004.   # alias method: create_comparison_windows
  1005.   #--------------------------------------------------------------------------
  1006.   def create_comparison_windows
  1007.     @actor_info_window = Window_Comparison.new(:actor)
  1008.     @enemy_info_window = Window_Comparison.new(:enemy)
  1009.     @info_help_window = Window_ComparisonHelp.new(@enemy_info_window)
  1010.   end
  1011.   
  1012.   #--------------------------------------------------------------------------
  1013.   # new method: toggle_enemy_info
  1014.   #--------------------------------------------------------------------------
  1015.   def toggle_enemy_info
  1016.     YEA::ENEMY_INFO::INFO_SFX.play
  1017.     if @enemy_info_window.visible
  1018.       hide_comparison_windows
  1019.     else
  1020.       show_comparison_windows
  1021.     end
  1022.   end
  1023.   
  1024.   #--------------------------------------------------------------------------
  1025.   # new method: enemy_info_page_up
  1026.   #--------------------------------------------------------------------------
  1027.   def enemy_info_page_up
  1028.     YEA::ENEMY_INFO::INFO_SFX.play
  1029.     @actor_info_window.page_up
  1030.     @enemy_info_window.page_up
  1031.   end
  1032.   
  1033.   #--------------------------------------------------------------------------
  1034.   # new method: enemy_info_page_down
  1035.   #--------------------------------------------------------------------------
  1036.   def enemy_info_page_down
  1037.     YEA::ENEMY_INFO::INFO_SFX.play
  1038.     @actor_info_window.page_down
  1039.     @enemy_info_window.page_down
  1040.   end
  1041.   
  1042.   #--------------------------------------------------------------------------
  1043.   # alias method: on_enemy_ok
  1044.   #--------------------------------------------------------------------------
  1045.   alias scene_battle_on_enemy_ok_eti on_enemy_ok
  1046.   def on_enemy_ok
  1047.     hide_comparison_windows
  1048.     scene_battle_on_enemy_ok_eti
  1049.   end
  1050.   
  1051.   #--------------------------------------------------------------------------
  1052.   # alias method: on_enemy_cancel
  1053.   #--------------------------------------------------------------------------
  1054.   alias scene_battle_on_enemy_cancel_eti on_enemy_cancel
  1055.   def on_enemy_cancel
  1056.     hide_comparison_windows
  1057.     scene_battle_on_enemy_cancel_eti
  1058.   end
  1059.   
  1060.   #--------------------------------------------------------------------------
  1061.   # new method: show_comparison_windows
  1062.   #--------------------------------------------------------------------------
  1063.   def show_comparison_windows
  1064.     @actor_info_window.reveal(BattleManager.actor)
  1065.     @enemy_info_window.reveal(@enemy_window.enemy)
  1066.     @info_viewport.visible = false
  1067.     @skill_window.y = Graphics.height * 2
  1068.     @item_window.y = Graphics.height * 2
  1069.     @status_aid_window.y = Graphics.height * 2
  1070.   end
  1071.   
  1072.   #--------------------------------------------------------------------------
  1073.   # new method: hide_comparison_windows
  1074.   #--------------------------------------------------------------------------
  1075.   def hide_comparison_windows
  1076.     @actor_info_window.clear
  1077.     @enemy_info_window.clear
  1078.     @info_viewport.visible = true
  1079.     @skill_window.y = Graphics.height - @skill_window.height
  1080.     @item_window.y = Graphics.height - @item_window.height
  1081.     @status_aid_window.y = Graphics.height - @status_aid_window.height
  1082.   end
  1083.   
  1084. end # Scene_Battle

  1085. end # $imported["YEA-BattleEngine"]

  1086. #==============================================================================
  1087. #
  1088. # ▼ End of File
  1089. #
  1090. #==============================================================================
复制代码


自己修改的精英敌人脚本(格式自己画葫芦就行)
  1. =begin
  2. # 精英敌人,作者:66RPG的tan12345
  3. # 功能:遇敌时,敌人有一定几率(可设定)变成精英,精英怪比普通怪属性有加成(可修改),
  4. #       当然了,精英怪的经验、金钱、掉落率也同样有加成。
  5. #       也可以设定指定的敌人不会变成精英(比如BOSS)
  6. #
  7. # 使用方法:将脚本插入到main上
  8. #
  9. =end

  10. module Tan_by_enemy_set
  11.   #精英怪出现几率,30代表30%
  12.   Tan_enemy_by = 30
  13.   Tan_king_by = 10
  14.   Tan_god_by = 5
  15.   #Tan_enemy_by_num = 2 2倍属性
  16. #~ ##~   Tan_enemy_by_egold = 3 3倍金钱
  17. #   Tan_enemy_by_eexp = 3 3倍经验
  18. #~ ##~   Tan_enemy_by_edrop = 3 3倍掉落率
  19.   Tan_enemy_by_num = 1.25
  20.   Tan_enemy_by_egold = 1.25
  21.   Tan_enemy_by_eexp = 1.25
  22.   Tan_enemy_by_edrop = 1.25
  23.   Tan_king_num = 1.5
  24.   Tan_king_gold = 1.5
  25.   Tan_king_exp = 1.5
  26.   Tan_king_drop = 1.5
  27.   Tan_god_num = 2
  28.   Tan_god_gold = 2
  29.   Tan_god_exp = 2
  30.   Tan_god_drop = 2
  31.   #不会成为精英的敌人
  32.   NO_BY_ENEMY = [28,29,30,31,32,33,34,35,36,37,38,39,40,43,44,45,46,47,48,49,50,52,51,53,54,55,61,62,63,65,66,67,68,69,70,71,72,73,75,74,76]#表示2号和3号敌人不会变成精英,适合设定BOSS
  33. end
  34. class Game_Enemy < Game_Battler
  35.   
  36.   attr_reader   :is_by  # 是否精英
  37.   attr_reader   :is_king  # 是否精英
  38.   attr_reader   :is_god  # 是否精英
  39.   
  40.   #--------------------------------------------------------------------------
  41.   # ● 精英初始化
  42.   #--------------------------------------------------------------------------
  43.   def init_by_enemy
  44.     @is_by = false
  45.     @is_king = false
  46.     @is_god = false
  47.    
  48.     @is_by = true if rand(100) <= Tan_by_enemy_set::Tan_enemy_by && !Tan_by_enemy_set::NO_BY_ENEMY.include?(enemy_id)
  49.     @original_name = @original_name + "奇才" if @is_by == true
  50.    
  51.     @is_king = true if rand(100) <= Tan_by_enemy_set::Tan_king_by && !Tan_by_enemy_set::NO_BY_ENEMY.include?(enemy_id)
  52.     @original_name = @original_name + "王者" if @is_king == true
  53.    
  54.      @is_god = true if rand(100) <= Tan_by_enemy_set::Tan_god_by && !Tan_by_enemy_set::NO_BY_ENEMY.include?(enemy_id)
  55.     @original_name = @original_name + "神" if @is_god == true
  56.     @hp = mhp
  57.     @mp = mmp
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ● 是否精英
  61.   #--------------------------------------------------------------------------
  62.   def is_by?
  63.     return true if @is_by
  64.     return false
  65.    
  66.   end
  67.   
  68.    def is_king?
  69.     return true if @is_king
  70.     return false
  71.   end
  72.    def is_god?
  73.     return true if @is_god
  74.     return false
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● 初始化对象
  78.   #--------------------------------------------------------------------------
  79.   alias tan_by_enemy_initialize initialize
  80.   def initialize(index, enemy_id)
  81.     tan_by_enemy_initialize(index, enemy_id)
  82.     init_by_enemy
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● 获取普通能力的基础值
  86.   #--------------------------------------------------------------------------
  87.   alias tan_by_enemy_param_base param_base
  88.   def param_base(param_id)
  89.     v = tan_by_enemy_param_base(param_id)
  90.     v *= Tan_by_enemy_set::Tan_enemy_by_num if is_by?
  91.     v *= Tan_by_enemy_set::Tan_king_num if is_king?
  92.     v *= Tan_by_enemy_set::Tan_god_num if is_god?
  93.     return v.to_i
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # ● 获取经验值
  97.   #--------------------------------------------------------------------------
  98.   alias tan_by_enemy_exp exp
  99.   def exp
  100.     v = tan_by_enemy_exp
  101.     v *= Tan_by_enemy_set::Tan_enemy_by_eexp if is_by?
  102.     v *= Tan_by_enemy_set::Tan_king_exp if is_king?
  103.     v *= Tan_by_enemy_set::Tan_god_exp if is_god?
  104.     return v.to_i
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 获取金钱
  108.   #--------------------------------------------------------------------------
  109.   alias tan_by_enemy_gold gold
  110.   def gold
  111.     v = tan_by_enemy_gold
  112.     v *= Tan_by_enemy_set::Tan_enemy_by_egold if is_by?
  113.     v *= Tan_by_enemy_set::Tan_king_gold if is_king?
  114.     v *= Tan_by_enemy_set::Tan_god_gold if is_god?
  115.     return v.to_i
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # ● 获取物品掉率的倍率
  119.   #--------------------------------------------------------------------------
  120.   alias tan_by_enemy_drop_item_rate drop_item_rate
  121.   def drop_item_rate
  122.     v = tan_by_enemy_drop_item_rate
  123.     v *= Tan_by_enemy_set::Tan_enemy_by_edrop if is_by?
  124.     v *= Tan_by_enemy_set::Tan_king_drop if is_king?
  125.     v *= Tan_by_enemy_set::Tan_god_drop if is_god?
  126.     return v
  127.   end
  128. end
复制代码


物品菜单强化
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Ace Item Menu v1.02
  4. # -- Last Updated: 2012.01.05
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-ItemMenu"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.05 - Compatibility Update with Equip Dynamic Stats.
  15. # 2012.01.03 - Started Script and Finished.
  16. #            - Compatibility Update with Ace Menu Engine.
  17. #
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # The Ace Item Menu offers more item categorization control and a better layout
  22. # that simulatenously provides information regarding the items to the player,
  23. # while keeping a good amount of the item list visible on screen at once. The
  24. # script can also be customized to rearrange commands and categories.
  25. #
  26. #==============================================================================
  27. # ▼ Instructions
  28. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  29. # To install this script, open up your script editor and copy/paste this script
  30. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  31. #
  32. # -----------------------------------------------------------------------------
  33. # Item Notetags - These notetags go in the item notebox in the database.
  34. # -----------------------------------------------------------------------------
  35. # <category: string>
  36. # Places this object into the item category for "string". Whenever the selected
  37. # category is highlighted in the Ace Item Menu command window, this object will
  38. # be included and shown in the item window.
  39. #
  40. # <image: string>
  41. # Uses a picture from Graphics\Pictures\ of your RPG Maker VX Ace Project's
  42. # directory with the filename of "string" (without the extension) as the image
  43. # picture shown in the Ace Item Menu.
  44. #
  45. # -----------------------------------------------------------------------------
  46. # Weapon Notetags - These notetags go in the weapon notebox in the database.
  47. # -----------------------------------------------------------------------------
  48. # <category: string>
  49. # Places this object into the item category for "string". Whenever the selected
  50. # category is highlighted in the Ace Item Menu command window, this object will
  51. # be included and shown in the item window.
  52. #
  53. # <image: string>
  54. # Uses a picture from Graphics\Pictures\ of your RPG Maker VX Ace Project's
  55. # directory with the filename of "string" (without the extension) as the image
  56. # picture shown in the Ace Item Menu.
  57. #
  58. # -----------------------------------------------------------------------------
  59. # Armour Notetags - These notetags go in the armour notebox in the database.
  60. # -----------------------------------------------------------------------------
  61. # <category: string>
  62. # Places this object into the item category for "string". Whenever the selected
  63. # category is highlighted in the Ace Item Menu command window, this object will
  64. # be included and shown in the item window.
  65. #
  66. # <image: string>
  67. # Uses a picture from Graphics\Pictures\ of your RPG Maker VX Ace Project's
  68. # directory with the filename of "string" (without the extension) as the image
  69. # picture shown in the Ace Item Menu.
  70. #
  71. #==============================================================================
  72. # ▼ Compatibility
  73. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  74. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  75. # it will run with RPG Maker VX without adjusting.
  76. #
  77. #==============================================================================

  78. module YEA
  79.   module ITEM
  80.    
  81.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  82.     # - Item Command Settings -
  83.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  84.     # This array adjusts what options appear in the initial item command window
  85.     # before the items are split into separate categories. Add commands, remove
  86.     # commands, or rearrange them. Here's a list of which does what:
  87.     #
  88.     # -------------------------------------------------------------------------
  89.     # :command         Description
  90.     # -------------------------------------------------------------------------
  91.     # :item            Opens up the various item categories. Default.
  92.     # :weapon          Opens up the various weapon categories. Default.
  93.     # :armor           Opens up the various armour categories. Default.
  94.     # :key_item        Shows a list of the various key items. Default.
  95.     #
  96.     # :gogototori      Requires Kread-EX's Go Go Totori Synthesis.
  97.     #
  98.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  99.     COMMANDS =[
  100.       :item,         # Opens up the various item categories. Default.
  101.       :weapon,       # Opens up the various weapon categories. Default.
  102.       :armor,        # Opens up the various armour categories. Default.
  103.       :key_item,     # Shows a list of the various key items. Default.
  104.       :gogototori,   # Requires Kread-EX's Go Go Totori Synthesis.
  105.     # :custom1,      # Custom command 1.
  106.     # :custom2,      # Custom command 2.
  107.     ] # Do not remove this.
  108.    
  109.     #--------------------------------------------------------------------------
  110.     # - Item Custom Commands -
  111.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  112.     # For those who use scripts to that may produce unique effects for the item
  113.     # scene, use this hash to manage the custom commands for the Item Command
  114.     # Window. You can disable certain commands or prevent them from appearing
  115.     # by using switches. If you don't wish to bind them to a switch, set the
  116.     # proper switch to 0 for it to have no impact.
  117.     #--------------------------------------------------------------------------
  118.     CUSTOM_ITEM_COMMANDS ={
  119.     # :command => ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
  120.       :gogototori => ["合成",            0,         0, :command_totori],
  121.       :custom1 => [ "自定義名稱",            0,          0, :command_name1],
  122.       :custom2 => [ "自定義文本",           13,          0, :command_name2],
  123.     } # Do not remove this.
  124.    
  125.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  126.     # - Item Type Settings -
  127.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  128.     # These arrays adjusts and shows the various item types shown for Items,
  129.     # Weapons, and Armours. Note that when using :category symbols, the
  130.     # specific category shown will be equal to the text used for the Display
  131.     # and the included item must contain a category equal to the Display name.
  132.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  133.     # This array contains the order for the Item categories.
  134.     ITEM_TYPES =[
  135.     # [  :symbol,   "Display"],
  136.       [:all,       "全部"], # Shows all usable items.
  137.       [:field,     "背包内"], # Shows Menu-usable items.
  138.       [:battle,    "战斗用"], # Shows Battle-usable items.
  139.       [:category,   "材料"], # Categorized by <category: 材料>
  140.       [:category,"特别"], # Categorized by <category: 特别>
  141.       [:category,"石头"], # Categorized by <category: 石头>
  142.       [:category,"宝珠"], # Categorized by <category: 宝珠>
  143.       [:category,"药剂"], # Categorized by <category: 技能书>
  144.       [:category,"技能书"], # Categorized by <category: 药剂>
  145.       [:category,"宝物"], # Categorized by <category: 宝物>
  146.       [:category,  "进阶"], # Shows all key items.
  147.     ] # Do not remove this.
  148.    
  149.     # This array contains the order for the Weapon categories.
  150.     WEAPON_TYPES =[
  151.     # [  :symbol,   "Display"],
  152.       [   :types,  "WPNTYPES"], # Lists all of the individual weapon types.
  153.       [     :all,       "全部"], # Shows all weapons.
  154.     ] # Do not remove this.
  155.    
  156.     # This array contains the order for the Armour categories.
  157.     ARMOUR_TYPES =[
  158.     # [  :symbol,   "Display"],
  159.       [   :slots,  "ARMSLOTS"], # Lists all of the individual armour slots.
  160.       [   :types,  "ARMTYPES"], # Lists all of the individual armours types.
  161.       [     :all,       "全部"], # Shows all armours.
  162.     ] # Do not remove this.
  163.    
  164.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  165.     # - Item Status Settings -
  166.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  167.     # The item status window displays information about the item in detail.
  168.     # Adjust the settings below to change the way the status window appears.
  169.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  170.     STATUS_FONT_SIZE = 20       # Font size used for status window.
  171.     MAX_ICONS_DRAWN  = 10       # Maximum number of icons drawn for states.
  172.    
  173.     # The following adjusts the vocabulary used for the status window. Each
  174.     # of the vocabulary settings are self explanatory.
  175.     VOCAB_STATUS ={
  176.       :empty      => "---",          # Text used when nothing is shown.
  177.       :hp_recover => "回复血量",      # Text used for HP Recovery.
  178.       :mp_recover => "回复魔法",      # Text used for MP Recovery.
  179.       :tp_recover => "回复TP",      # Text used for TP Recovery.
  180.       :tp_gain    => "增加TP",      # Text used for TP Gain.
  181.       :applies    => "增加效果",      # Text used for applied states and buffs.
  182.       :removes    => "移除效果",      # Text used for removed states and buffs.
  183.     } # Do not remove this.
  184.    
  185.   end # ITEM
  186. end # YEA

  187. #==============================================================================
  188. # ▼ Editting anything past this point may potentially result in causing
  189. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  190. # halitosis so edit at your own risk.
  191. #==============================================================================

  192. module YEA
  193.   module REGEXP
  194.   module BASEITEM
  195.    
  196.     CATEGORY = /<(?:CATEGORIES|category):[ ](.*)>/i
  197.     IMAGE    = /<(?:IMAGE|image):[ ](.*)>/i
  198.    
  199.   end # BASEITEM
  200.   end # REGEXP
  201. end # YEA

  202. #==============================================================================
  203. # ■ Numeric
  204. #==============================================================================

  205. class Numeric
  206.   
  207.   #--------------------------------------------------------------------------
  208.   # new method: group_digits
  209.   #--------------------------------------------------------------------------
  210.   unless $imported["YEA-CoreEngine"]
  211.   def group; return self.to_s; end
  212.   end # $imported["YEA-CoreEngine"]
  213.    
  214. end # Numeric

  215. #==============================================================================
  216. # ■ Vocab
  217. #==============================================================================

  218. module Vocab
  219.   
  220.   #--------------------------------------------------------------------------
  221.   # new method: self.item_status
  222.   #--------------------------------------------------------------------------
  223.   def self.item_status(type)
  224.     return YEA::ITEM::VOCAB_STATUS[type]
  225.   end
  226.   
  227. end # Vocab

  228. #==============================================================================
  229. # ■ DataManager
  230. #==============================================================================

  231. module DataManager
  232.   
  233.   #--------------------------------------------------------------------------
  234.   # alias method: load_database
  235.   #--------------------------------------------------------------------------
  236.   class <<self; alias load_database_aim load_database; end
  237.   def self.load_database
  238.     load_database_aim
  239.     load_notetags_aim
  240.   end
  241.   
  242.   #--------------------------------------------------------------------------
  243.   # new method: load_notetags_aim
  244.   #--------------------------------------------------------------------------
  245.   def self.load_notetags_aim
  246.     groups = [$data_items, $data_weapons, $data_armors]
  247.     for group in groups
  248.       for obj in group
  249.         next if obj.nil?
  250.         obj.load_notetags_aim
  251.       end
  252.     end
  253.   end
  254.   
  255. end # DataManager

  256. #==============================================================================
  257. # ■ RPG::BaseItem
  258. #==============================================================================

  259. class RPG::BaseItem
  260.   
  261.   #--------------------------------------------------------------------------
  262.   # public instance variables
  263.   #--------------------------------------------------------------------------
  264.   attr_accessor :category
  265.   attr_accessor :image
  266.   
  267.   #--------------------------------------------------------------------------
  268.   # common cache: load_notetags_aim
  269.   #--------------------------------------------------------------------------
  270.   def load_notetags_aim
  271.     @category = []
  272.     #---
  273.     self.note.split(/[\r\n]+/).each { |line|
  274.       case line
  275.       #---
  276.       when YEA::REGEXP::BASEITEM::CATEGORY
  277.         @category.push($1.upcase.to_s)
  278.       when YEA::REGEXP::BASEITEM::IMAGE
  279.         @image = $1.to_s
  280.       end
  281.     } # self.note.split
  282.     #---
  283.   end
  284.   
  285. end # RPG::BaseItem

  286. #==============================================================================
  287. # ■ Game_Temp
  288. #==============================================================================

  289. class Game_Temp
  290.   
  291.   #--------------------------------------------------------------------------
  292.   # public instance variables
  293.   #--------------------------------------------------------------------------
  294.   attr_accessor :scene_item_index
  295.   attr_accessor :scene_item_oy
  296.   
  297. end # Game_Temp

  298. #==============================================================================
  299. # ■ Window_ItemList
  300. #==============================================================================

  301. class Window_ItemList < Window_Selectable
  302.   
  303.   #--------------------------------------------------------------------------
  304.   # overwrite method: draw_item
  305.   #--------------------------------------------------------------------------
  306.   def draw_item(index)
  307.     item = @data[index]
  308.     return if item.nil?
  309.     rect = item_rect(index)
  310.     rect.width -= 4
  311.     draw_item_name(item, rect.x, rect.y, enable?(item), rect.width - 24)
  312.     draw_item_number(rect, item)
  313.   end
  314.   
  315. end # Window_ItemList

  316. #==============================================================================
  317. # ■ Window_ItemCommand
  318. #==============================================================================

  319. class Window_ItemCommand < Window_Command
  320.   
  321.   #--------------------------------------------------------------------------
  322.   # public instance variables
  323.   #--------------------------------------------------------------------------
  324.   attr_reader   :item_window
  325.   
  326.   #--------------------------------------------------------------------------
  327.   # initialize
  328.   #--------------------------------------------------------------------------
  329.   def initialize(x, y)
  330.     super(x, y)
  331.   end
  332.   
  333.   #--------------------------------------------------------------------------
  334.   # window_width
  335.   #--------------------------------------------------------------------------
  336.   def window_width; return 160; end
  337.   
  338.   #--------------------------------------------------------------------------
  339.   # visible_line_number
  340.   #--------------------------------------------------------------------------
  341.   def visible_line_number; return 4; end
  342.   
  343.   #--------------------------------------------------------------------------
  344.   # process_ok
  345.   #--------------------------------------------------------------------------
  346.   def process_ok
  347.     $game_temp.scene_item_index = index
  348.     $game_temp.scene_item_oy = self.oy
  349.     super
  350.   end
  351.   
  352.   #--------------------------------------------------------------------------
  353.   # make_command_list
  354.   #--------------------------------------------------------------------------
  355.   def make_command_list
  356.     for command in YEA::ITEM::COMMANDS
  357.       case command
  358.       #--- Default Commands ---
  359.       when :item
  360.         add_command(Vocab::item, :item)
  361.       when :weapon
  362.         add_command(Vocab::weapon, :weapon)
  363.       when :armor
  364.         add_command(Vocab::armor, :armor)
  365.       when :key_item
  366.         add_command(Vocab::key_item, :key_item)
  367.       #--- Imported ---
  368.       when :gogototori
  369.         next unless $imported["KRX-AlchemicSynthesis"]
  370.         process_custom_command(command)
  371.       #--- Custom Commands ---
  372.       else
  373.         process_custom_command(command)
  374.       end
  375.     end
  376.   end
  377.   
  378.   #--------------------------------------------------------------------------
  379.   # process_custom_command
  380.   #--------------------------------------------------------------------------
  381.   def process_custom_command(command)
  382.     return unless YEA::ITEM::CUSTOM_ITEM_COMMANDS.include?(command)
  383.     show = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][2]
  384.     continue = show <= 0 ? true : $game_switches[show]
  385.     return unless continue
  386.     text = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][0]
  387.     switch = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][1]
  388.     enabled = switch <= 0 ? true : $game_switches[switch]
  389.     add_command(text, command, enabled)
  390.   end
  391.   
  392.   #--------------------------------------------------------------------------
  393.   # update
  394.   #--------------------------------------------------------------------------
  395.   def update
  396.     super
  397.     return unless self.active
  398.     @item_window.category = current_symbol if @item_window
  399.   end
  400.   
  401.   #--------------------------------------------------------------------------
  402.   # item_window=
  403.   #--------------------------------------------------------------------------
  404.   def item_window=(item_window)
  405.     @item_window = item_window
  406.     update
  407.   end
  408.   
  409. end # Window_ItemCommand

  410. #==============================================================================
  411. # ■ Window_ItemType
  412. #==============================================================================

  413. class Window_ItemType < Window_Command
  414.   
  415.   #--------------------------------------------------------------------------
  416.   # public instance variables
  417.   #--------------------------------------------------------------------------
  418.   attr_reader   :item_window
  419.   
  420.   #--------------------------------------------------------------------------
  421.   # initialize
  422.   #--------------------------------------------------------------------------
  423.   def initialize(x, y)
  424.     super(x, y)
  425.     deactivate
  426.     @type = nil
  427.   end
  428.   
  429.   #--------------------------------------------------------------------------
  430.   # window_width
  431.   #--------------------------------------------------------------------------
  432.   def window_width; return 160; end
  433.   
  434.   #--------------------------------------------------------------------------
  435.   # visible_line_number
  436.   #--------------------------------------------------------------------------
  437.   def visible_line_number; return 4; end
  438.   
  439.   #--------------------------------------------------------------------------
  440.   # reveal
  441.   #--------------------------------------------------------------------------
  442.   def reveal(type)
  443.     @type = type
  444.     refresh
  445.     activate
  446.     select(0)
  447.   end
  448.   
  449.   #--------------------------------------------------------------------------
  450.   # make_command_list
  451.   #--------------------------------------------------------------------------
  452.   def make_command_list
  453.     return if @type.nil?
  454.     #---
  455.     case @type
  456.     when :item
  457.       commands = YEA::ITEM::ITEM_TYPES
  458.     when :weapon
  459.       commands = YEA::ITEM::WEAPON_TYPES
  460.     else
  461.       commands = YEA::ITEM::ARMOUR_TYPES
  462.     end
  463.     #---
  464.     for command in commands
  465.       case command[0]
  466.       #---
  467.       when :types
  468.         case @type
  469.         when :weapon
  470.           for i in 1...$data_system.weapon_types.size
  471.             name = $data_system.weapon_types[i]
  472.             add_command(name, :w_type, true, i)
  473.           end
  474.         else
  475.           for i in 1...$data_system.armor_types.size
  476.             name = $data_system.armor_types[i]
  477.             add_command(name, :a_type, true, i)
  478.           end
  479.         end
  480.       #---
  481.       when :slots
  482.         if $imported["YEA-AceEquipEngine"]
  483.           maximum = 1
  484.           for key in YEA::EQUIP::TYPES
  485.             maximum = [maximum, key[0]].max
  486.           end
  487.         else
  488.           maximum = 4
  489.         end
  490.         for i in 1..maximum
  491.           name = Vocab::etype(i)
  492.           add_command(name, :e_type, true, i) if name != ""
  493.         end
  494.       #---
  495.       else
  496.         add_command(command[1], command[0], true, @type)
  497.       end
  498.     end
  499.   end
  500.   
  501.   #--------------------------------------------------------------------------
  502.   # update
  503.   #--------------------------------------------------------------------------
  504.   def update
  505.     super
  506.     return unless self.active
  507.     @item_window.category = current_symbol if @item_window
  508.   end
  509.   
  510.   #--------------------------------------------------------------------------
  511.   # item_window=
  512.   #--------------------------------------------------------------------------
  513.   def item_window=(item_window)
  514.     @item_window = item_window
  515.     update
  516.   end
  517.   
  518. end # Window_ItemType

  519. #==============================================================================
  520. # ■ Window_ItemList
  521. #==============================================================================

  522. class Window_ItemList < Window_Selectable
  523.   
  524.   #--------------------------------------------------------------------------
  525.   # alias method: initialize
  526.   #--------------------------------------------------------------------------
  527.   alias window_itemlist_initialize_aim initialize
  528.   def initialize(dx, dy, dw, dh)
  529.     window_itemlist_initialize_aim(dx, dy, dw, dh)
  530.     @ext = :none
  531.     @name = ""
  532.   end
  533.   
  534.   #--------------------------------------------------------------------------
  535.   # alias method: category=
  536.   #--------------------------------------------------------------------------
  537.   alias window_itemlist_category_aim category=
  538.   def category=(category)
  539.     if @types_window.nil?
  540.       window_itemlist_category_aim(category)
  541.     else
  542.       return unless update_types?(category)
  543.       @category = category
  544.       if @types_window.active
  545.         @name = @types_window.current_data[:name]
  546.         @ext = @types_window.current_ext
  547.       end
  548.       refresh
  549.       self.oy = 0
  550.     end
  551.   end
  552.   
  553.   #--------------------------------------------------------------------------
  554.   # new method: update_types?
  555.   #--------------------------------------------------------------------------
  556.   def update_types?(category)
  557.     return true if @category != category
  558.     return false unless @types_window.active
  559.     if category == :category
  560.       return @name != @types_window.current_data[:name]
  561.     end
  562.     return @ext != @types_window.current_ext
  563.   end
  564.   
  565.   #--------------------------------------------------------------------------
  566.   # new method: types_window=
  567.   #--------------------------------------------------------------------------
  568.   def types_window=(window)
  569.     @types_window = window
  570.   end
  571.   
  572.   #--------------------------------------------------------------------------
  573.   # alias method: include?
  574.   #--------------------------------------------------------------------------
  575.   alias window_itemlist_include_aim include?
  576.   def include?(item)
  577.     if @types_window.nil?
  578.       return window_itemlist_include_aim(item)
  579.     else
  580.       return ace_item_menu_include?(item)
  581.     end
  582.   end
  583.   
  584.   #--------------------------------------------------------------------------
  585.   # new method: ace_item_menu_include?
  586.   #--------------------------------------------------------------------------
  587.   def ace_item_menu_include?(item)
  588.     case @category
  589.     #---
  590.     when :field
  591.       return false unless item.is_a?(RPG::Item)
  592.       return item.menu_ok?
  593.     when :battle
  594.       return false unless item.is_a?(RPG::Item)
  595.       return item.battle_ok?
  596.     #---
  597.     when :w_type
  598.       return false unless item.is_a?(RPG::Weapon)
  599.       return item.wtype_id == @types_window.current_ext
  600.     when :a_type
  601.       return false unless item.is_a?(RPG::Armor)
  602.       return item.atype_id == @types_window.current_ext
  603.     when :e_type
  604.       return false unless item.is_a?(RPG::Armor)
  605.       return item.etype_id == @types_window.current_ext
  606.     #---
  607.     when :all
  608.       case @types_window.current_ext
  609.       when :item
  610.         return item.is_a?(RPG::Item)
  611.       when :weapon
  612.         return item.is_a?(RPG::Weapon)
  613.       else
  614.         return item.is_a?(RPG::Armor)
  615.       end
  616.     #---
  617.     when :category
  618.       case @types_window.current_ext
  619.       when :item
  620.         return false unless item.is_a?(RPG::Item)
  621.       when :weapon
  622.         return false unless item.is_a?(RPG::Weapon)
  623.       else
  624.         return false unless item.is_a?(RPG::Armor)
  625.       end
  626.       return item.category.include?(@types_window.current_data[:name].upcase)
  627.     #---
  628.     else
  629.       return window_itemlist_include_aim(item)
  630.     end
  631.   end
  632.   
  633. end # Window_ItemList

  634. #==============================================================================
  635. # ■ Window_ItemStatus
  636. #==============================================================================

  637. class Window_ItemStatus < Window_Base
  638.   
  639.   #--------------------------------------------------------------------------
  640.   # initialize
  641.   #--------------------------------------------------------------------------
  642.   def initialize(dx, dy, item_window)
  643.     super(dx, dy, Graphics.width - dx, fitting_height(4))
  644.     @item_window = item_window
  645.     @item = nil
  646.     refresh
  647.   end
  648.   
  649.   #--------------------------------------------------------------------------
  650.   # update
  651.   #--------------------------------------------------------------------------
  652.   def update
  653.     super
  654.     update_item(@item_window.item)
  655.   end
  656.   
  657.   #--------------------------------------------------------------------------
  658.   # update_item
  659.   #--------------------------------------------------------------------------
  660.   def update_item(item)
  661.     return if @item == item
  662.     @item = item
  663.     refresh
  664.   end
  665.   
  666.   #--------------------------------------------------------------------------
  667.   # refresh
  668.   #--------------------------------------------------------------------------
  669.   def refresh
  670.     contents.clear
  671.     reset_font_settings
  672.     return draw_empty if @item.nil?
  673.     contents.font.size = YEA::ITEM::STATUS_FONT_SIZE
  674.     draw_item_image
  675.     draw_item_stats
  676.     draw_item_effects
  677.   end
  678.   
  679.   #--------------------------------------------------------------------------
  680.   # draw_empty
  681.   #--------------------------------------------------------------------------
  682.   def draw_empty
  683.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  684.     rect = Rect.new(1, 1, 94, 94)
  685.     contents.fill_rect(rect, colour)
  686.     dx = 96; dy = 0
  687.     dw = (contents.width - 96) / 2
  688.     for i in 0...8
  689.       draw_background_box(dx, dy, dw)
  690.       dx = dx >= 96 + dw ? 96 : 96 + dw
  691.       dy += line_height if dx == 96
  692.     end
  693.   end
  694.   
  695.   #--------------------------------------------------------------------------
  696.   # draw_background_box
  697.   #--------------------------------------------------------------------------
  698.   def draw_background_box(dx, dy, dw)
  699.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  700.     rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  701.     contents.fill_rect(rect, colour)
  702.   end
  703.   
  704.   #--------------------------------------------------------------------------
  705.   # draw_item_image
  706.   #--------------------------------------------------------------------------
  707.   def draw_item_image
  708.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  709.     rect = Rect.new(1, 1, 94, 94)
  710.     contents.fill_rect(rect, colour)
  711.     if @item.image.nil?
  712.       icon_index = @item.icon_index
  713.       bitmap = Cache.system("Iconset")
  714.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  715.       target = Rect.new(0, 0, 96, 96)
  716.       contents.stretch_blt(target, bitmap, rect)
  717.     else
  718.       bitmap = Cache.picture(@item.image)
  719.       contents.blt(0, 0, bitmap, bitmap.rect, 255)
  720.     end
  721.   end
  722.   
  723.   #--------------------------------------------------------------------------
  724.   # draw_item_stats
  725.   #--------------------------------------------------------------------------
  726.   def draw_item_stats
  727.     return unless @item.is_a?(RPG::Weapon) || @item.is_a?(RPG::Armor)
  728.     dx = 96; dy = 0
  729.     dw = (contents.width - 96) / 2
  730.     for i in 0...8
  731.       draw_equip_param(i, dx, dy, dw)
  732.       dx = dx >= 96 + dw ? 96 : 96 + dw
  733.       dy += line_height if dx == 96
  734.     end
  735.   end
  736.   
  737.   #--------------------------------------------------------------------------
  738.   # draw_equip_param
  739.   #--------------------------------------------------------------------------
  740.   def draw_equip_param(param_id, dx, dy, dw)
  741.     draw_background_box(dx, dy, dw)
  742.     change_color(system_color)
  743.     draw_text(dx+4, dy, dw-8, line_height, Vocab::param(param_id))
  744.     if $imported["YEA-EquipDynamicStats"]
  745.       draw_percentage_param(param_id, dx, dy, dw)
  746.     else
  747.       draw_set_param(param_id, dx, dy, dw)
  748.     end
  749.   end
  750.   
  751.   #--------------------------------------------------------------------------
  752.   # draw_percentage_param
  753.   #--------------------------------------------------------------------------
  754.   def draw_percentage_param(param_id, dx, dy, dw)
  755.     if @item.per_params[param_id] != 0 && @item.params[param_id] != 0
  756.       text = draw_set_param(param_id, dx, dy, dw)
  757.       dw -= text_size(text).width
  758.       draw_percent_param(param_id, dx, dy, dw)
  759.     elsif @item.per_params[param_id] != 0 && @item.params[param_id] == 0
  760.       draw_percent_param(param_id, dx, dy, dw)
  761.     else
  762.       draw_set_param(param_id, dx, dy, dw)
  763.     end
  764.   end
  765.   
  766.   #--------------------------------------------------------------------------
  767.   # draw_set_param
  768.   #--------------------------------------------------------------------------
  769.   def draw_set_param(param_id, dx, dy, dw)
  770.     value = @item.params[param_id]
  771.     if $imported["YEA-EquipDynamicStats"] && @item.var_params[param_id] > 0
  772.       value += $game_variables[@item.var_params[param_id]] rescue 0
  773.     end
  774.     change_color(param_change_color(value), value != 0)
  775.     text = value.group
  776.     text = "+" + text if value > 0
  777.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  778.     return text
  779.   end
  780.   
  781.   #--------------------------------------------------------------------------
  782.   # draw_percent_param
  783.   #--------------------------------------------------------------------------
  784.   def draw_percent_param(param_id, dx, dy, dw)
  785.     value = @item.per_params[param_id]
  786.     change_color(param_change_color(value))
  787.     text = (@item.per_params[param_id] * 100).to_i.group + "%"
  788.     text = "+" + text if @item.per_params[param_id] > 0
  789.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  790.     return text
  791.   end
  792.   
  793.   #--------------------------------------------------------------------------
  794.   # draw_item_effects
  795.   #--------------------------------------------------------------------------
  796.   def draw_item_effects
  797.     return unless @item.is_a?(RPG::Item)
  798.     dx = 96; dy = 0
  799.     dw = (contents.width - 96) / 2
  800.     draw_hp_recover(dx, dy + line_height * 0, dw)
  801.     draw_mp_recover(dx, dy + line_height * 1, dw)
  802.     draw_tp_recover(dx + dw, dy + line_height * 0, dw)
  803.     draw_tp_gain(dx + dw, dy + line_height * 1, dw)
  804.     dw = contents.width - 96
  805.     draw_applies(dx, dy + line_height * 2, dw)
  806.     draw_removes(dx, dy + line_height * 3, dw)
  807.   end
  808.   
  809.   #--------------------------------------------------------------------------
  810.   # draw_hp_recover
  811.   #--------------------------------------------------------------------------
  812.   def draw_hp_recover(dx, dy, dw)
  813.     draw_background_box(dx, dy, dw)
  814.     change_color(system_color)
  815.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:hp_recover))
  816.     per = 0
  817.     set = 0
  818.     for effect in @item.effects
  819.       next unless effect.code == 11
  820.       per += (effect.value1 * 100).to_i
  821.       set += effect.value2.to_i
  822.     end
  823.     if per != 0 && set != 0
  824.       change_color(param_change_color(set))
  825.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  826.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  827.       dw -= text_size(text).width
  828.       change_color(param_change_color(per))
  829.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  830.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  831.       return
  832.     elsif per != 0
  833.       change_color(param_change_color(per))
  834.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  835.     elsif set != 0
  836.       change_color(param_change_color(set))
  837.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  838.     else
  839.       change_color(normal_color, false)
  840.       text = Vocab::item_status(:empty)
  841.     end
  842.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  843.   end
  844.   
  845.   #--------------------------------------------------------------------------
  846.   # draw_mp_recover
  847.   #--------------------------------------------------------------------------
  848.   def draw_mp_recover(dx, dy, dw)
  849.     draw_background_box(dx, dy, dw)
  850.     change_color(system_color)
  851.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:mp_recover))
  852.     per = 0
  853.     set = 0
  854.     for effect in @item.effects
  855.       next unless effect.code == 12
  856.       per += (effect.value1 * 100).to_i
  857.       set += effect.value2.to_i
  858.     end
  859.     if per != 0 && set != 0
  860.       change_color(param_change_color(set))
  861.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  862.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  863.       dw -= text_size(text).width
  864.       change_color(param_change_color(per))
  865.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  866.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  867.       return
  868.     elsif per != 0
  869.       change_color(param_change_color(per))
  870.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  871.     elsif set != 0
  872.       change_color(param_change_color(set))
  873.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  874.     else
  875.       change_color(normal_color, false)
  876.       text = Vocab::item_status(:empty)
  877.     end
  878.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  879.   end
  880.   
  881.   #--------------------------------------------------------------------------
  882.   # draw_tp_recover
  883.   #--------------------------------------------------------------------------
  884.   def draw_tp_recover(dx, dy, dw)
  885.     draw_background_box(dx, dy, dw)
  886.     change_color(system_color)
  887.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:tp_recover))
  888.     set = 0
  889.     for effect in @item.effects
  890.       next unless effect.code == 13
  891.       set += effect.value1.to_i
  892.     end
  893.     if set != 0
  894.       change_color(param_change_color(set))
  895.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  896.     else
  897.       change_color(normal_color, false)
  898.       text = Vocab::item_status(:empty)
  899.     end
  900.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  901.   end
  902.   
  903.   #--------------------------------------------------------------------------
  904.   # draw_tp_gain
  905.   #--------------------------------------------------------------------------
  906.   def draw_tp_gain(dx, dy, dw)
  907.     draw_background_box(dx, dy, dw)
  908.     change_color(system_color)
  909.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:tp_gain))
  910.     set = @item.tp_gain
  911.     if set != 0
  912.       change_color(param_change_color(set))
  913.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  914.     else
  915.       change_color(normal_color, false)
  916.       text = Vocab::item_status(:empty)
  917.     end
  918.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  919.   end
  920.   
  921.   #--------------------------------------------------------------------------
  922.   # draw_applies
  923.   #--------------------------------------------------------------------------
  924.   def draw_applies(dx, dy, dw)
  925.     draw_background_box(dx, dy, dw)
  926.     change_color(system_color)
  927.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:applies))
  928.     icons = []
  929.     for effect in @item.effects
  930.       case effect.code
  931.       when 21
  932.         next unless effect.value1 > 0
  933.         next if $data_states[effect.value1].nil?
  934.         icons.push($data_states[effect.data_id].icon_index)
  935.       when 31
  936.         icons.push($game_actors[1].buff_icon_index(1, effect.data_id))
  937.       when 32
  938.         icons.push($game_actors[1].buff_icon_index(-1, effect.data_id))
  939.       end
  940.       icons.delete(0)
  941.       break if icons.size >= YEA::ITEM::MAX_ICONS_DRAWN
  942.     end
  943.     draw_icons(dx, dy, dw, icons)
  944.   end
  945.   
  946.   #--------------------------------------------------------------------------
  947.   # draw_removes
  948.   #--------------------------------------------------------------------------
  949.   def draw_removes(dx, dy, dw)
  950.     draw_background_box(dx, dy, dw)
  951.     change_color(system_color)
  952.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:removes))
  953.     icons = []
  954.     for effect in @item.effects
  955.       case effect.code
  956.       when 22
  957.         next unless effect.value1 > 0
  958.         next if $data_states[effect.value1].nil?
  959.         icons.push($data_states[effect.data_id].icon_index)
  960.       when 33
  961.         icons.push($game_actors[1].buff_icon_index(1, effect.data_id))
  962.       when 34
  963.         icons.push($game_actors[1].buff_icon_index(-1, effect.data_id))
  964.       end
  965.       icons.delete(0)
  966.       break if icons.size >= YEA::ITEM::MAX_ICONS_DRAWN
  967.     end
  968.     draw_icons(dx, dy, dw, icons)
  969.   end
  970.   
  971.   #--------------------------------------------------------------------------
  972.   # draw_icons
  973.   #--------------------------------------------------------------------------
  974.   def draw_icons(dx, dy, dw, icons)
  975.     dx += dw - 4
  976.     dx -= icons.size * 24
  977.     for icon_id in icons
  978.       draw_icon(icon_id, dx, dy)
  979.       dx += 24
  980.     end
  981.     if icons.size == 0
  982.       change_color(normal_color, false)
  983.       text = Vocab::item_status(:empty)
  984.       draw_text(4, dy, contents.width-8, line_height, text, 2)
  985.     end
  986.   end
  987.   
  988. end # Window_ItemStatus

  989. #==============================================================================
  990. # ■ Scene_Item
  991. #==============================================================================

  992. class Scene_Item < Scene_ItemBase
  993.   
  994.   #--------------------------------------------------------------------------
  995.   # alias method: start
  996.   #--------------------------------------------------------------------------
  997.   alias scene_item_start_aim start
  998.   def start
  999.     scene_item_start_aim
  1000.     create_types_window
  1001.     create_status_window
  1002.     relocate_windows
  1003.   end
  1004.   
  1005.   #--------------------------------------------------------------------------
  1006.   # overwrite method: return_scene
  1007.   #--------------------------------------------------------------------------
  1008.   def return_scene
  1009.     $game_temp.scene_item_index = nil
  1010.     $game_temp.scene_item_oy = nil
  1011.     super
  1012.   end
  1013.   
  1014.   #--------------------------------------------------------------------------
  1015.   # overwrite method: create_category_window
  1016.   #--------------------------------------------------------------------------
  1017.   def create_category_window
  1018.     wy = @help_window.height
  1019.     @category_window = Window_ItemCommand.new(0, wy)
  1020.     @category_window.viewport = @viewport
  1021.     @category_window.help_window = @help_window
  1022.     @category_window.y = @help_window.height
  1023.     if !$game_temp.scene_item_index.nil?
  1024.       @category_window.select($game_temp.scene_item_index)
  1025.       @category_window.oy = $game_temp.scene_item_oy
  1026.     end
  1027.     $game_temp.scene_item_index = nil
  1028.     $game_temp.scene_item_oy = nil
  1029.     @category_window.set_handler(:ok, method(:on_category_ok))
  1030.     @category_window.set_handler(:cancel, method(:return_scene))
  1031.     @category_window.set_handler(:item, method(:open_types))
  1032.     @category_window.set_handler(:weapon, method(:open_types))
  1033.     @category_window.set_handler(:armor, method(:open_types))
  1034.     process_custom_item_commands
  1035.   end
  1036.   
  1037.   #--------------------------------------------------------------------------
  1038.   # new method: process_custom_item_commands
  1039.   #--------------------------------------------------------------------------
  1040.   def process_custom_item_commands
  1041.     for command in YEA::ITEM::COMMANDS
  1042.       next unless YEA::ITEM::CUSTOM_ITEM_COMMANDS.include?(command)
  1043.       called_method = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][3]
  1044.       @category_window.set_handler(command, method(called_method))
  1045.     end
  1046.   end
  1047.   
  1048.   #--------------------------------------------------------------------------
  1049.   # new method: create_types_window
  1050.   #--------------------------------------------------------------------------
  1051.   def create_types_window
  1052.     wy = @category_window.y
  1053.     @types_window = Window_ItemType.new(Graphics.width, wy)
  1054.     @types_window.viewport = @viewport
  1055.     @types_window.help_window = @help_window
  1056.     @types_window.y = @help_window.height
  1057.     @types_window.item_window = @item_window
  1058.     @item_window.types_window = @types_window
  1059.     @types_window.set_handler(:ok, method(:on_types_ok))
  1060.     @types_window.set_handler(:cancel, method(:on_types_cancel))
  1061.   end
  1062.   
  1063.   #--------------------------------------------------------------------------
  1064.   # new method: create_status_window
  1065.   #--------------------------------------------------------------------------
  1066.   def create_status_window
  1067.     wx = @category_window.width
  1068.     wy = @category_window.y
  1069.     @status_window = Window_ItemStatus.new(wx, wy, @item_window)
  1070.     @status_window.viewport = @viewport
  1071.   end
  1072.   
  1073.   #--------------------------------------------------------------------------
  1074.   # new method: relocate_windows
  1075.   #--------------------------------------------------------------------------
  1076.   def relocate_windows
  1077.     return unless $imported["YEA-AceMenuEngine"]
  1078.     case Menu.help_window_location
  1079.     when 0 # Top
  1080.       @help_window.y = 0
  1081.       @category_window.y = @help_window.height
  1082.       @item_window.y = @category_window.y + @category_window.height
  1083.     when 1 # Middle
  1084.       @category_window.y = 0
  1085.       @help_window.y = @category_window.height
  1086.       @item_window.y = @help_window.y + @help_window.height
  1087.     else # Bottom
  1088.       @category_window.y = 0
  1089.       @item_window.y = @category_window.height
  1090.       @help_window.y = @item_window.y + @item_window.height
  1091.     end
  1092.     @types_window.y = @category_window.y
  1093.     @status_window.y = @category_window.y
  1094.   end
  1095.   
  1096.   #--------------------------------------------------------------------------
  1097.   # new method: open_categories
  1098.   #--------------------------------------------------------------------------
  1099.   def open_types
  1100.     @category_window.x = Graphics.width
  1101.     @types_window.x = 0
  1102.     @types_window.reveal(@category_window.current_symbol)
  1103.   end
  1104.   
  1105.   #--------------------------------------------------------------------------
  1106.   # new method: on_types_ok
  1107.   #--------------------------------------------------------------------------
  1108.   def on_types_ok
  1109.     @item_window.activate
  1110.     @item_window.select_last
  1111.   end
  1112.   
  1113.   #--------------------------------------------------------------------------
  1114.   # new method: on_types_cancel
  1115.   #--------------------------------------------------------------------------
  1116.   def on_types_cancel
  1117.     @category_window.x = 0
  1118.     @category_window.activate
  1119.     @types_window.unselect
  1120.     @types_window.x = Graphics.width
  1121.   end
  1122.   
  1123.   #--------------------------------------------------------------------------
  1124.   # alias method: on_item_cancel
  1125.   #--------------------------------------------------------------------------
  1126.   alias scene_item_on_item_cancel_aim on_item_cancel
  1127.   def on_item_cancel
  1128.     if @types_window.x <= 0
  1129.       @item_window.unselect
  1130.       @types_window.activate
  1131.     else
  1132.       scene_item_on_item_cancel_aim
  1133.     end
  1134.   end
  1135.   
  1136.   #--------------------------------------------------------------------------
  1137.   # new method: command_totori
  1138.   #--------------------------------------------------------------------------
  1139.   def command_totori
  1140.     SceneManager.call(Scene_Alchemy)
  1141.   end
  1142.   
  1143.   #--------------------------------------------------------------------------
  1144.   # new method: command_name1
  1145.   #--------------------------------------------------------------------------
  1146.   def command_name1
  1147.     # Do nothing.
  1148.   end
  1149.   
  1150.   #--------------------------------------------------------------------------
  1151.   # new method: command_name2
  1152.   #--------------------------------------------------------------------------
  1153.   def command_name2
  1154.     # Do nothing.
  1155.   end
  1156.   
  1157. end # Scene_Item

  1158. #==============================================================================
  1159. #
  1160. # ▼ End of File
  1161. #
  1162. #==============================================================================
复制代码


掉落强化
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Extra Drops v1.01
  4. # -- Last Updated: 2011.12.31
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-ExtraDrops"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2011.12.31 - Bug Fixed: Drop ratios now work properly.
  15. # 2011.12.17 - Started Script and Finished.
  16. #
  17. #==============================================================================
  18. # ▼ Introduction
  19. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  20. # Enemies by default only drop three items maximum in RPG Maker VX Ace. The
  21. # drop rates are also limited to rates that can only be achieved through
  22. # denominator values. A drop rate of say, 75% cannot be achieved. This script
  23. # provides the ability to add more than just three drops and more control over
  24. # the drop rates, too.
  25. #
  26. #==============================================================================
  27. # ▼ Instructions
  28. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  29. # To install this script, open up your script editor and copy/paste this script
  30. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  31. #
  32. # -----------------------------------------------------------------------------
  33. # Enemy Notetags - These notetags go in the enemies notebox in the database.
  34. # -----------------------------------------------------------------------------
  35. # <drop Ix: y%>在敌人备注添加额外的物品掉落,X为物品编号,Y为概率
  36. # <drop Wx: y%>在敌人备注添加额外的武器掉落,X为武器编号,Y为概率
  37. # <drop Ax: y%>在敌人备注添加额外的防具掉落,X为防具编号,Y为概率
  38. # Causes enemy to drop item, weapon, or armour (marked by I, W, or A) x at a
  39. # rate of y percent. Insert multiples of this tag to increase the number of
  40. # drops an enemy can possibly have.
  41. #
  42. #==============================================================================
  43. # ▼ Compatibility
  44. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  45. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  46. # it will run with RPG Maker VX without adjusting.
  47. #
  48. #==============================================================================
  49. # ▼ Editting anything past this point may potentially result in causing
  50. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  51. # halitosis so edit at your own risk.
  52. #==============================================================================

  53. module YEA
  54.   module REGEXP
  55.   module ENEMY
  56.    
  57.     DROP_PLUS = /<(?:DROP|drop)[ ]([IWA])(\d+):[ ](\d+)([%%])>/i
  58.    
  59.   end # ENEMY
  60.   end # REGEXP
  61. end # YEA

  62. #==============================================================================
  63. # ■ DataManager
  64. #==============================================================================

  65. module DataManager
  66.   
  67.   #--------------------------------------------------------------------------
  68.   # alias method: load_database
  69.   #--------------------------------------------------------------------------
  70.   class <<self; alias load_database_edr load_database; end
  71.   def self.load_database
  72.     load_database_edr
  73.     load_notetags_edr
  74.   end
  75.   
  76.   #--------------------------------------------------------------------------
  77.   # new method: load_notetags_al
  78.   #--------------------------------------------------------------------------
  79.   def self.load_notetags_edr
  80.     for enemy in $data_enemies
  81.       next if enemy.nil?
  82.       enemy.load_notetags_edr
  83.     end
  84.   end
  85.   
  86. end # DataManager

  87. #==============================================================================
  88. # ■ RPG::Enemy
  89. #==============================================================================

  90. class RPG::Enemy < RPG::BaseItem
  91.   
  92.   #--------------------------------------------------------------------------
  93.   # public instance variables
  94.   #--------------------------------------------------------------------------
  95.   attr_accessor :extra_drops
  96.   
  97.   #--------------------------------------------------------------------------
  98.   # common cache: load_notetags_edr
  99.   #--------------------------------------------------------------------------
  100.   def load_notetags_edr
  101.     @extra_drops = []
  102.     #---
  103.     self.note.split(/[\r\n]+/).each { |line|
  104.       case line
  105.       #---
  106.       when YEA::REGEXP::ENEMY::DROP_PLUS
  107.         case $1.upcase
  108.         when "I";  kind = 1
  109.         when "W";  kind = 2
  110.         when "A";  kind = 3
  111.         else; next
  112.         end
  113.         item = RPG::Enemy::DropItem.new
  114.         item.kind = kind
  115.         item.data_id = $2.to_i
  116.         item.drop_rate = $3.to_i * 0.01
  117.         @extra_drops.push(item)
  118.       end
  119.     } # self.note.split
  120.     #---
  121.   end
  122.   
  123. end # RPG::Enemy

  124. #==============================================================================
  125. # ■ RPG::Enemy::DropItem
  126. #==============================================================================

  127. class RPG::Enemy::DropItem
  128.   
  129.   #--------------------------------------------------------------------------
  130.   # public instance variables
  131.   #--------------------------------------------------------------------------
  132.   attr_accessor :drop_rate
  133.   
  134.   #--------------------------------------------------------------------------
  135.   # new method: drop_rate
  136.   #--------------------------------------------------------------------------
  137.   def drop_rate
  138.     return 0 if @drop_rate.nil?
  139.     return @drop_rate
  140.   end
  141.   
  142. end # RPG::Enemy::DropItem

  143. #==============================================================================
  144. # ■ Game_Enemy
  145. #==============================================================================

  146. class Game_Enemy < Game_Battler
  147.   
  148.   #--------------------------------------------------------------------------
  149.   # alias method: make_drop_items
  150.   #--------------------------------------------------------------------------
  151.   alias game_enemy_make_drop_items_edr make_drop_items
  152.   def make_drop_items
  153.     result = game_enemy_make_drop_items_edr
  154.     result += make_extra_drops
  155.     return result
  156.   end
  157.   
  158.   #--------------------------------------------------------------------------
  159.   # new method: make_extra_drops
  160.   #--------------------------------------------------------------------------
  161.   def make_extra_drops
  162.     result = []
  163.     for drop in enemy.extra_drops
  164.       next if rand > drop.drop_rate
  165.       result.push(item_object(drop.kind, drop.data_id))
  166.     end
  167.     return result
  168.   end
  169.   
  170. end # Game_Enemy

  171. #==============================================================================
  172. #
  173. # ▼ End of File
  174. #
  175. #==============================================================================
复制代码

点评

脚本都不点评吗,毕竟好心给你们发放的说。  发表于 2017-7-22 09:41
所有脚本摆出来太长了,应该加个折叠隐藏。  发表于 2017-7-22 08:19

评分

参与人数 3星屑 +66 赞 +2 收起 理由
zzz2207981 + 1 精品文章
3231152940 + 1 精品文章
zaiy2863 + 66 谢谢 很6

查看全部评分

P1不太上了,有问题加个Q1286124843,不管是脚本还是游戏问题都可以来找我
梦石
0
星屑
2378
在线时间
1014 小时
注册时间
2012-4-30
回帖
1459

开拓者

发表于 2017-7-19 18:11:51 | 显示全部楼层
本帖最后由 铅笔描绘的思念 于 2017-7-20 12:55 编辑

善用
点击展开/收起这个标签




怎么可能会很长啊。。难道长了有bug?
点击展开/收起
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Extra Drops v1.01
  4. # -- Last Updated: 2011.12.31
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-ExtraDrops"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2011.12.31 - Bug Fixed: Drop ratios now work properly.
  15. # 2011.12.17 - Started Script and Finished.
  16. #
  17. #==============================================================================
  18. # ▼ Introduction
  19. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  20. # Enemies by default only drop three items maximum in RPG Maker VX Ace. The
  21. # drop rates are also limited to rates that can only be achieved through
  22. # denominator values. A drop rate of say, 75% cannot be achieved. This script
  23. # provides the ability to add more than just three drops and more control over
  24. # the drop rates, too.
  25. #
  26. #==============================================================================
  27. # ▼ Instructions
  28. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  29. # To install this script, open up your script editor and copy/paste this script
  30. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  31. #
  32. # -----------------------------------------------------------------------------
  33. # Enemy Notetags - These notetags go in the enemies notebox in the database.
  34. # -----------------------------------------------------------------------------
  35. # <drop Ix: y%>在敌人备注添加额外的物品掉落,X为物品编号,Y为概率
  36. # <drop Wx: y%>在敌人备注添加额外的武器掉落,X为武器编号,Y为概率
  37. # <drop Ax: y%>在敌人备注添加额外的防具掉落,X为防具编号,Y为概率
  38. # Causes enemy to drop item, weapon, or armour (marked by I, W, or A) x at a
  39. # rate of y percent. Insert multiples of this tag to increase the number of
  40. # drops an enemy can possibly have.
  41. #
  42. #==============================================================================
  43. # ▼ Compatibility
  44. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  45. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  46. # it will run with RPG Maker VX without adjusting.
  47. #
  48. #==============================================================================
  49. # ▼ Editting anything past this point may potentially result in causing
  50. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  51. # halitosis so edit at your own risk.
  52. #==============================================================================

  53. module YEA
  54.   module REGEXP
  55.   module ENEMY

  56.     DROP_PLUS = /<(?:DROP|drop)[ ]([IWA])(\d+):[ ](\d+)([%%])>/i

  57.   end # ENEMY
  58.   end # REGEXP
  59. end # YEA

  60. #==============================================================================
  61. # ■ DataManager
  62. #==============================================================================

  63. module DataManager

  64.   #--------------------------------------------------------------------------
  65.   # alias method: load_database
  66.   #--------------------------------------------------------------------------
  67.   class <<self; alias load_database_edr load_database; end
  68.   def self.load_database
  69.     load_database_edr
  70.     load_notetags_edr
  71.   end

  72.   #--------------------------------------------------------------------------
  73.   # new method: load_notetags_al
  74.   #--------------------------------------------------------------------------
  75.   def self.load_notetags_edr
  76.     for enemy in $data_enemies
  77.       next if enemy.nil?
  78.       enemy.load_notetags_edr
  79.     end
  80.   end

  81. end # DataManager

  82. #==============================================================================
  83. # ■ RPG::Enemy
  84. #==============================================================================

  85. class RPG::Enemy < RPG::BaseItem

  86.   #--------------------------------------------------------------------------
  87.   # public instance variables
  88.   #--------------------------------------------------------------------------
  89.   attr_accessor :extra_drops

  90.   #--------------------------------------------------------------------------
  91.   # common cache: load_notetags_edr
  92.   #--------------------------------------------------------------------------
  93.   def load_notetags_edr
  94.     @extra_drops = []
  95.     #---
  96.     self.note.split(/[\r\n]+/).each { |line|
  97.       case line
  98.       #---
  99.       when YEA::REGEXP::ENEMY::DROP_PLUS
  100.         case $1.upcase
  101.         when "I";  kind = 1
  102.         when "W";  kind = 2
  103.         when "A";  kind = 3
  104.         else; next
  105.         end
  106.         item = RPG::Enemy::DropItem.new
  107.         item.kind = kind
  108.         item.data_id = $2.to_i
  109.         item.drop_rate = $3.to_i * 0.01
  110.         @extra_drops.push(item)
  111.       end
  112.     } # self.note.split
  113.     #---
  114.   end

  115. end # RPG::Enemy

  116. #==============================================================================
  117. # ■ RPG::Enemy::DropItem
  118. #==============================================================================

  119. class RPG::Enemy::DropItem

  120.   #--------------------------------------------------------------------------
  121.   # public instance variables
  122.   #--------------------------------------------------------------------------
  123.   attr_accessor :drop_rate

  124.   #--------------------------------------------------------------------------
  125.   # new method: drop_rate
  126.   #--------------------------------------------------------------------------
  127.   def drop_rate
  128.     return 0 if @drop_rate.nil?
  129.     return @drop_rate
  130.   end

  131. end # RPG::Enemy::DropItem

  132. #==============================================================================
  133. # ■ Game_Enemy
  134. #==============================================================================

  135. class Game_Enemy < Game_Battler

  136.   #--------------------------------------------------------------------------
  137.   # alias method: make_drop_items
  138.   #--------------------------------------------------------------------------
  139.   alias game_enemy_make_drop_items_edr make_drop_items
  140.   def make_drop_items
  141.     result = game_enemy_make_drop_items_edr
  142.     result += make_extra_drops
  143.     return result
  144.   end

  145.   #--------------------------------------------------------------------------
  146.   # new method: make_extra_drops
  147.   #--------------------------------------------------------------------------
  148.   def make_extra_drops
  149.     result = []
  150.     for drop in enemy.extra_drops
  151.       next if rand > drop.drop_rate
  152.       result.push(item_object(drop.kind, drop.data_id))
  153.     end
  154.     return result
  155.   end

  156. end # Game_Enemy

  157. #==============================================================================
  158. #
  159. # ▼ End of File
  160. #
  161. #==============================================================================
复制代码
回复

使用道具 举报

梦石
0
星屑
1345
在线时间
378 小时
注册时间
2015-6-16
回帖
526
 楼主| 发表于 2017-7-19 18:56:26 | 显示全部楼层
肉包大大建议用代码框。亲测FOLD。第二个脚本够你们拉的2333。每个脚本都很长呢

点评

就是这么做的,然后发布以后,很长。然后干脆 只用代码了  发表于 2017-7-20 09:50
把[code][/code]整个放在[fold][/fold]里。。  发表于 2017-7-19 20:42
P1不太上了,有问题加个Q1286124843,不管是脚本还是游戏问题都可以来找我
回复

使用道具 举报

梦石
0
星屑
878
在线时间
576 小时
注册时间
2010-6-26
回帖
709
发表于 2017-7-19 23:11:13 | 显示全部楼层
感谢分享

点评

SQ,话说今天赶制一下2.4.到时候你来玩玩看。群里面有最新图片的。消耗条现在可视了。肉包大大给我绘制好了。  发表于 2017-7-20 09:48
回复

使用道具 举报

梦石
0
星屑
1345
在线时间
378 小时
注册时间
2015-6-16
回帖
526
 楼主| 发表于 2017-7-20 09:50:00 | 显示全部楼层
这些脚本,一部分是外站的。很多人翻不了墙,我拿到了就拿出来分享
P1不太上了,有问题加个Q1286124843,不管是脚本还是游戏问题都可以来找我
回复

使用道具 举报

梦石
0
星屑
354
在线时间
127 小时
注册时间
2016-10-8
回帖
54
发表于 2017-7-21 00:00:07 | 显示全部楼层
抱歉,能在這兒問嗎?@@

想問那個敵人信息顯示腳本,該如何使用…
全是英文,看沒有懂

是要在敵人備註欄輸入嗎?
那麼又是輸入什麼呢?
完全搞不懂 冏

点评

shift是选一个单体敌人的技能,然后才能出现这句话。随机一个什么的出现不了(全体也不能的)  发表于 2017-7-21 19:22
感謝回答,雖然我按了shift沒跳出東西,可能腳本卡到了XD 不要緊,我摸一下,不行的話再另起帖問一下好了,感謝您 *3*  发表于 2017-7-21 17:14
英文的话,可以从Instructions看下去,是介绍,然后用谷歌翻译/有道翻译什么的去翻译就知道了  发表于 2017-7-21 10:54
默认情况是均可查看  发表于 2017-7-21 10:53
其实不需要,那些备注确实要写在敌人里面(也可以不写),因为是确定敌人到底要隐藏/显示什么信息。默认的话按shift键就可以查看了  发表于 2017-7-21 10:52
(´_ゝ`)...仍未命名的遊戲製作進度:0%
回复

使用道具 举报

梦石
0
星屑
791
在线时间
51 小时
注册时间
2021-6-14
回帖
30
发表于 2021-9-11 19:10:13 | 显示全部楼层
good,真不错
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部