设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3555|回复: 16
打印 上一主题 下一主题

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

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1345
在线时间
378 小时
注册时间
2015-6-16
帖子
571
跳转到指定楼层
1
发表于 2017-7-19 14:49:39 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

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

网址
RUBY 代码复制
  1. #==============================================================================
  2. # ★ RGSS3_リンク付きクレジット Ver1.1
  3. #==============================================================================
  4. =begin
  5.  
  6. 作者:tomoaky
  7. webサイト:ひきも記は閉鎖しました。 ([url]http://hikimoki.sakura.ne.jp/[/url])
  8.  
  9. ブラウザでリンク先のサイトを開く機能をもったクレジットシーンです、
  10. タイトルコマンドに追加されます。
  11.  
  12. 以下のおまけ機能があります。
  13.  
  14. イベントコマンド『スクリプト』を使い、任意のサイトをブラウザで開く。
  15.   open_url("http://hikimoki.sakura.ne.jp/")
  16.  
  17. タイトルシーンからGame.exeと同じ場所にある readme.txt を開く。
  18.  
  19. 2014.10.09  Ver1.1
  20.   ・おまけ機能追加
  21.  
  22. 2014.10.08  Ver1.0
  23.   ・公開
  24.  
  25. =end
  26.  
  27. #==============================================================================
  28. # □ 設定項目
  29. #==============================================================================
  30. module TMCREDIT
  31.   # クレジットの設定(["サイト名", "説明", "URL"])
  32.   DATA = [
  33.     ["勇冒的通知", "通知", "http://guangmingmofaling.lofter.com/post/1e3937c2_da6506b"],
  34.     ["勇冒1.9。", "1.9", "http://guangmingmofaling.lofter.com/post/1e3937c2_cfa6f62"],
  35.     ["勇冒2.0。", "2.0", "http://guangmingmofaling.lofter.com/post/1e3937c2_ebbe968"],
  36.     ["勇冒2.1。", "2.1", "http://guangmingmofaling.lofter.com/post/1e3937c2_ed79836"],
  37.     ["勇冒2.2。", "2.2", "http://guangmingmofaling.lofter.com/post/1e3937c2_f281213"],
  38.     ["勇冒2.3。", "2.3", "http://guangmingmofaling.lofter.com/post/1e3937c2_f30b3e3"],
  39.   ]
  40.  
  41.   TITLE_INDEX = 2   # タイトルコマンドの何番目に挿入するか(0 が先頭)
  42.  
  43.   USE_MANUAL_CALL = false  # readme.txt の呼び出し機能を使うか(false で無効)
  44. end
  45.  
  46. #==============================================================================
  47. # □ コマンド
  48. #==============================================================================
  49. module TMCREDIT
  50. module Commands
  51.   #--------------------------------------------------------------------------
  52.   # ○ ブラウザでサイトを開く
  53.   #--------------------------------------------------------------------------
  54.   def open_url(url)
  55.     a = Win32API.new("shell32", "ShellExecuteA", %w(p p p p p i),"i")
  56.     a.call(0, "open", url, 0, 0, 1)
  57.   end
  58.   module_function :open_url
  59. end
  60. end # module TMCREDIT
  61.  
  62. #==============================================================================
  63. # ■ Game_Event
  64. #==============================================================================
  65. class Game_Event
  66.   include TMCREDIT::Commands
  67. end
  68.  
  69. #==============================================================================
  70. # ■ Game_Interpreter
  71. #==============================================================================
  72. class Game_Interpreter
  73.   include TMCREDIT::Commands
  74. end
  75.  
  76. #==============================================================================
  77. # ■ Window_TitleCommand
  78. #==============================================================================
  79. class Window_TitleCommand < Window_Command
  80.   #--------------------------------------------------------------------------
  81.   # ● コマンドリストの作成
  82.   #--------------------------------------------------------------------------
  83.   alias tmcredit_window_titlecommand_make_command_list make_command_list
  84.   def make_command_list
  85.     tmcredit_window_titlecommand_make_command_list
  86.     @list.insert(TMCREDIT::TITLE_INDEX,
  87.       {:name=>"更新网站", :symbol=>:credit, :enabled=>true, :ext=>nil})
  88.     if TMCREDIT::USE_MANUAL_CALL
  89.       @list.insert(TMCREDIT::TITLE_INDEX + 1,
  90.         {:name=>"説明書", :symbol=>:manual, :enabled=>true, :ext=>nil})
  91.     end
  92.   end
  93. end
  94.  
  95. #==============================================================================
  96. # ■ Window_Credit
  97. #==============================================================================
  98. class Window_Credit < Window_Selectable
  99.   #--------------------------------------------------------------------------
  100.   # ● オブジェクト初期化
  101.   #--------------------------------------------------------------------------
  102.   def initialize(x, y, width, height)
  103.     @data = TMCREDIT::DATA.clone
  104.     super
  105.     select(0)
  106.     activate
  107.     refresh
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● 項目数の取得
  111.   #--------------------------------------------------------------------------
  112.   def item_max
  113.     @data.size
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ● アイテムの取得
  117.   #--------------------------------------------------------------------------
  118.   def item
  119.     @data[index]
  120.   end
  121.   #--------------------------------------------------------------------------
  122.   # ● URLの取得
  123.   #--------------------------------------------------------------------------
  124.   def url
  125.     @data[index][2]
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● 項目の描画
  129.   #--------------------------------------------------------------------------
  130.   def draw_item(index)
  131.     item = @data[index]
  132.     if item
  133.       rect = item_rect_for_text(index)
  134.       draw_text(rect, sprintf("%s (%s)", item[0], item[2]))
  135.     end
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # ● ヘルプテキスト更新
  139.   #--------------------------------------------------------------------------
  140.   def update_help
  141.     text = sprintf("\\C[16]%s\\C[0] %s", item[1], item[0])
  142.     text += "\n\\C[2](确定键进去网址)"
  143.     @help_window.set_text(text)
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● リフレッシュ
  147.   #--------------------------------------------------------------------------
  148.   def refresh
  149.     create_contents
  150.     draw_all_items
  151.   end
  152. end
  153.  
  154. #==============================================================================
  155. # ■ Scene_Title
  156. #==============================================================================
  157. class Scene_Title < Scene_Base
  158.   #--------------------------------------------------------------------------
  159.   # ● コマンドウィンドウの作成
  160.   #--------------------------------------------------------------------------
  161.   alias tmcredit_scene_title_create_command_window create_command_window
  162.   def create_command_window
  163.     tmcredit_scene_title_create_command_window
  164.     @command_window.set_handler(:credit, method(:command_credit))
  165.     if TMCREDIT::USE_MANUAL_CALL
  166.       @command_window.set_handler(:manual, method(:command_manual))
  167.     end
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # ○ コマンド[クレジット]
  171.   #--------------------------------------------------------------------------
  172.   def command_credit
  173.     close_command_window
  174.     SceneManager.call(Scene_Credit)
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # ○ コマンド[説明書]
  178.   #--------------------------------------------------------------------------
  179.   def command_manual
  180.     @command_window.activate
  181.     TMCREDIT::Commands.open_url("readme.txt")
  182.   end
  183. end
  184.  
  185. #==============================================================================
  186. # ■ Scene_Credit
  187. #==============================================================================
  188. class Scene_Credit < Scene_MenuBase
  189.   #--------------------------------------------------------------------------
  190.   # ● 開始処理
  191.   #--------------------------------------------------------------------------
  192.   def start
  193.     super
  194.     create_help_window
  195.     create_item_window
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ● クレジットウィンドウの作成
  199.   #--------------------------------------------------------------------------
  200.   def create_item_window
  201.     ww = Graphics.width
  202.     wh = Graphics.height - @help_window.height
  203.     @credit_window = Window_Credit.new(0, @help_window.height, ww, wh)
  204.     @credit_window.help_window = @help_window
  205.     @credit_window.set_handler(:ok,     method(:on_credit_ok))
  206.     @credit_window.set_handler(:cancel, method(:return_scene))
  207.   end
  208.   #--------------------------------------------------------------------------
  209.   # ● クレジット[決定]
  210.   #--------------------------------------------------------------------------
  211.   def on_credit_ok
  212.     TMCREDIT::Commands.open_url(@credit_window.url)
  213.     @credit_window.activate
  214.   end
  215. end


复活机制
RUBY 代码复制
  1. #encoding:utf-8
  2.  
  3. =begin
  4. *******************************************************************************************
  5.    * 時間自動復活機制 *
  6.                        for RGSS3
  7.         Ver 1.00   2014.01.29
  8.    原作者:魂(Lctseng),巴哈姆特論壇ID:play123
  9.    替"ace922(容)"撰寫的特製版本
  10.    
  11.    轉載請保留此標籤
  12.    個人小屋連結:[url]http://home.gamer.com.tw/homeindex.php?owner=play123[/url]
  13.    主要功能:
  14.                        一、指定回合數到後角色會自動復活
  15.                        二、若角色身上擁有"無法他人復活"狀態,則他人的復活相關技能將對其沒有作用。
  16.                       
  17.    更新紀錄:
  18.     Ver 1.00 :
  19.     日期:2014.01.29
  20.     摘要:■、最初版本
  21.                 ■、功能:                  
  22.                        一、指定回合數到後角色會自動復活
  23.                        二、若角色身上擁有"無法他人復活"狀態,則他人的復活相關技能將對其沒有作用。
  24.     撰寫摘要:一、此腳本修改或重新定義以下類別:
  25.                            ■ Game_Actor
  26.                          
  27.                         二、此腳本新定義以下類別和模組:
  28.                            ■ Lctseng::AutoRevive
  29.                          
  30. *******************************************************************************************
  31. =end
  32.  
  33. #encoding:utf-8
  34. #==============================================================================
  35. # ■ Lctseng::AutoRevive
  36. #------------------------------------------------------------------------------
  37. #  自動復活設定模組
  38. #==============================================================================
  39.  
  40. module Lctseng
  41. module AutoRevive
  42.   #--------------------------------------------------------------------------
  43.   # ● 設定是否顯示Console 紀錄
  44.   #--------------------------------------------------------------------------
  45.   SHOW_CONSOLE_INFO = true
  46.   #--------------------------------------------------------------------------
  47.   # ● 設定復活所需回合數
  48.   #--------------------------------------------------------------------------
  49.   REVIVE_TURN = 10
  50.   #--------------------------------------------------------------------------
  51.   # ● 設定復活時候,HP與MP的恢復計算公式
  52.   #--------------------------------------------------------------------------
  53.   HP_FORMULA =  " rand(10000) "
  54.   MP_FORMULA =  " mat + mdf "
  55.   #--------------------------------------------------------------------------
  56.   # ● 設定相關狀態編號
  57.   #--------------------------------------------------------------------------
  58.   DEAD_STATE = 1 # 死亡的狀態
  59.   NO_REVIVE_STATES = [197] # 禁止復活的狀態數列
  60.  
  61. end
  62. end
  63.  
  64. #*******************************************************************************************
  65. #
  66. #   請勿修改從這裡以下的程式碼,除非你知道你在做什麼!
  67. #   DO NOT MODIFY UNLESS YOU KNOW WHAT TO DO !
  68. #
  69. #*******************************************************************************************
  70.  
  71. #--------------------------------------------------------------------------
  72. # ★ 紀錄腳本資訊
  73. #--------------------------------------------------------------------------
  74. if !$lctseng_scripts  
  75.   $lctseng_scripts = {}
  76. end
  77.  
  78.  
  79. $lctseng_scripts[:auto_revive] = "1.00"
  80.  
  81. puts "載入腳本:Lctseng - 時間自動復活機制,版本:#{$lctseng_scripts[:auto_revive]}"
  82.  
  83. #encoding:utf-8
  84. #==============================================================================
  85. # ■ Game_Actor
  86. #------------------------------------------------------------------------------
  87. #  管理角色的類。
  88. #   本類在 Game_Actors 類 ($game_actors) 的內部使用。
  89. #   具體使用請查看 Game_Party 類 ($game_party) 。
  90. #==============================================================================
  91.  
  92. class Game_Actor < Game_Battler
  93.   #--------------------------------------------------------------------------
  94.   # ● 回合結束處理
  95.   #--------------------------------------------------------------------------
  96.   def on_turn_end
  97.     super
  98.     #puts "#{self.name}執行回合結束。" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
  99.     if dead?
  100.       if !@dead_turn
  101.         @dead_turn = 0
  102.       end
  103.       puts " #{self.name}已經死了#{@dead_turn}個回合..." if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
  104.       if @dead_turn >= Lctseng::AutoRevive::REVIVE_TURN
  105.         puts " #{self.name}復活!清除死亡回合計數!" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
  106.         revive
  107.         remove_state(Lctseng::AutoRevive::DEAD_STATE,true)
  108.         self.hp += eval_formula(Lctseng::AutoRevive::HP_FORMULA)
  109.         self.mp += eval_formula(Lctseng::AutoRevive::MP_FORMULA)
  110.         @dead_turn = 0
  111.       else
  112.         @dead_turn += 1
  113.       end
  114.     else
  115.       @dead_turn = 0
  116.     end
  117.     if alive?
  118.       ## 還活著,自行解除任何限制復活狀態
  119.       Lctseng::AutoRevive::NO_REVIVE_STATES.each do |state_id|
  120.         if state?(state_id)
  121.           puts " #{self.name}還活著,持有#{$data_states[state_id].name},將自動解除" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
  122.           remove_state(state_id)
  123.         end
  124.       end
  125.     end
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● 計算公式
  129.   #--------------------------------------------------------------------------
  130.   def eval_formula(formula)
  131.     eval(formula).round rescue 0
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ● 計算傷害
  135.   #--------------------------------------------------------------------------
  136.   def make_damage_value(user, item)
  137.     new_item = item
  138.     if dead? && Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id|  state?(state_id) }
  139.       new_item = Marshal.load(Marshal.dump(item))
  140.       new_item.damage.formula = "0"
  141.       puts "#{self.name}已死亡且受到復活限制狀態,恢復HP計算強制歸零" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
  142.     end
  143.     super(user,new_item)
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 更改 HP
  147.   #--------------------------------------------------------------------------
  148.   def hp=(hp)
  149.     if dead? && Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id|  state?(state_id) }
  150.       hp = 0
  151.       puts "#{self.name}已死亡且受到復活限制狀態,HP強制為0" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
  152.     end
  153.     super(hp)
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 應用“恢復 HP”效果
  157.   #--------------------------------------------------------------------------
  158.   def item_effect_recover_hp(user, item, effect)
  159.     if dead? && Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id|  state?(state_id) }
  160.       puts " #{self.name}有禁止復活的狀態,恢復HP無效。" if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
  161.     else
  162.       super
  163.     end
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 應用“狀態解除”效果
  167.   #--------------------------------------------------------------------------
  168.   def item_effect_remove_state(user, item, effect)
  169.     if effect.data_id == Lctseng::AutoRevive::DEAD_STATE
  170.       if !Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id|  state?(state_id) }
  171.         super
  172.         if !state?(effect.data_id)
  173.           @dead_turn = 0
  174.           puts "#{self.name}已經復活!清除死亡回合數。"if Lctseng::AutoRevive::SHOW_CONSOLE_INFO
  175.         end
  176.       end
  177.     else
  178.       super
  179.     end
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ● 解除狀態
  183.   #--------------------------------------------------------------------------
  184.   def remove_state(state_id,force = false)
  185.     if state_id == Lctseng::AutoRevive::DEAD_STATE
  186.       if force || !Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id|  state?(state_id) }
  187.         super(state_id)
  188.       end
  189.     else
  190.       super(state_id)
  191.     end
  192.   end
  193.   #--------------------------------------------------------------------------
  194.   # ● 死亡
  195.   #--------------------------------------------------------------------------
  196.   def die
  197.     @dead_turn = 0
  198.     @hp = 0
  199.     clear_states_except_revive_limit
  200.     clear_buffs
  201.   end
  202.   #--------------------------------------------------------------------------
  203.   # ● 清除除了死亡限制以外的狀態
  204.   #--------------------------------------------------------------------------
  205.   def clear_states_except_revive_limit
  206.     ## 先記錄死亡狀態資訊
  207.     states = {}
  208.     Lctseng::AutoRevive::NO_REVIVE_STATES.each do |state_id|
  209.       if @states.include?(state_id)
  210.         states[state_id] = [@state_steps[state_id],@state_turns[state_id]]
  211.       end
  212.     end
  213.     ## 呼叫原始的清除方法
  214.     clear_states
  215.     ## 把剛才紀錄的狀態放回去
  216.     states.each_pair do |state_id,data|
  217.       @states.push(state_id)
  218.       @state_steps[state_id] = data[0]
  219.       @state_turns[state_id] = data[1]
  220.     end
  221.     sort_states
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # ● 判定狀態是否可以附加
  225.   #--------------------------------------------------------------------------
  226.   def state_addable?(state_id)
  227.     if Lctseng::AutoRevive::NO_REVIVE_STATES.include?(state_id)
  228.       $data_states[state_id] && !state_resist?(state_id) &&
  229.       !state_removed?(state_id) && !state_restrict?(state_id)
  230.     else
  231.       super
  232.     end
  233.   end
  234.   #--------------------------------------------------------------------------
  235.   # ● 測試使用效果
  236.   #--------------------------------------------------------------------------
  237.   def item_effect_test(user, item, effect)
  238.     if effect.code == EFFECT_REMOVE_STATE && effect.data_id == Lctseng::AutoRevive::DEAD_STATE
  239.       state?(effect.data_id) && !Lctseng::AutoRevive::NO_REVIVE_STATES.any? { |state_id|  state?(state_id) }
  240.     else
  241.       super
  242.     end
  243.   end
  244.  
  245. end


时间脚本
RUBY 代码复制
  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


状态感染
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ¥ Yami Engine Symphony - Infective State
  4. # -- Last Updated: 2012.12.14
  5. # -- Level: Easy
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YES-InfectiveState"] = true
  12.  
  13. #==============================================================================
  14. # ¥ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.12.14 - Finished Script.
  17. # 2012.12.12 - Started Script.
  18. #
  19. #==============================================================================
  20. # ¥ Introduction
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # This script provides infect feature for specific states.
  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/‘fÞ but above ¥ Main. Remember to save.
  29. #
  30. # -----------------------------------------------------------------------------
  31. # State Notetags - These notetags go in the state notebox in the database.
  32. # -----------------------------------------------------------------------------
  33. # <infect allies x: y, z%>
  34. # Infects all allies with state x after y turns with a chance of z%.
  35. #
  36. # <infect enemies x: y, z%>
  37. # Infects all enemies with state x after y turns with a chance of z%.
  38. #
  39. # <infect n allies x: y, z%>
  40. # Infects n allies with state x after y turns with a chance of z%.
  41. #
  42. # <infect n enemies x: y, z%>
  43. # Infects n enemies with state x after y turns with a chance of z%.
  44. #
  45. #==============================================================================
  46. # ¥ Compatibility
  47. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  48. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  49. # it will run with RPG Maker VX without adjustments.
  50. #
  51. #==============================================================================
  52.  
  53. #==============================================================================
  54. # ¥ Editting anything past this point may potentially result in causing
  55. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  56. # halitosis so edit at your own risk.
  57. #==============================================================================
  58.  
  59. #==============================================================================
  60. # ¡ Regular Expression
  61. #==============================================================================
  62.  
  63. module REGEXP
  64.   module INFECTIVE_STATE
  65.     INFECT_ALLY = /<(?:INFECT ALLIES)[ ](\d+):[ ]*(\d+)(?:,[ ]*(\d+)[%“]?)?>/i
  66.     INFECT_ENEMY  = /<(?:INFECT ENEMIES)[ ](\d+):[ ]*(\d+)(?:,[ ]*(\d+)[%“]?)?>/i
  67.     INFECT_X_ALLY = /<(?:INFECT[ ](\d+)[ ]ALLIES)[ ](\d+):[ ]*(\d+)(?:,[ ]*(\d+)[%“]?)?>/i
  68.     INFECT_X_ENEMY = /<(?:INFECT[ ](\d+)[ ]ENEMIES)[ ](\d+):[ ]*(\d+)(?:,[ ]*(\d+)[%“]?)?>/i
  69.   end # INFECTIVE_STATE
  70. end # REGEXP
  71.  
  72. #==============================================================================
  73. # ¡ DataManager
  74. #==============================================================================
  75.  
  76. module DataManager
  77.  
  78.   #--------------------------------------------------------------------------
  79.   # alias method: load_database
  80.   #--------------------------------------------------------------------------
  81.   class <<self; alias load_database_infective_state load_database; end
  82.   def self.load_database
  83.     load_database_infective_state
  84.     initialize_infective_state
  85.   end
  86.  
  87.   #--------------------------------------------------------------------------
  88.   # new method: initialize_infective_state
  89.   #--------------------------------------------------------------------------
  90.   def self.initialize_infective_state
  91.     groups = [$data_states]
  92.     groups.each { |group|
  93.       group.each { |obj|
  94.         next if obj.nil?
  95.         obj.initialize_infective_state
  96.       }
  97.     }
  98.   end
  99.  
  100. end # DataManager
  101.  
  102. #==============================================================================
  103. # ¡ RPG::BaseItem
  104. #==============================================================================
  105.  
  106. class RPG::BaseItem
  107.  
  108.   #--------------------------------------------------------------------------
  109.   # * Public Instance Variables
  110.   #--------------------------------------------------------------------------
  111.   attr_accessor :infect_allies
  112.   attr_accessor :infect_enemies
  113.  
  114.   #--------------------------------------------------------------------------
  115.   # new method: initialize_infective_state
  116.   #--------------------------------------------------------------------------
  117.   def initialize_infective_state
  118.     @infect_allies = {}
  119.     @infect_enemies = {}
  120.     self.note.split(/[\r\n]+/).each { |line|
  121.       case line
  122.       when REGEXP::INFECTIVE_STATE::INFECT_ALLY
  123.         array = [0, $2.to_i, $3.to_i]
  124.         array[2] = 100 if array[2] <= 0
  125.         @infect_allies[$1.to_i] = array if array[1] > 0
  126.       when REGEXP::INFECTIVE_STATE::INFECT_ENEMY
  127.         array = [0, $2.to_i, $3.to_i]
  128.         array[2] = 100 if array[2] <= 0
  129.         @infect_enemies[$1.to_i] = array if array[1] > 0
  130.       when REGEXP::INFECTIVE_STATE::INFECT_X_ALLY
  131.         array = [$1.to_i, $3.to_i, $4.to_i]
  132.         array[2] = 100 if array[2] <= 0
  133.         @infect_allies[$2.to_i] = array if array[1] > 0
  134.       when REGEXP::INFECTIVE_STATE::INFECT_X_ENEMY
  135.         array = [$1.to_i, $3.to_i, $4.to_i]
  136.         array[2] = 100 if array[2] <= 0
  137.         @infect_enemies[$2.to_i] = array if array[1] > 0
  138.       end
  139.     }
  140.   end
  141.  
  142. end # RPG::BaseItem
  143.  
  144. #==============================================================================
  145. # ¡ Game_Battler
  146. #==============================================================================
  147.  
  148. class Game_Battler < Game_BattlerBase
  149.  
  150.   #--------------------------------------------------------------------------
  151.   # new method: infective_states
  152.   #--------------------------------------------------------------------------
  153.   def infective_states
  154.     states.select { |state|
  155.       state.infect_allies.size + state.infect_enemies.size > 0
  156.     }
  157.   end
  158.  
  159.   #--------------------------------------------------------------------------
  160.   # new method: infective_allies
  161.   #--------------------------------------------------------------------------
  162.   def infective_allies
  163.     states.select { |state|
  164.       state.infect_allies.size > 0
  165.     }
  166.   end
  167.  
  168.   #--------------------------------------------------------------------------
  169.   # new method: infective_enemies
  170.   #--------------------------------------------------------------------------
  171.   def infective_enemies
  172.     states.select { |state|
  173.       state.infect_enemies.size > 0
  174.     }
  175.   end
  176.  
  177.   #--------------------------------------------------------------------------
  178.   # new method: infect_allies_include?
  179.   #--------------------------------------------------------------------------
  180.   def infect_allies_include?(id)
  181.     infective_allies.any? { |state| state.infect_allies.keys.include?(id) }
  182.   end
  183.  
  184.   #--------------------------------------------------------------------------
  185.   # new method: infect_enemies_include?
  186.   #--------------------------------------------------------------------------
  187.   def infect_enemies_include?(id)
  188.     infective_enemies.any? { |state| state.infect_enemies.keys.include?(id) }
  189.   end
  190.  
  191.   #--------------------------------------------------------------------------
  192.   # new method: infective_calc
  193.   #--------------------------------------------------------------------------
  194.   def update_infective
  195.     @infect_allies ||= {}
  196.     @infect_enemies ||= {}
  197.     #---
  198.     infective_allies.each { |state|
  199.       state.infect_allies.each { |id, hash|
  200.         @infect_allies[id] = hash[1] if @infect_allies[id].nil? || @infect_allies[id] <= 0
  201.         @infect_allies[id] -= 1
  202.       }
  203.     }
  204.     #---
  205.     infective_enemies.each { |state|
  206.       state.infect_enemies.each { |id, hash|
  207.         @infect_enemies[id] = hash[1] if @infect_enemies[id].nil? || @infect_enemies[id] <= 0
  208.         @infect_enemies[id] -= 1
  209.       }
  210.     }
  211.     #---
  212.     infective_allies.each { |state|
  213.       state.infect_allies.each { |id, hash|
  214.         next if @infect_allies[id] > 0
  215.         if self.actor?
  216.           battlers = $game_party.battle_members
  217.         else
  218.           battlers = $game_troop.members
  219.         end
  220.         if hash[0] <= 0
  221.           if rand(100) < hash[2]
  222.             battlers.each { |battler| battler.add_state(id) }
  223.           end
  224.         else
  225.           count = hash[0]
  226.           battlers = battlers.shuffle
  227.           battlers.each { |battler|
  228.             if battler && battler.alive? && !battler.state?(id)
  229.               if rand(100) > hash[2]
  230.                 battler.add_state(id)
  231.                 count -= 1
  232.               end
  233.             end
  234.             break if count <= 0
  235.           }
  236.         end
  237.       }
  238.     }
  239.     #---
  240.     infective_enemies.each { |state|
  241.       state.infect_enemies.each { |id, hash|
  242.         next if @infect_enemies[id] > 0
  243.         next if rand(100) > hash[2]
  244.         if self.actor?
  245.           battlers = $game_troop.members
  246.         else
  247.           battlers = $game_party.battle_members
  248.         end
  249.         if hash[0] <= 0
  250.           if rand(100) < hash[2]
  251.             battlers.each { |battler| battler.add_state(id) }
  252.           end
  253.         else
  254.           count = hash[0]
  255.           battlers = battlers.shuffle
  256.           battlers.each { |battler|
  257.             if battler && battler.alive? && !battler.state?(id)
  258.               if rand(100) > hash[2]
  259.                 battler.add_state(id)
  260.                 count -= 1
  261.               end
  262.             end
  263.             break if count <= 0
  264.           }
  265.         end
  266.       }
  267.     }
  268.   end
  269.  
  270.   #--------------------------------------------------------------------------
  271.   # new method: infective_clear
  272.   #--------------------------------------------------------------------------
  273.   def infective_clear
  274.     @infect_allies.each_key { |id|
  275.       @infect_allies[id] = nil unless infect_allies_include?(id)
  276.     }
  277.     #---
  278.     @infect_enemies.each_key { |id|
  279.       @infect_enemies[id] = nil unless infect_enemies_include?(id)
  280.     }
  281.   end
  282.  
  283.   #--------------------------------------------------------------------------
  284.   # alias method: on_turn_end
  285.   #--------------------------------------------------------------------------
  286.   alias yes_infect_state_on_turn_end on_turn_end
  287.   def on_turn_end
  288.     yes_infect_state_on_turn_end
  289.     update_infective
  290.     infective_clear
  291.   end
  292.  
  293. end # Game_Battler
  294.  
  295. #==============================================================================
  296. #
  297. # ¥ End of File
  298. #
  299. #==============================================================================


临死技(仅敌人有效)
RUBY 代码复制
  1. =begin
  2.       RGSS3
  3.  
  4.       ★ 断末魔 ★
  5.  
  6.       戦闘不能になる直前に指定のスキルを発動するエネミーを作れます。
  7.       
  8.       ● 仕様 ●==========================================================
  9.       断末魔を発動したエネミーは、
  10.       自身を断末魔スキルの効果対象にすることはできません。
  11.       ====================================================================
  12.       
  13.       ● 使い方 ●========================================================
  14.       エネミーのメモ欄に「临死技:n」と記述してください。
  15.       nには断末魔として発動させるスキルIDを指定してください。
  16.       ====================================================================
  17.       
  18.       ver1.00
  19.  
  20.       Last Update : 2015/05/13
  21.       5/13 : RGSS2にあったものを移植
  22.       
  23.       ろかん   [url]http://kaisou-ryouiki.sakura.ne.jp/[/url]
  24. =end
  25.  
  26. $rsi ||= {}
  27. $rsi["临死技"] = true
  28.  
  29. class RPG::Enemy < RPG::BaseItem
  30.   def death_throes_id
  31.     unless @death_throes_id
  32.       @death_throes_id = 0
  33.       self.note.each_line{|line|
  34.         if line =~ /临死技:(\d+)/i
  35.           @death_throes_id = $1.to_i
  36.           break
  37.         end
  38.       }
  39.     end
  40.     @death_throes_id
  41.   end
  42. end
  43.  
  44. class << BattleManager
  45.   #--------------------------------------------------------------------------
  46.   # ● ターン終了
  47.   #--------------------------------------------------------------------------
  48.   alias death_throes_turn_end turn_end
  49.   def turn_end
  50.     death_throes_turn_end if @phase
  51.   end
  52. end
  53.  
  54. class Game_Battler < Game_BattlerBase
  55.   #--------------------------------------------------------------------------
  56.   # ● 断末魔をあげるバトラーであるか
  57.   #--------------------------------------------------------------------------
  58.   def death_throes?
  59.     false
  60.   end
  61. end
  62.  
  63. class Game_Action
  64.   #--------------------------------------------------------------------------
  65.   # ● 断末魔のターゲットの配列作成
  66.   #--------------------------------------------------------------------------
  67.   def make_targets_with_death_throes
  68.     if item.for_opponent?
  69.       targets_for_opponents
  70.     elsif item.for_friend?
  71.       targets_for_friends_with_death_throes
  72.     else
  73.       []
  74.     end
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● 味方に対するターゲット
  78.   #--------------------------------------------------------------------------
  79.   def targets_for_friends_with_death_throes
  80.     if item.for_user?
  81.       []
  82.     elsif item.for_dead_friend?
  83.       if item.for_one?
  84.         [friends_unit.smooth_dead_target(@target_index)]
  85.       else
  86.         friends_unit.dead_members
  87.       end
  88.     elsif item.for_friend?
  89.       result = friends_unit.alive_members
  90.       result.delete(@subject)
  91.       if item.for_one?
  92.         result.empty? ? [] : [result.sample]
  93.       else
  94.         result
  95.       end
  96.     end
  97.   end
  98. end
  99.  
  100. class Game_Enemy < Game_Battler
  101.   #--------------------------------------------------------------------------
  102.   # ● 公開インスタンス変数
  103.   #--------------------------------------------------------------------------
  104.   attr_accessor :gave_death_throes
  105.   #--------------------------------------------------------------------------
  106.   # ● オブジェクト初期化
  107.   #--------------------------------------------------------------------------
  108.   alias death_throes_initialize initialize
  109.   def initialize(index, enemy_id)
  110.     death_throes_initialize(index, enemy_id)
  111.     @gave_death_throes = false # 既に断末魔をあげたかの判断に利用
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ● 断末魔をあげるバトラーであるか
  115.   #--------------------------------------------------------------------------
  116.   def death_throes?
  117.     @result.added_states.include?(death_state_id) && !death_throes_id.zero? && !@gave_death_throes
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● 断末魔で発動するスキルID
  121.   #--------------------------------------------------------------------------
  122.   def death_throes_id
  123.     enemy.death_throes_id
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ● 戦闘不能から復活
  127.   #--------------------------------------------------------------------------
  128.   def revive
  129.     super
  130.     @gave_death_throes = false
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # ● 戦闘不能判定
  134.   #--------------------------------------------------------------------------
  135.   def dead?
  136.     (!death_throes_id.zero? && !@gave_death_throes) ? false : super
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● 生存判定
  140.   #--------------------------------------------------------------------------
  141.   def alive?
  142.     (!death_throes_id.zero? && !@gave_death_throes) ? true : super
  143.   end
  144.   #--------------------------------------------------------------------------
  145.   # ● 断末魔行動の作成
  146.   #--------------------------------------------------------------------------
  147.   def make_death_throes_actions
  148.     clear_actions
  149.     action = Game_Action.new(self, true)
  150.     action.set_skill(death_throes_id)
  151.     @actions.push(action)
  152.   end
  153. end
  154.  
  155. class Window_BattleLog < Window_Selectable
  156.   #--------------------------------------------------------------------------
  157.   # ● 断末魔用メソッドの設定
  158.   #--------------------------------------------------------------------------
  159.   def method_death_throes=(method)
  160.     @method_death_throes = method
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # ● 影響を受けたステータスの表示
  164.   #--------------------------------------------------------------------------
  165.   alias death_throes_display_affected_status display_affected_status
  166.   def display_affected_status(target, item)
  167.     if target.death_throes?
  168.       wait_and_clear
  169.       last_added_states = target.result.added_states.dup
  170.       @method_death_throes.call(target)
  171.       target.result.added_states = last_added_states
  172.       death_throes_display_affected_status(target, item)
  173.       wait_and_clear
  174.       BattleManager.judge_win_loss
  175.     else
  176.       death_throes_display_affected_status(target, item)
  177.     end
  178.   end
  179. end
  180.  
  181. class Scene_Battle < Scene_Base
  182.   #--------------------------------------------------------------------------
  183.   # ● ログウィンドウの作成
  184.   #--------------------------------------------------------------------------
  185.   alias death_throes_create_log_window create_log_window
  186.   def create_log_window
  187.     death_throes_create_log_window
  188.     @log_window.method_death_throes = method(:process_death_throes)
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   # ● 断末魔の処理
  192.   #--------------------------------------------------------------------------
  193.   def process_death_throes(user)
  194.     last_subject = @subject
  195.     @subject = user
  196.     @subject.make_death_throes_actions
  197.     targets = @subject.current_action.make_targets_with_death_throes.compact
  198.     unless targets.empty?
  199.       if @subject.current_action
  200.         @status_window.open
  201.         use_death_throes(targets)
  202.         @subject.remove_current_action
  203.         process_action_end
  204.       end
  205.     end
  206.     @subject.gave_death_throes = true
  207.     @subject = last_subject
  208.     update_for_wait
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # ● 断末魔の使用
  212.   #--------------------------------------------------------------------------
  213.   def use_death_throes(targets)
  214.     @subject.sprite_effect_type = :whiten
  215.     item = @subject.current_action.item
  216.     @log_window.display_use_item(@subject, item)
  217.     @subject.use_item(item)
  218.     refresh_status
  219.     show_animation(targets, item.animation_id)
  220.     targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  221.     @log_window.wait_and_clear
  222.   end
  223. end



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


随机礼物(两个随机在图书馆有)
RUBY 代码复制
  1. =begin
  2.  
  3.   說明:
  4.  
  5.   事件中執行腳本呼叫來獲取隨機物品
  6.  
  7.     random_gift(group, number)
  8.     例:隨機獲得組:A中的三件物品:  random_gift(:A, 3)
  9.     
  10. =end
  11.  
  12. class Game_Interpreter
  13.   Random_Gifts = { #隨機獎品列表
  14.     :恢复 => [:i1_8], #i物品,w武器,每個組用逗號隔開
  15.     :符文 => [:i9_16],
  16.     :升阶 => [:i17_19],
  17.     :宝珠 => [:i22_29],
  18.     :终焉宝珠 => [:i140_144],
  19.     :攻击神器 => [:w71_75],
  20.     :防御神器 => [:a82_89],
  21.     :时空之光 => [:a108_116],
  22.     :点数 => [:i137_139],
  23.     :低级素材 => [:i1_8, :i20, :i21, :i35_37, :i17_19],
  24.     :中级素材 => [:i9_16, :i38, :i39, :i119, :i132],
  25.     :高级素材 => [:i114, :i103, :i70_72, :i56, :i45,:i22_29],
  26.  
  27.  
  28.  
  29. :奖池普 => [:i9_16, :i38, :i39, :i119, :i132,:i114, :i103, :i70_72, :i56, :i45,:i22_29],
  30. :王者 => [:i9_16, :i38, :i39, :i119, :i132,:i114, :i103, :i70_72, :i56, :i45,:i22_29,:i172_180,:i140_144],
  31. :礼装 => [:i9_16, :i38, :i39, :i119, :i132,:i114, :i103, :i70_72, :i56, :i45,:i22_29,:a118_131],
  32.  
  33.  
  34.  
  35.     :谱尼 => [:i130_132, :i119,:i144,:i70_72,:i53,:i46],
  36.     :票 => [:i1_8, :i17_19],
  37.     :券 => [:i1_8, :i17_19, :i9_16, :i22_29, :i137_139],
  38.     :药水 => [:i47, :i48, :i53_i56, :i84, :i85, :i78, :i133_i135, :i1_i8],
  39.     :各种礼包 => [:i145_152, :i154, :i155, :i157],
  40.     :末日 => [:i3, :i5, :i6, :i30, :i31, :i36, :i37, :i17_19, :i119, :i152],
  41.     :C => [:w1_60]
  42.   }
  43.   # 設置開關號碼,當開關開啟時一定會獲取到不同的幾件物品
  44.   # 設置為 nil 的話則總是有可能獲取到相同的物品
  45.   Diff_Gift_Swth = nil
  46.   def display_gift_text(name)
  47.     $game_message.add("获得:" + name)
  48.   end
  49.   #
  50.   def random_gift(group, num)
  51.     gifts = []
  52.     Random_Gifts[group].each {|g|
  53.       g = g.to_s
  54.       type = g[0]=="i" ? 0 : g[0]=="w" ? 1 : 2
  55.       if g.include?("_")
  56.         a, b = g.scan(/\d+/)
  57.         for i in a.to_i..b.to_i
  58.           gift = which_random_gift(type)[i]
  59.           gift ? gifts.push(gift) : (return report_random_gifts_crash(group, g))
  60.         end
  61.       else
  62.         g =~ /(\d+)/
  63.         gift = which_random_gift(type)[$1.to_i]
  64.         gift ? gifts.push(gift) : (return report_random_gifts_crash(group, g))
  65.       end
  66.     }
  67.     wait_for_message
  68.     if Diff_Gift_Swth && $game_switches[Diff_Gift_Swth]
  69.       gifts.sample(num).each {|g|
  70.         $game_party.gain_item(g, 1)
  71.         display_gift_text(g.name)
  72.       }
  73.     else
  74.       num.times {
  75.         g = gifts[rand(gifts.size)]
  76.         $game_party.gain_item(g, 1)
  77.         display_gift_text(g.name)
  78.       }
  79.     end
  80.     $game_message.face_name = ''
  81.     $game_message.face_index = 0
  82.     $game_message.background = 0
  83.     $game_message.position = 2
  84.     wait_for_message
  85.   end
  86.   #
  87.   def which_random_gift(type)
  88.     case type
  89.     when 0; $data_items
  90.     when 1; $data_weapons
  91.     when 2; $data_armors
  92.     end
  93.   end
  94.   #
  95.   def report_random_gifts_crash(group, g)
  96.     msgbox("隨機禮物發生錯誤:Group :#{group}  Element :#{g}") if $TEST
  97.   end
  98. end


新套装系统(6RVA帖应该功能最全了)
RUBY 代码复制
  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.  
  351. module EME
  352.  
  353.   MAX_ELEMENTS = 999
  354.  
  355. #----------------------------------------------------------------------------
  356. # Sets syntax
  357. #----------------------------------------------------------------------------
  358. # Sets = {
  359. #          set_id => [[equipment_type, equipment_id]]
  360. #        }
  361. #
  362. # set_id must be bigger than 0
  363. # equipment_type can be either 0 (weapon) or 1 (armor)
  364. # Add a comma after a ']' if it's not the last element in the array/hash.
  365. #
  366. # Don't forget to add a ungettable item at the end! Else, the last item will
  367. # count for two!
  368. #----------------------------------------------------------------------------
  369.  
  370. Sets = {
  371.          1 => [[0, 64], [1, 61]],
  372.          2 => [[0, 79], [1, 102], [1, 103], [1, 104]],
  373.          3 => [[0, 86], [1, 106], [1, 107], [1, 117]]
  374.  
  375.        }
  376.  
  377. #----------------------------------------------------------------------------
  378. # Sets syntax
  379. #----------------------------------------------------------------------------
  380. # Set_Bonuses = {
  381. #       set id => {
  382. #         amount of pieces required => [[sort, parameter, bonus]], [sort, random parameter, 0]]
  383. #                 }
  384. #                }
  385. #
  386. # set_id must correspond to set_id of Sets
  387. # amount of pieces required indicates how many pieces of the set the actor must
  388. # be wearing before receiving the bonus. If you want to skip one, make the only
  389. # element in it's array [0, 0, 0].
  390. # sort indicates which kind of parameters the bonuses change. See SPECIAL VALUES
  391. # for all sorts.
  392. # parameter can be a value depending on sort. See SPECIAL VALUES in the
  393. # instructions for their corresponding stats.
  394. # Bonus is a direct value added to 'parameter'. If 0, no bonus is added. If
  395. # negative, bonus becomes negative.
  396. # Random paramter is just a random parameter to prevent the last bonus from
  397. # being doubled. Always make the bonus of this element 0.
  398. #
  399. # Add a comma after a ']' or '}' if it's not the last element in the array/hash.
  400. #
  401. # Don't forget to add a bonus of [0, 0, 0] at the end! Or else, the last bonus
  402. # will be doubled!
  403. #----------------------------------------------------------------------------
  404. Set_Bonuses =
  405. {
  406.   1 => {
  407. #~     1 => [[2, 7, 5]],
  408.     1 => [4,269],
  409.     2 => [[0, 0, 200]]
  410.        },
  411.  
  412.   3 => {
  413.     1 => [[0, 2, 120]],
  414.     2 => [[0, 4, 120]],
  415.     3 => [[1, 2, 15]],
  416.     4 => [[1, 4, 15]]
  417.        },
  418.  
  419.   2 => {
  420.     1 => [[0, 2, 120]],
  421.     2 => [[2, 2, 10]],
  422.     3 => [[3, 5, 115]],
  423.     4 => [[1, 2, 25]],
  424.        }
  425. }
  426.  
  427. #-----------------------------------------------------------------------------
  428. # Sets syntax
  429. #-----------------------------------------------------------------------------
  430. # Set_Sounds = {
  431. #   set_id => {
  432. #     amount_of_pieces_required => [file_name, volume, pitch]
  433. #   }
  434. # }
  435. #
  436. # Resembles the other two parts so I think not much of an explanation is needed.
  437. # When the required amount of pieces has been equipped, the sound sound will be
  438. # played. Doesn't apply for unequipping. Again, watch the comma's!!
  439. #----------------------------------------------------------------------------
  440. Set_Sounds =
  441. {
  442.   1 => {
  443.     1 => ["Flash2", 100, 100], # <- comma here since it isn't the last one!
  444.     2 => ["Flash1", 100, 100],  # <- no comma here since it IS the last one!
  445.     3 => ["Flash1", 100, 100]  # <- no comma here since it IS the last one!
  446.        }
  447. }
  448.  
  449. end
  450.  
  451. # Only edit things past here if you know what you're doing
  452.  
  453. $imported = {} if $imported.nil?
  454. $imported["Emerald's Equipment Sets"] = true
  455.  
  456. #============================================================================
  457. #
  458. # Game_Actor
  459. # Handles everything for this script.
  460. #============================================================================
  461. class Game_Actor < Game_Battler
  462.  
  463.   attr_reader :active_sets
  464.   attr_reader :item_sets
  465.  
  466.   alias eme_ees_setup setup
  467.   def setup(actor_id)
  468.     @non_set_skills = []
  469.     @skill_from_sets = false
  470.     reset_bonuses
  471.     @active_sets = []
  472.     @item_sets = [0] * (EME::Sets.size + 1)
  473.     eme_ees_setup(actor_id)
  474.   end
  475.  
  476.   alias eme_init_equips init_equips
  477.   def init_equips(equips)
  478.     eme_init_equips(equips)
  479.     equips.each_with_index{|item_id, i|
  480.       etype_id = index_to_etype_id(i)
  481.       slot_id = empty_slot(etype_id)
  482.       for set_id in 1..EME::Sets.size
  483.         for ees_set_equip in EME::Sets[set_id]
  484.           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)
  485.             @item_sets[set_id] += 1
  486.             @active_sets.push(set_id) unless @active_sets.include?(set_id)
  487.           end
  488.         end
  489.       end
  490.     }
  491.     refresh
  492.   end
  493.  
  494.   def ees_is_the_set_item?(item, ees_set_equip)
  495.     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)
  496.   end
  497.  
  498.   alias eme_ees_learn_skill learn_skill
  499.   def learn_skill(skill_id)
  500.     eme_ees_learn_skill(skill_id)
  501.     @non_set_skills.push(skill_id) unless @skill_from_sets
  502.     @skill_from_sets = false
  503.   end
  504.  
  505.   alias eme_ebs_change_equip change_equip
  506.   def change_equip(slot_id, item)
  507.       for set_id in 1..EME::Sets.size
  508.         for ees_set_equip in EME::Sets[set_id]
  509.           if slot_id != nil and @equips[slot_id] != nil and @equips[slot_id].object != nil
  510.             if ees_is_the_set_item?(@equips[slot_id].object, ees_set_equip)
  511.               @item_sets[set_id] -= 1
  512.               @active_sets.delete(set_id) if @item_sets[set_id] == 0
  513.             end
  514.           end
  515.           if item != nil and ees_is_the_set_item?(item, ees_set_equip)
  516.             @item_sets[set_id] += 1
  517.             @active_sets.push(set_id) unless @active_sets.include?(set_id)
  518.             if EME::Set_Sounds.has_key?(set_id) and EME::Set_Sounds[set_id].has_key?(set_amount_wearing(set_id))
  519.               sound = EME::Set_Sounds[set_id][set_amount_wearing(set_id)]
  520.               Audio.se_play("Audio/SE/" + sound[0], sound[1], sound[2])
  521.             end
  522.           end
  523.         end
  524.       end
  525.     set_check
  526.     eme_ebs_change_equip(slot_id, item)
  527.   end
  528.  
  529.   def unlearn_set_skills(set_id)
  530.     EME::Set_Bonuses[set_id].each_value{|bonus_array|
  531.       bonus_array.each{|bonus|
  532.         if bonus[0] == 4
  533.           forget_skill(bonus[2]) unless @non_set_skills.include?(bonus[2])
  534.           @ees_skills.delete(bonus[2])
  535.         end
  536.       }
  537.     }
  538.   end
  539.  
  540.   def item_set_reset_all
  541.     @active_sets.each{|set_id| item_set_reset(set_id)}
  542.   end
  543.  
  544.   def item_set_reset(set_id)
  545.     return unless set_id > 0 and @item_sets[set_id] > 0
  546.     unlearn_set_skills(set_id)
  547.   end
  548.  
  549.   def release_unequippable_items(item_gain = true)
  550.     @equips.each_with_index do |item, i|
  551.       if !equippable?(item.object) || item.object.etype_id != equip_slots[i]
  552.         trade_item_with_party(nil, item.object) if item_gain
  553.         item.object = nil
  554.       end
  555.     end
  556.   end
  557.  
  558.   def release_unequippable_items(item_gain = true)
  559.     loop do
  560.       change_equips = 0
  561.       @equips.each_with_index do |item, i|
  562.         if !equippable?(item.object) or item.object.etype_id != equip_slots[i]
  563.           next if (RPG::Weapon.method_defined?(:two_handed?) and dual_wield? and (equip_slots[i] == 1 and item.object.etype_id == 0))
  564.           trade_item_with_party(nil, item.object) if item_gain
  565.           change_equips += 1 unless item.object.nil?
  566.           unless item.object.nil?
  567.           for set_id in 1..EME::Sets.size
  568.             for ees_set_equip in EME::Sets[set_id]
  569.               if ees_is_the_set_item?(item.object, ees_set_equip)
  570.                 @item_sets[set_id] -= 1
  571.                 @active_sets.delete(set_id) if @item_sets[set_id] == 0
  572.               end
  573.             end
  574.           end
  575.           end
  576.           item.object = nil
  577.         end
  578.       end
  579.       set_check
  580.       break if change_equips == 0
  581.     end
  582.   end
  583.  
  584.   alias eme_ebs_discard_equip discard_equip
  585.   def discard_equip(item)
  586.     slot_id = equips.index(item)
  587.     if slot_id != nil
  588.       for set_id in 1..EME::Sets.size
  589.         for ees_set_equip in EME::Sets[set_id]
  590.           if ees_is_the_set_item?(item, ees_set_equip)
  591.             @item_sets[set_id] -= 1
  592.             @active_sets.delete(set_id) if @item_sets[set_id] == 0
  593.           end
  594.         end
  595.       end
  596.     end
  597.     eme_ebs_discard_equip(item)
  598.     refresh
  599.   end
  600.  
  601.   def set_amount_wearing(set_id)
  602.     return @item_sets[set_id]
  603.   end
  604.  
  605.   def set_check
  606.     item_set_reset_all
  607.     reset_bonuses
  608.     @active_sets.each{|set| change_bonuses(set) unless set == nil}
  609.   end
  610.  
  611.   def change_bonuses(set_id)
  612.     return if set_id == 0 or set_amount_wearing(set_id) == 0
  613.     EME::Set_Bonuses[set_id].each_key{|key|
  614.       if set_amount_wearing(set_id) >= key
  615.         for g in 0...EME::Set_Bonuses[set_id][key].size
  616.           sort = EME::Set_Bonuses[set_id][key][g][0]
  617.           stat = EME::Set_Bonuses[set_id][key][g][1]
  618.           stat_bonus = EME::Set_Bonuses[set_id][key][g][2]
  619.           case EME::Set_Bonuses[set_id][key][g][0]
  620.           when 0
  621.             sets_param_change(stat, stat_bonus)
  622.           when 1
  623.             sets_per_param_change(stat, stat_bonus)
  624.           when 2
  625.             sets_xparam_change(stat, stat_bonus)
  626.           when 3
  627.             sets_sparam_change(stat, stat_bonus)
  628.           when 4
  629.             next if skill_learn?(stat_bonus)
  630.             @skill_from_sets = true
  631.             learn_skill(stat_bonus)
  632.             @ees_skills.push(stat_bonus)
  633.           when 5
  634.             stat -= 1
  635.             sets_element_rate_change(stat, stat_bonus)
  636.           when 6
  637.             stat -= 1
  638.             sets_debuff_rate_change(stat, stat_bonus)
  639.           when 7
  640.             stat -= 1
  641.             sets_state_rate_change(stat, stat_bonus)
  642.           when 8
  643.             sets_state_resist_change(stat, stat_bonus)
  644.           when 9
  645.             sets_atk_elements_change(stat, stat_bonus)
  646.           when 10
  647.             sets_atk_states_change(stat) if stat_bonus > 0
  648.             sets_atk_states_rate_change(stat, stat_bonus)
  649.           when 11
  650.             if stat < 2
  651.               change_sets_additional_wtypes(stat_bonus, (stat == 0 ? true : false))
  652.             elsif stat < 4
  653.               change_sets_additional_atypes(stat_bonus, (stat == 2))
  654.             elsif stat == 4
  655.               @eme_ebs_two_swords_style = true
  656.             end
  657.           when 12
  658.             sets_atk_specials_change(stat, stat_bonus)
  659.           when 13
  660.             add_sets_skill_types(stat, stat_bonus)
  661.           when 14
  662.             add_sets_sealed_skill_types(stat, stat_bonus)
  663.           when 15
  664.             add_sets_sealed_skills(stat, stat_bonus)
  665.           when 16
  666.             add_sets_fixed_equip_types(stat, stat_bonus)
  667.           when 17
  668.             add_sets_sealed_equip_types(stat, stat_bonus)
  669.           when 18
  670.             stat_bonus < 0 ? change_special_flags(stat, true) : change_special_flags(stat)
  671.           when 19
  672.             stat_bonus < 0 ? change_party_abilities(stat, true) : change_party_abilities(stat)
  673.           when 20
  674.             case stat
  675.             when 0
  676.               set_bonus_max_tp(stat_bonus)
  677.             when 1
  678.               set_atk_skill(stat_bonus)
  679.             when 2
  680.               set_grd_skill(stat_bonus)
  681.             end
  682.           end
  683.         end
  684.       end
  685.     }
  686.   end
  687.  
  688. #-------------------------------------------#
  689. # LABEL FOR AUTHOR                          #
  690. # Don't mind this ;)                        #
  691. #-------------------------------------------#
  692.  
  693.   def reset_bonuses
  694.     @sets_param_plus = [0] * 8
  695.     @sets_per_param_plus = [0] * 8
  696.     @sets_xparam_plus = [0] * 10
  697.     @sets_sparam_plus = [0] * 10
  698.     @sets_element_rate = [0] * (EME::MAX_ELEMENTS)
  699.     @sets_debuff_rate = [0] * 8
  700.     @sets_state_rate = [0] * ($data_states.size + 1)
  701.     @sets_state_resist = []
  702.     @sets_state_resist_remove = []
  703.     @sets_atk_elements = []
  704.     @sets_atk_elements_remove = []
  705.     @sets_atk_states = []
  706.     @sets_atk_states_rate = [0] * $data_states.size
  707.     @sets_atk_speed_plus = 0
  708.     @sets_atk_times_plus = 0
  709.     @sets_skill_types = []
  710.     @sets_skill_types_remove = []
  711.     @sets_sealed_skill_types = []
  712.     @sets_sealed_skill_types_remove = []
  713.     @sets_sealed_skills = []
  714.     @sets_sealed_skills_remove = []
  715.     @sets_fixed_equip_types = []
  716.     @sets_fixed_equip_types_remove = []
  717.     @sets_sealed_equip_types = []
  718.     @sets_sealed_equip_types_remove = []
  719.  
  720.     @ees_added_special_flags = []
  721.     @ees_removed_special_flags = []
  722.     @ees_added_party_abilities = []
  723.     @ees_removed_party_abilities = []
  724.     @ees_bonus_max_tp = 0
  725.     @new_atk_skill = nil
  726.     @new_grd_skill = nil
  727.  
  728.     @ees_skills = []
  729.     @sets_wtypes = []
  730.     @sets_atypes = []
  731.     @sets_removed_wtypes = []
  732.     @sets_removed_atypes = []
  733.     @eme_ebs_two_swords_style = false
  734.   end
  735.  
  736.   def sets_param_plus(param_id)
  737.     @sets_param_plus[param_id]
  738.   end
  739.  
  740.   def sets_param_change(param_id, value)
  741.     @sets_param_plus[param_id] += value
  742.   end
  743.  
  744.   def sets_per_param_plus(param_id)
  745.     value = param_base(param_id) + param_plus(param_id)
  746.     value *= @sets_per_param_plus[param_id] / 100
  747.     return value
  748.   end
  749.  
  750.   def sets_per_param_change(param_id, value)
  751.     @sets_per_param_plus[param_id] += value
  752.   end
  753.  
  754.   def sets_xparam_plus(param_id)
  755.     @sets_xparam_plus[param_id]
  756.   end
  757.  
  758.   def sets_xparam_change(param_id, value)
  759.     @sets_xparam_plus[param_id] += value
  760.   end
  761.  
  762.   def sets_sparam_plus(param_id)
  763.     @sets_sparam_plus[param_id]
  764.   end
  765.  
  766.   def sets_sparam_change(param_id, value)
  767.     @sets_sparam_plus[param_id] += value
  768.   end
  769.  
  770.   def sets_element_rate(element_id)
  771.     @sets_element_rate[element_id]
  772.   end
  773.  
  774.   def sets_element_rate_change(element_id, value)
  775.     @sets_element_rate[element_id] += value
  776.   end
  777.  
  778.   def sets_debuff_rate(param_id)
  779.     @sets_debuff_rate[param_id]
  780.   end
  781.  
  782.   def sets_debuff_rate_change(param_id, value)
  783.     @sets_debuff_rate[param_id] += value
  784.   end
  785.  
  786.   def sets_state_rate(state_id)
  787.     @sets_state_rate[state_id]
  788.   end
  789.  
  790.   def sets_state_rate_change(state_id, value)
  791.     @sets_state_rate[state_id] += value
  792.   end
  793.  
  794.   def sets_state_resist(state_id)
  795.     @sets_state_resist[state_id]
  796.   end
  797.  
  798.   def sets_state_resist_remove(state_id)
  799.     @sets_state_resist_remove[state_id]
  800.   end
  801.  
  802.   def sets_state_resist_change(state_id, value)
  803.     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))
  804.   end
  805.  
  806.   def sets_atk_elements(element_id)
  807.     @sets_atk_elements[element_id]
  808.   end
  809.  
  810.   def sets_atk_elements_remove(element_id)
  811.     @sets_atk_elements_remove[element_id]
  812.   end
  813.  
  814.   def sets_atk_elements_change(element_id, value)
  815.     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))
  816.   end
  817.  
  818.   def sets_atk_states(state_id)
  819.     @sets_atk_states[state_id]
  820.   end
  821.  
  822.   def sets_atk_states_change(state_id)
  823.     @sets_atk_states.push(state_id) unless @sets_atk_states.include?(state_id)
  824.   end
  825.  
  826.   def sets_atk_states_rate(state_id)
  827.     @sets_atk_states_rate[state_id]
  828.   end
  829.  
  830.   def sets_atk_states_rate_change(state_id, value)
  831.     @sets_atk_states_rate[state_id] += value
  832.   end
  833.  
  834.   def sets_atk_speed_plus
  835.     @sets_atk_speed_plus
  836.   end
  837.  
  838.   def sets_atk_times_plus
  839.     @sets_atk_times_plus
  840.   end
  841.  
  842.   def sets_atk_specials_change(parameter, value)
  843.     parameter == 0 ? @sets_atk_speed_plus += value : @sets_atk_times_plus += value
  844.   end
  845.  
  846.   def sets_skill_types(skill_type_id)
  847.     @sets_skill_types[skill_type_id]
  848.   end
  849.  
  850.   def sets_skill_types_remove(skill_type_id)
  851.     @sets_skill_types_remove[skill_type_id]
  852.   end
  853.  
  854.   def add_sets_skill_types(skill_type_id, value)
  855.     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))
  856.   end
  857.  
  858.   def sets_sealed_skill_types(skill_type_id)
  859.     @sets_sealed_skill_types[skill_type_id]
  860.   end
  861.  
  862.   def sets_sealed_skill_types_remove(skill_type_id)
  863.     @sets_sealed_skill_types_remove[skill_type_id]
  864.   end
  865.  
  866.   def add_sealed_skill_types(skill_type_id, value)
  867.     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))
  868.   end
  869.  
  870.   def sets_sealed_skills(skill_id)
  871.     @sets_sealed_skills[skill_id]
  872.   end
  873.  
  874.   def sets_sealed_skills_remove(skill_id)
  875.     @sets_sealed_skills_remove[skill_id]
  876.   end
  877.  
  878.   def add_sets_sealed_skills(skill_id, value)
  879.     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))
  880.   end
  881.  
  882.   def sets_additional_wtypes
  883.     @sets_wtypes
  884.   end
  885.  
  886.   def sets_additional_atypes
  887.     @sets_atypes
  888.   end
  889.  
  890.   def sets_removed_wtypes
  891.     @sets_removed_wtypes
  892.   end
  893.  
  894.   def sets_removed_atypes
  895.     @sets_removed_atypes
  896.   end
  897.  
  898.   def change_sets_additional_wtypes(wtype_id, positive_change = true)
  899.     positive_change ? @sets_wtypes.push(wtype_id) : @sets_removed_wtypes.push(wtype_id)
  900.   end
  901.  
  902.   def change_sets_additional_atypes(atype_id, positive_change = true)
  903.     positive_change ? @sets_atypes.push(atype_id) : @sets_removed_atypes.push(atype_id)
  904.   end
  905.  
  906.   def sets_fixed_equip_types(equip_type_id)
  907.     @sets_fixed_equip_types[equip_type_id]
  908.   end
  909.  
  910.   def sets_fixed_equip_types_remove(equip_type_id)
  911.     @sets_fixed_equip_types_remove[equip_type_id]
  912.   end
  913.  
  914.   def add_fixed_equip_types(equip_type_id, value)
  915.     value >= 0 ? @sets_fixed_equip_types.push(equip_type_id) : @sets_fixed_equip_types_remove.delete(sequip_type_id)
  916.   end
  917.  
  918.   def sets_sealed_equip_types(equip_type_id)
  919.     @sets_sealed_equip_types[equip_type_id]
  920.   end
  921.  
  922.   def sets_sealed_equip_types_remove(equip_type_id)
  923.     @sets_sealed_equip_types_remove[equip_type_id]
  924.   end
  925.  
  926.   def add_sealed_equip_types(equip_type_id, value)
  927.     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))
  928.   end
  929.  
  930.   def change_special_flags(flag_id, negative = false)
  931.     !negative ? @ees_added_special_flags.push(flag_id) : @ees_removed_special_flags.push(flag_id)
  932.   end
  933.  
  934.   def change_party_abilities(ability_id, negative = false)
  935.     !negative ? @ees_added_party_abilities.push(ability_id) : @ees_removed_party_abilities.push(ability_id)
  936.   end
  937.  
  938.   def set_bonus_max_tp(value)
  939.     @ees_bonus_max_tp += value
  940.   end
  941.  
  942.   def set_atk_skill(skill_id)
  943.     @new_atk_skill = skill_id
  944.   end
  945.  
  946.   def set_grd_skill(skill_id)
  947.     @new_grd_skill = skill_id
  948.   end
  949.  
  950. #-------------------------------------------#
  951. # 'NOTHER LABEL FOR AUTHOR                  #
  952. # Don't mind this ;)                        #
  953. #-------------------------------------------#
  954.  
  955.   def param(param_id)
  956.     value = param_base(param_id) + param_plus(param_id) + sets_param_plus(param_id) #+ [sets_per_param_plus(param_id), 0].max
  957.     value *= param_rate(param_id) * param_buff_rate(param_id)
  958.     [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
  959.   end
  960.  
  961.   alias eme_ebs_xparam xparam
  962.   def xparam(xparam_id)
  963.     value = eme_ebs_xparam(xparam_id) + sets_xparam_plus(xparam_id) / 100
  964.     return value
  965.   end
  966.  
  967.   alias eme_ebs_sparam sparam
  968.   def sparam(sparam_id)
  969.     value = eme_ebs_sparam(sparam_id) + sets_sparam_plus(sparam_id) / 100
  970.     return value
  971.   end
  972.  
  973.   alias eme_ebs_element_rate element_rate
  974.   def element_rate(element_id)
  975.     value = eme_ebs_element_rate(element_id) + sets_element_rate(element_id) / 100
  976.     return value
  977.   end
  978.  
  979.   alias eme_ebs_debuff_rate debuff_rate
  980.   def debuff_rate(param_id)
  981.     value = eme_ebs_debuff_rate(param_id) + sets_debuff_rate(param_id) / 100
  982.     return value
  983.   end
  984.  
  985.   alias eme_ebs_state_rate state_rate
  986.   def state_rate(state_id)
  987.     value = eme_ebs_state_rate(state_id) + sets_state_rate(state_id) / 100
  988.     return value
  989.   end
  990.  
  991.   alias eme_ebs_state_resist_set state_resist_set
  992.   def state_resist_set
  993.     value = eme_ebs_state_resist_set
  994.     @sets_state_resist.each{|state| value.push(state) unless value.include?(element)}
  995.     @sets_state_resist_remove.each{|state| value.delete(state)}
  996.     return value
  997.   end
  998.  
  999.   alias eme_ebs_atk_elements atk_elements
  1000.   def atk_elements
  1001.     value = eme_ebs_atk_elements
  1002.     @sets_atk_elements.each{|element| value.push(element) unless value.include?(element)}
  1003.     @sets_atk_elements_remove.each{|element| value.delete(element)}
  1004.     return value
  1005.   end
  1006.  
  1007.   alias eme_ebs_atk_states atk_states
  1008.   def atk_states
  1009.     value = eme_ebs_atk_states
  1010.     @sets_atk_states.each{|state| value.push(@sets_atk_states[i]) }
  1011.     return value
  1012.   end
  1013.  
  1014.   alias eme_ebs_atk_states_rate atk_states_rate
  1015.   def atk_states_rate(state_id)
  1016.     value = eme_ebs_atk_states_rate(state_id) + sets_atk_states_rate(state_id) / 100
  1017.     return value
  1018.   end
  1019.  
  1020.   alias eme_ebs_atk_speed atk_speed
  1021.   def atk_speed
  1022.     value = eme_ebs_atk_speed + sets_atk_speed_plus / 100
  1023.     return value
  1024.   end
  1025.  
  1026.   alias eme_ebs_atk_times atk_times_add
  1027.   def atk_times_add
  1028.     value = [eme_ebs_atk_times + sets_atk_times_plus / 100, 0].max
  1029.     return value
  1030.   end
  1031.  
  1032.   alias eme_ebs_dual_wield? dual_wield?
  1033.   def dual_wield?
  1034.     return true if @eme_ebs_two_swords_style
  1035.     eme_ebs_dual_wield?
  1036.   end
  1037.  
  1038.   alias eme_ebs_added_skill_types added_skill_types
  1039.   def added_skill_types
  1040.     value = eme_ebs_added_skill_types
  1041.     @sets_skill_types.each{|sk_type| value.push(sk_type)}
  1042.     @sets_skill_types_remove.each{|sk_type| value.delete(sk_type)}
  1043.     return value
  1044.   end
  1045.  
  1046.   def skill_type_sealed?(stype_id)
  1047.     value = features_set(FEATURE_STYPE_SEAL)
  1048.     @sets_sealed_skill_types.each{|sk_type| value.push(sk_type)}
  1049.     @sets_sealed_skill_types_remove.each{|sk_type| value.delete(sk_type)}
  1050.     return true if value.include?(stype_id)
  1051.   end
  1052.  
  1053.   def skill_sealed?(skill_id)
  1054.     value = features_set(FEATURE_SKILL_SEAL)
  1055.     @sets_sealed_skills.each{|skill| value.push(skill)}
  1056.     @sets_sealed_skills_remove.each{|skill| value.delete(skill)}
  1057.     return true if value.include?(skill_id)
  1058.   end
  1059.  
  1060.   def equip_wtype_ok?(wtype_id)
  1061.     value = features_set(FEATURE_EQUIP_WTYPE)
  1062.     @sets_wtypes.each{|w_type| value.push(w_type)}
  1063.     @sets_removed_wtypes.each{|w_type| value.delete(w_type)}
  1064.     return true if value.include?(wtype_id)
  1065.   end
  1066.  
  1067.   def equip_atype_ok?(atype_id)
  1068.     value = features_set(FEATURE_EQUIP_ATYPE)
  1069.     @sets_atypes.each{|a_type| value.push(a_type)}
  1070.     @sets_removed_atypes.each{|a_type| value.delete(a_type)}
  1071.     return true if value.include?(atype_id)
  1072.   end
  1073.  
  1074.   def equip_type_fixed?(etype_id)
  1075.     value = features_set(FEATURE_EQUIP_FIX)
  1076.     @sets_fixed_equip_types.each{|e_type| value.push(e_type)}
  1077.     @sets_fixed_equip_types_remove.each{|e_type| value.delete(e_type)}
  1078.     return true if value.include?(etype_id)
  1079.   end
  1080.  
  1081.   def equip_type_sealed?(etype_id)
  1082.     value = features_set(FEATURE_EQUIP_SEAL)
  1083.     @sets_sealed_equip_types.each{|e_type| value.push(e_type)}
  1084.     @sets_sealed_equip_types_remove.each{|e_type| value.delete(e_type)}
  1085.     return true if value.include?(etype_id)
  1086.   end
  1087.  
  1088.   alias eme_ees_special_flag special_flag
  1089.   def special_flag(flag_id)
  1090.     return false if @ees_removed_special_flags.include?(flag_id)
  1091.     return @ees_added_special_flags.include?(flag_id) ? true : eme_ees_special_flag(flag_id)
  1092.   end
  1093.  
  1094.   alias eme_ees_party_ability party_ability
  1095.   def party_ability(ability_id)
  1096.     return false if @ees_removed_party_abilities.include?(ability_id)
  1097.     return @ees_added_party_abilities.include?(ability_id) ? true : eme_ees_party_ability(ability_id)
  1098.   end
  1099.  
  1100.   alias eme_ees_max_tp max_tp
  1101.   def max_tp
  1102.     return eme_ees_max_tp + @ees_bonus_max_tp
  1103.   end
  1104.  
  1105.   alias eme_ees_attack_skill attack_skill_id
  1106.   def attack_skill_id
  1107.     return @new_atk_skill unless @new_atk_skill == nil
  1108.     return eme_ees_attack_skill
  1109.   end
  1110.  
  1111.   alias eme_ees_guard_skill guard_skill_id
  1112.   def guard_skill_id
  1113.     return @new_grd_skill unless @new_grd_skill == nil
  1114.     return eme_ees_guard_skill
  1115.   end
  1116.  
  1117. end


战斗优势:之前那个展示进度的那个大大的帖子。说过这个很特别
RUBY 代码复制
  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.  
  104. ($imported ||= {})["Galvs_Battle_Favour"] = true
  105.  
  106. module Galv_Favour
  107. #------------------------------------------------------------------------------#
  108. #  SCRIPT SETTINGS
  109. #------------------------------------------------------------------------------#  
  110.  
  111.   DISABLE_SWITCH = 999        # Turn switch ON to disable meters. Do this outside
  112.                             # of combat.
  113.  
  114. #----------------------------#
  115. #   FAVOUR BAR AESTHETICS:   #
  116. #----------------------------#
  117.  
  118.   FONT = "Arial"            # The font for all bar related text
  119.  
  120.   TEXT_SIZE = 22            # The font size of the party/enemy text names.
  121.   TEXT_Y = 0                # Offset ALL bar text vertically different to bars
  122.  
  123.   PARTY_TEXT = "我方优势"      # Text displayed above party favour bar.
  124.   PARTY_TEXT_COLOR = 0      # The colour of the party text
  125.   ENEMY_TEXT = "敌方优势"      # Text displayed above enemy favour bar.
  126.   ENEMY_TEXT_COLOR = 0      # The colour of the enemy text
  127.  
  128.   TURNS_TEXT_SIZE = 22      # Size of the turns text
  129.   TURNS_TEXT = " CD"     # Text displayed after remaining special turns
  130.   PARTY_TURNS_COLOR = 8     # Colour of the turns text for party
  131.   ENEMY_TURNS_COLOR = 8    # Colour of the turns text for enemy
  132.  
  133.   SHOW_NUMBERS = true       # Show amount of favour as numbers above the bars.
  134.  
  135.   BAR_WIDTH = 250           # How wide the bars are.
  136.   BAR_HEIGHT = 10           # The height of the actual bars.
  137.   BAR_Y = 0                 # Offset the bars vertically different to text
  138.   BAR_POSITION = "bottom"   # Position of the favour bars. Can be "top" or
  139.                             # "bottom" or put in a number without quotes to
  140.                             # display the bar that many pixels from the top.
  141.  
  142.   PARTY_BAR_COLORS = [4,11]     # Gradient colors of party bar.
  143.   ENEMY_BAR_COLORS = [14,10]    # Gradient colors of enemy bar.
  144.  
  145.   PARTY_ACTIVATE_SE = ["Barrier", 100, 100]  # SE when favours reach MAX
  146.   PARTY_ACTIVATE_COLORS = [4,9,12,16]        # bar cycles these colors randomly
  147.  
  148.   ENEMY_ACTIVATE_SE = ["Barrier", 100, 100]  # ["SE Name", volume, pitch]
  149.   ENEMY_ACTIVATE_COLORS = [2,10,18,21]        # bar cycles these colors randomly
  150.  
  151. #-----------------------#
  152. #   FAVOUR MECHANICS:   #
  153. #-----------------------#
  154.  
  155.   FAVOUR_MAX = 100          # The number used to determine a full favour bar.
  156.  
  157.   INITIAL_PARTY_FAVOUR = [5,20]    # Set amount of favour when battles begin
  158.   INITIAL_ENEMY_FAVOUR = [5,20]    # randomized between the first and second
  159.                                    # numbers.
  160.  
  161.   REDUCE_OPPONENT = 0.5     # When an enemy or party gains favour, the opposing
  162.                             # side loses favour equal to this amount gained
  163.                             # multiplied by this number. ie. 0.5 is 50%
  164.  
  165.   SPECIAL_ACTIVATE = 119          # Common event ID that is activated when
  166.                                 # the party reaches MAX favour.
  167.   ENEMY_SPECIAL_ACTIVATE = 89    # Common event ID that is activated when
  168.                                 # the enemy reaches MAX favour.
  169.  
  170.   SPECIAL_TURNS = 5         # When MAX favour is reached, the party or enemy
  171.                             # team enter a "Special mode". They retain their
  172.   # MAX favour for this many turns. Once the special is over, the favour returns
  173.   # to 0. While in special mode, the opposing team's favour gains are halved.
  174.  
  175.  
  176.   # FAVOUR STATES
  177.  
  178.   # Below are lists to set up to determine states to apply for each favour level.
  179.   # They are listed in pairs - a favour amount and a state id.
  180.   # eg.  20 => 21
  181.   # means: when favour amount reaches 20, apply state with id 21 to party/enemy.
  182.   # Each time the next favour level is reached, it removes the previous favour
  183.   # state the party or enemy troop had active.
  184.  
  185.  
  186.   FAVOUR_STATES = {  # don't touch this.
  187. #------------------------------------------------------------------------------#
  188.  
  189.     # PARTY FAVOUR STATES
  190.  
  191.       0 => 0,           # when less than 20, display no state. Leave as is.
  192.       20 => 0,         # when 20 favour earned, state 21 applied.
  193.       40 => 0,         # when 40 favour earned, state 22 applied.
  194.       60 => 0,         # when 60 favour earned, state 23 applied.
  195.       80 => 0,         # when 80 favour earned, state 24 applied.
  196.       100 => 0,        # when 100 favour earned, state 25 applied.
  197.  
  198. #------------------------------------------------------------------------------#
  199.   } # don't touch this
  200. #------------------------------------------------------------------------------#
  201.  
  202.   ENEMY_FAVOUR_STATES = {  # don't touch this.
  203. #------------------------------------------------------------------------------#
  204.  
  205.     # ENEMY TROOP FAVOUR STATES
  206.  
  207.       0 => 0,           # when less than 20, display no state. Leave as is.
  208.       20 => 0,         # when 20 favour earned, state 21 applied.
  209.       40 => 0,         # when 40 favour earned, state 22 applied.
  210.       60 => 0,         # when 60 favour earned, state 23 applied.
  211.       80 => 0,         # when 80 favour earned, state 24 applied.
  212.       100 => 0,        # when 100 favour earned, state 25 applied.
  213.  
  214. #------------------------------------------------------------------------------#
  215.   } # don't touch this
  216. #------------------------------------------------------------------------------#
  217. #  CHARGING FAVOUR
  218. #------------------------------------------------------------------------------#
  219. #  Below are equations for enemy and party to charge favour on damage caused.
  220. #  You will need some scripting knowledge to modify this. I have set it up to
  221. #  be used with 100 favour as the max in mind.
  222. #------------------------------------------------------------------------------#
  223.  
  224. end # don't touch
  225. module Galv_Favour_Mechanics # don't touch
  226.  
  227. #------------------------------------------------------------------------------#
  228. #  CHARGING PARTY FAVOUR - Equation for gaining favour when causing damage:
  229. #------------------------------------------------------------------------------#  
  230.   def charge_favour(damage) # don't touch
  231. #------------------------------------------------------------------------------#  
  232.  
  233.     # Generate random favour depending % of max life damage actor does to enemy.
  234.     # Add 10% of all actor's favour bonuses:
  235.  
  236.     @charge = rand(6) + 5 + (10 * ([damage.to_f,mhp].min / mhp)).to_i
  237.     @charge += (get_actor_favour_bonus * 0.1).to_i
  238.  
  239. #------------------------------------------------------------------------------#  
  240.   end # don't touch
  241. #------------------------------------------------------------------------------#
  242. #  CHARGING ENEMY FAVOUR - Equation for gaining favour when causing damage:
  243. #------------------------------------------------------------------------------#  
  244.   def charge_enemy_favour(damage) # don't touch
  245. #------------------------------------------------------------------------------#  
  246.  
  247.     # Generate random favour depending % of max life damage enemy does to actor.
  248.     # Add 10% of enemy favour bonus:
  249.  
  250.     @charge = rand(6) + 5 + (10 * ([damage.to_f,mhp].min / mhp)).to_i
  251.     @charge += (get_enemy_favour_bonus * 0.1).to_i
  252.  
  253. #------------------------------------------------------------------------------#  
  254. #------------------------------------------------------------------------------#
  255. #  END OF SCRIPT SETTINGS
  256. #------------------------------------------------------------------------------#  
  257.   end
  258.  
  259.   def get_actor_favour_bonus
  260.     @bonus = $game_temp.user.favour
  261.     @no_equips = $game_temp.user.equips.count
  262.     @no_equips.times { |i|
  263.       if $game_temp.user.equips[i] != nil
  264.         @bonus += $game_temp.user.equips[i].favour_bonus
  265.       end
  266.     }
  267.     @bonus += $game_temp.skill_used.favour_bonus
  268.     return @bonus
  269.   end
  270.  
  271.   def get_enemy_favour_bonus
  272.     @bonus = $game_temp.user.favour
  273.     @bonus += $game_temp.skill_used.favour_bonus
  274.     return @bonus
  275.   end
  276.  
  277. end # Galv_Favour_Mechanics
  278.  
  279.  
  280. class RPG::BaseItem
  281.  
  282.   def favour_bonus
  283.     if @favour_bonus.nil?
  284.       if @note =~ /<favour: (.*)>/i
  285.         @favour_bonus = $1.to_i
  286.       else
  287.         @favour_bonus = 0
  288.       end
  289.     end
  290.     @favour_bonus
  291.   end
  292.  
  293.   def mod_pfavour
  294.     if @mod_pfavour.nil?
  295.       if @note =~ /<mod_pfavour: (.*)>/i
  296.         @mod_pfavour = $1.to_i
  297.       else
  298.         @mod_pfavour = 0
  299.       end
  300.     end
  301.     @mod_pfavour
  302.   end
  303.   def mod_efavour
  304.     if @mod_efavour.nil?
  305.       if @note =~ /<mod_efavour: (.*)>/i
  306.         @mod_efavour = $1.to_i
  307.       else
  308.         @mod_efavour = 0
  309.       end
  310.     end
  311.     @mod_efavour
  312.   end
  313.  
  314.   def do_pfavour
  315.     if @do_pfavour.nil?
  316.       if @note =~ /<do_pfavour: (.*)>/i
  317.         @do_pfavour = $1.to_i
  318.       else
  319.         @do_pfavour = 0
  320.       end
  321.     end
  322.     @do_pfavour
  323.   end
  324.   def do_efavour
  325.     if @do_efavour.nil?
  326.       if @note =~ /<do_efavour: (.*)>/i
  327.         @do_efavour = $1.to_i
  328.       else
  329.         @do_efavour = 0
  330.       end
  331.     end
  332.     @do_efavour
  333.   end
  334. end # RPG::BaseItem
  335.  
  336.  
  337. class Window_Favour < Window_Base
  338.  
  339.   def initialize
  340.     super(0, 0, Graphics.width, Graphics.height)
  341.     @cycle = 0
  342.     contents.font.name = Galv_Favour::FONT
  343.     update_location
  344.     draw_favour_bars
  345.     self.opacity = 0
  346.   end
  347.  
  348.   def bar_width
  349.     return Galv_Favour::BAR_WIDTH
  350.   end
  351.  
  352.   def update
  353.     self.refresh if $game_party.favour == Galv_Favour::FAVOUR_MAX || $game_party.enemy_favour == Galv_Favour::FAVOUR_MAX || $imported["YEA-BattleEngine"]
  354.   end
  355.  
  356.   def refresh
  357.     contents.clear
  358.     draw_favour_bars
  359.   end
  360.  
  361.   def open
  362.     refresh
  363.     super
  364.   end
  365.  
  366.   def update_location
  367.     case Galv_Favour::BAR_POSITION
  368.     when "top"
  369.       self.y = 0
  370.     when "bottom"
  371.       self.y = Graphics.height - 170
  372.     else
  373.       self.y = Galv_Favour::BAR_POSITION
  374.     end
  375.     self.z = 0
  376.   end
  377.  
  378.   def party_random_color
  379.     @cycle = rand(Galv_Favour::PARTY_ACTIVATE_COLORS.count)
  380.     return Galv_Favour::PARTY_ACTIVATE_COLORS[@cycle]
  381.   end
  382.  
  383.   def enemy_random_color
  384.     @cycle = rand(Galv_Favour::ENEMY_ACTIVATE_COLORS.count)
  385.     return Galv_Favour::ENEMY_ACTIVATE_COLORS[@cycle]
  386.   end
  387.  
  388.   def draw_favour_bars
  389.     draw_party_favour(Graphics.width / 2, 0, bar_width)
  390.     draw_enemy_favour(Graphics.width / 2 - bar_width - 20, 0, bar_width)
  391.   end
  392.  
  393.   def draw_party_favour(x, y, width)
  394.     if $game_party.favour < Galv_Favour::FAVOUR_MAX
  395.       draw_favour_gauge(x, y, width, favour_rate, text_color(Galv_Favour::PARTY_BAR_COLORS[0]), text_color(Galv_Favour::PARTY_BAR_COLORS[1]))
  396.     else
  397.       draw_favour_gauge(x, y, width, favour_rate, text_color(party_random_color), text_color(party_random_color))
  398.       change_color(text_color(Galv_Favour::PARTY_TURNS_COLOR))
  399.       xr = x + width
  400.       contents.font.size = Galv_Favour::TURNS_TEXT_SIZE
  401.       draw_text(xr - 100, y + Galv_Favour::TEXT_Y, 100, contents.font.size, $game_party.p_special.to_s + Galv_Favour::TURNS_TEXT, 2)
  402.  
  403.     end
  404.     change_color(text_color(Galv_Favour::PARTY_TEXT_COLOR))
  405.     contents.font.size = Galv_Favour::TEXT_SIZE
  406.  
  407.     draw_text(x, y + Galv_Favour::TEXT_Y, bar_width, contents.font.size, party_text)
  408.     if Galv_Favour::SHOW_NUMBERS && $game_party.p_special <= 0
  409.       xr = x + width
  410.       draw_text(xr - 100, y + Galv_Favour::TEXT_Y, 100, contents.font.size, $game_party.favour.to_s, 2)
  411.     end
  412.   end
  413.  
  414.   def draw_enemy_favour(x, y, width)
  415.  
  416.     if $game_party.enemy_favour < Galv_Favour::FAVOUR_MAX
  417.       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]))
  418.     else
  419.       draw_reverse_gauge(x, y, width, enemy_favour_rate, text_color(enemy_random_color), text_color(enemy_random_color))
  420.       change_color(text_color(Galv_Favour::ENEMY_TURNS_COLOR))
  421.       contents.font.size = Galv_Favour::TURNS_TEXT_SIZE
  422.       draw_text(x + 2, y + Galv_Favour::TEXT_Y, 100, contents.font.size, $game_party.e_special.to_s + Galv_Favour::TURNS_TEXT, 0)
  423.     end
  424.     change_color(text_color(Galv_Favour::ENEMY_TEXT_COLOR))
  425.     contents.font.size = Galv_Favour::TEXT_SIZE
  426.  
  427.     draw_text(x + 2, y + Galv_Favour::TEXT_Y, bar_width, contents.font.size, enemy_text,2)
  428.     if Galv_Favour::SHOW_NUMBERS && $game_party.e_special <= 0
  429.       xr = x + width
  430.       draw_text(x + 2, y + Galv_Favour::TEXT_Y, 100, contents.font.size, $game_party.enemy_favour.to_s, 0)
  431.     end
  432.   end
  433.  
  434.   def enemy_text
  435.     Galv_Favour::ENEMY_TEXT
  436.   end
  437.   def enemy_favour_rate
  438.     [$game_party.enemy_favour.to_f, Galv_Favour::FAVOUR_MAX].min / Galv_Favour::FAVOUR_MAX
  439.   end
  440.  
  441.   def party_text
  442.     Galv_Favour::PARTY_TEXT
  443.   end
  444.   def favour_rate
  445.     [$game_party.favour.to_f, Galv_Favour::FAVOUR_MAX].min / Galv_Favour::FAVOUR_MAX
  446.   end
  447.  
  448.  
  449.   def draw_favour_gauge(x, y, width, rate, color1, color2)
  450.     fill_w = (width * rate).to_i
  451.     gauge_y = y + line_height - 8 + Galv_Favour::BAR_Y
  452.     contents.fill_rect(x, gauge_y, width, Galv_Favour::BAR_HEIGHT, gauge_back_color)
  453.     contents.gradient_fill_rect(x, gauge_y, fill_w, Galv_Favour::BAR_HEIGHT, color1, color2)
  454.   end
  455.  
  456.   def draw_reverse_gauge(x, y, width, rate, color1, color2)
  457.     fill_w = (width * rate).to_i
  458.     gauge_y = y + line_height - 8 + Galv_Favour::BAR_Y
  459.     contents.fill_rect(x, gauge_y, width, Galv_Favour::BAR_HEIGHT, gauge_back_color)
  460.     contents.gradient_fill_rect(x + width - fill_w, gauge_y, fill_w, Galv_Favour::BAR_HEIGHT, color1, color2)
  461.   end
  462.  
  463. end # Window_Favour < Window_Base
  464.  
  465.  
  466. class Scene_Battle < Scene_Base
  467.  
  468.   alias galv_favour_sb_start start
  469.   def start
  470.     set_initial_favour
  471.     galv_favour_sb_start
  472.   end
  473.  
  474.   alias galv_favour_sb_terminate terminate
  475.   def terminate
  476.     clear_favour
  477.     galv_favour_sb_terminate
  478.   end
  479.  
  480.   alias galv_favour_create_all_windows create_all_windows
  481.   def create_all_windows
  482.     galv_favour_create_all_windows
  483.     @favour_window = Window_Favour.new if !$game_switches[Galv_Favour::DISABLE_SWITCH]
  484.   end
  485.  
  486.   alias galv_favour_refresh_status refresh_status
  487.   def refresh_status
  488.     galv_favour_refresh_status
  489.     @favour_window.refresh if !$game_switches[Galv_Favour::DISABLE_SWITCH]
  490.   end
  491.  
  492. if $imported["YEA-BattleEngine"]
  493.     def apply_item_effects(target, item)
  494.     if $imported["YEA-LunaticObjects"]
  495.       lunatic_object_effect(:prepare, item, @subject, target)
  496.     end
  497.     target.item_apply(@subject, item)
  498.     status_redraw_target(@subject)
  499.     status_redraw_target(target) unless target == @subject
  500.     @log_window.display_action_results(target, item)
  501.     if $imported["YEA-LunaticObjects"]
  502.       lunatic_object_effect(:during, item, @subject, target)
  503.     end
  504.     @status_window.refresh if !$game_switches[Galv_Favour::DISABLE_SWITCH]
  505.     perform_collapse_check(target)
  506.   end
  507. end
  508.  
  509.   def set_initial_favour
  510.     $game_party.p_special = 0
  511.     $game_party.e_special = 0
  512.     min = Galv_Favour::INITIAL_PARTY_FAVOUR[0]
  513.     max = Galv_Favour::INITIAL_PARTY_FAVOUR[1]
  514.     $game_party.favour = rand(max - min) + min
  515.     min = Galv_Favour::INITIAL_ENEMY_FAVOUR[0]
  516.     max = Galv_Favour::INITIAL_ENEMY_FAVOUR[1]
  517.     $game_party.enemy_favour = rand(max - min) + min
  518.     if $game_switches[Galv_Favour::DISABLE_SWITCH]
  519.       $game_party.favour = 0
  520.       $game_party.enemy_favour = 0
  521.     end
  522.   end
  523.  
  524.   def clear_favour
  525.     $game_party.favour = 0
  526.     $game_party.enemy_favour = 0
  527.   end
  528.  
  529. end # Scene_Battle < Scene_Base
  530.  
  531.  
  532. class Game_Party < Game_Unit
  533.   attr_accessor :favour
  534.   attr_accessor :enemy_favour
  535.   attr_accessor :p_special
  536.   attr_accessor :e_special
  537.  
  538.   alias galv_favour_initialize initialize
  539.   def initialize
  540.     galv_favour_initialize
  541.     @favour = 0
  542.     @enemy_favour = 0
  543.     @p_special = 0
  544.     @e_special = 0
  545.   end
  546. end # Game_Party < Game_Unit
  547.  
  548.  
  549. class Game_BattlerBase
  550.  
  551.   def apply_state
  552.     # get hash with KEYS: favour required and VALUES: state ids
  553.     @list = Galv_Favour::FAVOUR_STATES
  554.  
  555.     # get state_id required:
  556.     @get_state = (@list.select {|k,v| k <= $game_party.favour}).max[1]
  557.  
  558.     # add state_id required. Remove all other state_id's in list
  559.     Galv_Favour::FAVOUR_STATES.each {|key, value|
  560.       $game_party.alive_members.each do |mem|
  561.  
  562.         if value == @get_state
  563.           if !mem.state?(@get_state) && value != 0
  564.             mem.add_favour_state(@get_state)
  565.           end
  566.         else
  567.           mem.remove_state(value)
  568.         end
  569.       end  
  570.     }
  571.   end
  572.  
  573.   def apply_enemy_state
  574.     # get hash with KEYS: favour required and VALUES: state ids
  575.     @enemy_list = Galv_Favour::ENEMY_FAVOUR_STATES
  576.  
  577.     # get state_id required:
  578.     @get_enemy_state = (@enemy_list.select {|k,v| k <= $game_party.enemy_favour}).max[1]
  579.  
  580.     # add state_id required. Remove all other state_id's in list
  581.     Galv_Favour::ENEMY_FAVOUR_STATES.each {|key, value|
  582.       $game_troop.alive_members.each do |enemy|
  583.  
  584.         if value == @get_enemy_state
  585.           if !enemy.state?(@get_enemy_state) && value != 0
  586.             enemy.add_favour_state(@get_enemy_state)
  587.           end
  588.         else
  589.           enemy.remove_state(value)
  590.         end
  591.       end  
  592.     }
  593.   end
  594.  
  595.   def check_favour
  596.     return if $game_switches[Galv_Favour::DISABLE_SWITCH]
  597.     if $game_party.favour >= Galv_Favour::FAVOUR_MAX
  598.       $game_party.favour = Galv_Favour::FAVOUR_MAX
  599.       if $game_party.p_special == 0 && $game_party.favour == Galv_Favour::FAVOUR_MAX
  600.         RPG::SE.new(Galv_Favour::PARTY_ACTIVATE_SE[0], Galv_Favour::PARTY_ACTIVATE_SE[1], Galv_Favour::PARTY_ACTIVATE_SE[2]).play
  601.         $game_party.p_special = Galv_Favour::SPECIAL_TURNS
  602.         $game_temp.reserve_common_event(Galv_Favour::SPECIAL_ACTIVATE)
  603.       end
  604.     elsif $game_party.favour <= 0
  605.       $game_party.favour = 0
  606.       $game_party.p_special = 0
  607.     end
  608.  
  609.     if $game_party.enemy_favour >= Galv_Favour::FAVOUR_MAX
  610.       $game_party.enemy_favour = Galv_Favour::FAVOUR_MAX
  611.       if $game_party.e_special == 0 && $game_party.enemy_favour == Galv_Favour::FAVOUR_MAX
  612.         RPG::SE.new(Galv_Favour::ENEMY_ACTIVATE_SE[0], Galv_Favour::ENEMY_ACTIVATE_SE[1], Galv_Favour::ENEMY_ACTIVATE_SE[2]).play
  613.         $game_party.e_special = Galv_Favour::SPECIAL_TURNS
  614.         $game_temp.reserve_common_event(Galv_Favour::ENEMY_SPECIAL_ACTIVATE)
  615.       end
  616.     elsif $game_party.enemy_favour <= 0
  617.       $game_party.enemy_favour = 0
  618.       $game_party.e_special = 0
  619.     end
  620.   end
  621. end # Game_BattlerBase
  622.  
  623.  
  624. class Game_Battler < Game_BattlerBase
  625.   include Galv_Favour_Mechanics
  626.  
  627.   alias galv_favour_execute_damage execute_damage
  628.   def execute_damage(user)
  629.     $game_temp.user = user
  630.     galv_favour_execute_damage(user)
  631.   end
  632.  
  633.   alias galv_favour_on_damage on_damage
  634.   def on_damage(value)
  635.     galv_favour_on_damage(value)
  636.     return if $game_switches[Galv_Favour::DISABLE_SWITCH]
  637.     if $game_temp.user.actor?
  638.       # When enemy is damaged
  639.       if $game_party.e_special > 0
  640.         charge = charge_favour(value)
  641.         $game_party.favour += charge / 2
  642.       else
  643.         charge = charge_favour(value)
  644.         $game_party.favour += charge
  645.         $game_party.enemy_favour -= (charge * Galv_Favour::REDUCE_OPPONENT).to_i
  646.       end
  647.     else
  648.       # When party is damaged
  649.       if $game_party.p_special > 0
  650.         charge = charge_enemy_favour(value)
  651.         $game_party.enemy_favour += charge / 2
  652.       else
  653.         charge = charge_enemy_favour(value)
  654.         $game_party.enemy_favour += charge
  655.         $game_party.favour -= (charge * Galv_Favour::REDUCE_OPPONENT).to_i
  656.       end
  657.     end
  658.     check_favour
  659.     apply_state
  660.     apply_enemy_state
  661.   end
  662.  
  663.   def add_favour_state(state_id)
  664.     add_new_state(state_id) unless state?(state_id)
  665.     reset_state_counts(state_id)
  666.     @result.added_states.push(state_id).uniq!
  667.   end
  668.  
  669.   alias galv_favour_use_item use_item
  670.   def use_item(item)
  671.     $game_temp.skill_used = item
  672.     galv_favour_use_item(item)
  673.     change_party_favour if $game_temp.skill_used.mod_pfavour != 0
  674.     change_enemy_favour if $game_temp.skill_used.mod_efavour != 0
  675.     apply_state
  676.     apply_enemy_state
  677.     check_favour
  678.   end
  679.  
  680.   def change_party_favour
  681.     case $game_temp.skill_used.mod_pfavour
  682.     when 1
  683.       $game_party.favour += $game_temp.skill_used.do_pfavour
  684.     when 2
  685.       $game_party.favour *= $game_temp.skill_used.do_pfavour
  686.     when 3
  687.       $game_party.favour = $game_temp.skill_used.do_pfavour
  688.     end
  689.   end
  690.  
  691.   def change_enemy_favour
  692.     case $game_temp.skill_used.mod_efavour
  693.     when 1
  694.       $game_party.enemy_favour += $game_temp.skill_used.do_efavour
  695.     when 2
  696.       $game_party.enemy_favour *= $game_temp.skill_used.do_efavour
  697.     when 3
  698.       $game_party.enemy_favour = $game_temp.skill_used.do_efavour
  699.     end
  700.   end
  701.  
  702. end # Game_Battler < Game_BattlerBase
  703.  
  704.  
  705. class Game_Enemy < Game_Battler
  706.   attr_accessor :favour
  707.  
  708.   alias galv_favour_enemy_initialize initialize
  709.   def initialize(index, enemy_id)
  710.     galv_favour_enemy_initialize(index, enemy_id)
  711.     @favour = $data_enemies[enemy_id].favour_bonus
  712.   end
  713.  
  714. end # Game_Enemy < Game_Battler
  715.  
  716.  
  717. class Game_Actor < Game_Battler
  718.   attr_accessor :favour
  719.  
  720.   alias galv_favour_actor_initialize initialize
  721.   def initialize(actor_id)
  722.     galv_favour_actor_initialize(actor_id)
  723.     @favour = $data_actors[actor_id].favour_bonus
  724.   end
  725.  
  726. end # Game_Actor < Game_Battler
  727.  
  728.  
  729. class Game_Temp
  730.   attr_accessor :user
  731.   attr_accessor :skill_used
  732. end # Game_Temp
  733.  
  734.  
  735. module BattleManager
  736.  
  737.   class << self
  738.     alias galv_favour_bm_turn_end turn_end
  739.  
  740.     def turn_end
  741.       galv_favour_bm_turn_end
  742.       return if $game_switches[Galv_Favour::DISABLE_SWITCH]
  743.       if $game_party.p_special >= 0 && $game_party.favour == Galv_Favour::FAVOUR_MAX
  744.         $game_party.p_special -= 1
  745.         if $game_party.p_special == 0
  746.           $game_party.favour = 0
  747.           rem_party_state
  748.         end
  749.       end
  750.  
  751.       if $game_party.e_special >= 0 && $game_party.enemy_favour == Galv_Favour::FAVOUR_MAX
  752.         $game_party.e_special -= 1
  753.         if $game_party.e_special == 0
  754.           $game_party.enemy_favour = 0
  755.           rem_enemy_state
  756.         end
  757.       end
  758.     end
  759.  
  760.     def rem_party_state
  761.       @list = Galv_Favour::FAVOUR_STATES
  762.  
  763.       Galv_Favour::FAVOUR_STATES.each {|key, value|
  764.         $game_party.alive_members.each do |mem|
  765.           mem.remove_state(value)
  766.         end  
  767.       }
  768.     end
  769.  
  770.     def rem_enemy_state
  771.       @enemy_list = Galv_Favour::ENEMY_FAVOUR_STATES
  772.  
  773.       Galv_Favour::ENEMY_FAVOUR_STATES.each {|key, value|
  774.         $game_troop.alive_members.each do |enemy|
  775.           enemy.remove_state(value)
  776.         end  
  777.       }
  778.     end
  779.   end
  780.  
  781. end # BattleManager


状态蓝盾
RUBY 代码复制
  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.  
  10. module REGEXP
  11.   module MANASHIELD
  12.     MANASHIELD = /<manashield:[ ]*(\d+),[ ]*(\d+)[%“]?>/i
  13.   end # MANASHIELD
  14. end # REGEXP
  15.  
  16. #==============================================================================
  17. # ¡ DataManager
  18. #==============================================================================
  19.  
  20. module DataManager
  21.  
  22.   #--------------------------------------------------------------------------
  23.   # alias method: load_database
  24.   #--------------------------------------------------------------------------
  25.   class <<self; alias load_database_manashield load_database; end
  26.   def self.load_database
  27.     load_database_manashield
  28.     initialize_manashield
  29.   end
  30.  
  31.   #--------------------------------------------------------------------------
  32.   # new method: initialize_manashield
  33.   #--------------------------------------------------------------------------
  34.   def self.initialize_manashield
  35.     groups = [$data_states]
  36.     groups.each { |group|
  37.       group.each { |obj|
  38.         next if obj.nil?
  39.         obj.initialize_manashield
  40.       }
  41.     }
  42.   end
  43.  
  44. end # DataManager
  45.  
  46. #==============================================================================
  47. # ¡ RPG::BaseItem
  48. #==============================================================================
  49.  
  50. class RPG::BaseItem
  51.  
  52.   #--------------------------------------------------------------------------
  53.   # * Public Instance Variables
  54.   #--------------------------------------------------------------------------
  55.   attr_accessor :manashield
  56.  
  57.   #--------------------------------------------------------------------------
  58.   # new method: initialize_manashield
  59.   #--------------------------------------------------------------------------
  60.   def initialize_manashield
  61.     #---
  62.     self.note.split(/[\r\n]+/).each { |line|
  63.       case line
  64.       when REGEXP::MANASHIELD::MANASHIELD
  65.         @manashield = [$1.to_i, [$2.to_i, 100].min]
  66.       end
  67.     }
  68.   end
  69.  
  70. end # RPG::BaseItem
  71.  
  72. #==============================================================================
  73. # ¡ Game_ActionResult
  74. #==============================================================================
  75.  
  76. class Game_ActionResult
  77.  
  78.   #--------------------------------------------------------------------------
  79.   # alias method: make_damage
  80.   #--------------------------------------------------------------------------
  81.   alias manashield_make_damage make_damage
  82.   def make_damage(value, item)
  83.     manashield_make_damage(value, item)
  84.     #---
  85.     if @battler.manashield && @battler.mp > 0
  86.       dpm = @battler.manashield[0]
  87.       percent = @battler.manashield[1]
  88.       shield = (@hp_damage * percent.to_f) / 100.0
  89.       shield = shield / dpm.to_f
  90.       shield = [shield, @battler.mp.to_f].min
  91.       @hp_damage -= (shield * dpm.to_f).to_i
  92.       @mp_damage += shield.to_i
  93.     end
  94.   end
  95.  
  96. end # Game_ActionResult
  97.  
  98. #==============================================================================
  99. # ¡ Game_Battler
  100. #==============================================================================
  101.  
  102. class Game_Battler < Game_BattlerBase
  103.  
  104.   #--------------------------------------------------------------------------
  105.   # new method: manashield
  106.   #--------------------------------------------------------------------------
  107.   def manashield
  108.     mns = nil
  109.     states.each { |state|
  110.       next unless state.manashield
  111.       mns = state.manashield
  112.       break
  113.     }
  114.     return mns ? mns : false
  115.   end
  116.  
  117. end # Game_Battler


充能的技能(比那位tarxod大大那个延迟好用,因为T大大每回合都能动,但是到了释放时刻,没达到要求就不放了)
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ¥ Yami Engine Ace - Charge Skill
  4. # -- Last Updated: 2012.05.13
  5. # -- Level: Easy
  6. # -- Requires: none
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YSE-ChargeSkill"] = true
  12.  
  13. #==============================================================================
  14. # ¥ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.05.13 - Fixed Enemy Charging.
  17. # 2012.03.30 - Fixed Skill Targets.
  18. # 2012.03.29 - Fixed Auto Battle bug.
  19. # 2012.03.27 - Fixed Cancel Charge bug.
  20. # 2012.03.26 - Fixed Battle End bug.
  21. # 2012.03.18 - Started and Finished Script.
  22. #
  23. #==============================================================================
  24. # ¥ Introduction
  25. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  26. # This script provides charging skill feature. Charging Skill means that skill
  27. # will be used after some turn it was choosen.
  28. #
  29. #==============================================================================
  30. # ¥ Instructions
  31. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  32. # To install this script, open up your script editor and copy/paste this script
  33. # to an open slot below ¥ Materials/‘fÞ but above ¥ Main. Remember to save.
  34. #
  35. # -----------------------------------------------------------------------------
  36. # Skill/Item Notetags - These notetags go in the skill/item notebox in the database.
  37. # -----------------------------------------------------------------------------
  38. # <charge turn: x>
  39. # Make skill be a charge skill with x charging turns.
  40. # -----------------------------------------------------------------------------
  41. # <start charge message>
  42. # example
  43. # </start charge message>
  44. #
  45. # Set the Charging Start Message to example.
  46. # -----------------------------------------------------------------------------
  47. # <continue charge message>
  48. # example
  49. # </continue charge message>
  50. #
  51. # Set the Charging Continue Message to example.
  52. #
  53. #==============================================================================
  54. # ¥ Compatibility
  55. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  56. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  57. # it will run with RPG Maker VX without adjusting.
  58. #
  59. #==============================================================================
  60.  
  61. module YSE
  62.   module CHARGE_SKILL
  63.  
  64.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  65.     # - Visual Settings -
  66.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  67.     VISUAL_SETTING = { # Start.
  68.       # Message shows when choose a charge skill.
  69.       # Set this to nil to disable.
  70.       :default_msg_start      =>  "%s 开始充能 %s!",
  71.       # Message shows when end a charging turn.
  72.       # Set this to nil to disable.
  73.       :default_msg_continue   =>  "%s 还在充能 %s...",
  74.     } # End.
  75.  
  76.   end # CHARGE_SKILL
  77. end # YSE
  78.  
  79. #==============================================================================
  80. # ¥ Editting anything past this point may potentially result in causing
  81. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  82. # halitosis so edit at your own risk.
  83. #==============================================================================
  84.  
  85. #==============================================================================
  86. # ¡ Regular Expression
  87. #==============================================================================
  88.  
  89. module YSE
  90.   module REGEXP
  91.   module USABLEITEM
  92.  
  93.     CHARGE_TURN = /<(?:CHARGE_TURN|charge turn):[ ](\d+)?>/i
  94.     START_MSG_BEGIN = /<(?:START_CHARGE_MESSAGE|start charge message)>/i
  95.     START_MSG_END = /<\/(?:START_CHARGE_MESSAGE|start charge message)>/i
  96.     CONT_MSG_BEGIN = /<(?:CONTINUE_CHARGE_MESSAGE|continue charge message)>/i
  97.     CONT_MSG_END = /<\/(?:CONTINUE_CHARGE_MESSAGE|continue charge message)>/i
  98.  
  99.   end # STATE
  100.   end # REGEXP
  101. end # YSE
  102.  
  103. #==============================================================================
  104. # ¡ DataManager
  105. #==============================================================================
  106.  
  107. module DataManager
  108.  
  109.   #--------------------------------------------------------------------------
  110.   # alias method: load_database
  111.   #--------------------------------------------------------------------------
  112.   class <<self; alias load_database_ysecs load_database; end
  113.   def self.load_database
  114.     load_database_ysecs
  115.     load_notetags_ysecs
  116.   end
  117.  
  118.   #--------------------------------------------------------------------------
  119.   # new method: load_notetags_ysecs
  120.   #--------------------------------------------------------------------------
  121.   def self.load_notetags_ysecs
  122.     groups = [$data_skills, $data_items]
  123.     for group in groups
  124.       for obj in group
  125.         next if obj.nil?
  126.         obj.load_notetags_ysecs
  127.       end
  128.     end
  129.   end
  130.  
  131. end # DataManager
  132.  
  133. #==============================================================================
  134. # ¡ RPG::UsableItem
  135. #==============================================================================
  136.  
  137. class RPG::UsableItem < RPG::BaseItem
  138.  
  139.   #--------------------------------------------------------------------------
  140.   # public instance variables
  141.   #--------------------------------------------------------------------------
  142.   attr_accessor :charge_turn
  143.   attr_accessor :start_msg
  144.   attr_accessor :continue_msg
  145.  
  146.   #--------------------------------------------------------------------------
  147.   # common cache: load_notetags_ysecs
  148.   #--------------------------------------------------------------------------
  149.   def load_notetags_ysecs
  150.     @start_begin = false
  151.     @continue_begin = false
  152.     @charge_turn = 0
  153.     #---
  154.     self.note.split(/[\r\n]+/).each { |line|
  155.       case line
  156.       #---
  157.       when YSE::REGEXP::USABLEITEM::CHARGE_TURN
  158.         @charge_turn = $1.to_i
  159.       when YSE::REGEXP::USABLEITEM::START_MSG_BEGIN
  160.         @start_begin = true
  161.       when YSE::REGEXP::USABLEITEM::START_MSG_END
  162.         @start_begin = false
  163.       when YSE::REGEXP::USABLEITEM::CONT_MSG_BEGIN
  164.         @continue_begin = true
  165.       when YSE::REGEXP::USABLEITEM::CONT_MSG_END
  166.         @continue_begin = false
  167.       else
  168.         @start_msg = line.to_s if @start_msg.nil? && @start_begin
  169.         @start_msg += line.to_s if @start_begin
  170.         @continue_msg = line.to_s if @continue_msg.nil? && @continue_begin
  171.         @continue_msg += line.to_s if @continue_begin
  172.       end
  173.     } # self.note.split
  174.     #---
  175.     @charge_turn = nil if @charge_turn <= 0
  176.     @start_msg = YSE::CHARGE_SKILL::VISUAL_SETTING[:default_msg_start]
  177.     @continue_msg = YSE::CHARGE_SKILL::VISUAL_SETTING[:default_msg_continue]
  178.     @start_msg = nil if @start_msg == ""
  179.     @continue_msg = nil if @continue_msg == ""
  180.   end
  181.  
  182. end # RPG::UsableItem
  183.  
  184. #==============================================================================
  185. # ¡ Game_Battler
  186. #==============================================================================
  187.  
  188. class Game_Battler < Game_BattlerBase
  189.  
  190.   #--------------------------------------------------------------------------
  191.   # public instance variables
  192.   #--------------------------------------------------------------------------
  193.   attr_accessor :charged
  194.   attr_accessor :first_charge
  195.  
  196.   #--------------------------------------------------------------------------
  197.   # alias method: auto_battle?
  198.   #--------------------------------------------------------------------------
  199.   alias yse_auto_battle_cs auto_battle?
  200.   def auto_battle?
  201.     charging? ? false : yse_auto_battle_cs
  202.   end
  203.  
  204.   #--------------------------------------------------------------------------
  205.   # new method: charging?
  206.   #--------------------------------------------------------------------------
  207.   def charging?
  208.     !@charging_cache.nil? || @charged
  209.   end
  210.  
  211.   #--------------------------------------------------------------------------
  212.   # new method: start_charge
  213.   #--------------------------------------------------------------------------
  214.   def start_charge
  215.     return false if charging?
  216.     return false if current_action.item.charge_turn.nil?
  217.     @charging_cache = current_action.clone
  218.     @charge_turn = current_action.item.charge_turn
  219.     return true
  220.   end
  221.  
  222.   #--------------------------------------------------------------------------
  223.   # new method: current_charging
  224.   #--------------------------------------------------------------------------
  225.   def current_charging
  226.     @charging_cache
  227.   end
  228.  
  229.   #--------------------------------------------------------------------------
  230.   # new method: end_charge
  231.   #--------------------------------------------------------------------------
  232.   def end_charge
  233.     @actions.push(@charging_cache)
  234.     @charging_cache = nil
  235.     @charge_turn = nil
  236.     @charged = true
  237.     return true
  238.   end
  239.  
  240.   #--------------------------------------------------------------------------
  241.   # new method: cancel_charge
  242.   #--------------------------------------------------------------------------
  243.   def cancel_charge
  244.     clear_actions
  245.     @charging_cache = nil
  246.     @charge_turn = nil
  247.     @charged = false
  248.   end
  249.  
  250.   #--------------------------------------------------------------------------
  251.   # new method: update_charge_skill
  252.   #--------------------------------------------------------------------------
  253.   def update_charge_skill
  254.     @charge_turn -= 1
  255.     return end_charge if @charge_turn == 0
  256.     return false
  257.   end
  258.  
  259.   #--------------------------------------------------------------------------
  260.   # alias method: on_battle_end
  261.   #--------------------------------------------------------------------------
  262.   alias yse_on_battle_end_cs on_battle_end
  263.   def on_battle_end
  264.     cancel_charge
  265.     yse_on_battle_end_cs
  266.   end
  267.  
  268. end # Game_Battler
  269.  
  270. #==============================================================================
  271. # ¡ Game_Actor
  272. #==============================================================================
  273.  
  274. class Game_Actor < Game_Battler
  275.  
  276.   #--------------------------------------------------------------------------
  277.   # alias method: inputable?
  278.   #--------------------------------------------------------------------------
  279.   alias yse_inputable_cs inputable?
  280.   def inputable?
  281.     yse_inputable_cs && !charging?
  282.   end
  283.  
  284. end # Game_Actor
  285.  
  286. #==============================================================================
  287. # ¡ Game_Enemy
  288. #==============================================================================
  289.  
  290. class Game_Enemy < Game_Battler
  291.  
  292.   #--------------------------------------------------------------------------
  293.   # alias method: make_actions
  294.   #--------------------------------------------------------------------------
  295.   alias yse_make_actions_cs make_actions
  296.   def make_actions
  297.     return super if charging?
  298.     yse_make_actions_cs
  299.   end
  300.  
  301. end # Game_Enemy
  302.  
  303. #==============================================================================
  304. # ¡ Scene_Battle
  305. #==============================================================================
  306.  
  307. class Scene_Battle < Scene_Base
  308.  
  309.   #--------------------------------------------------------------------------
  310.   # alias method: execute_action
  311.   #--------------------------------------------------------------------------
  312.   alias yse_execute_action_bacs execute_action
  313.   def execute_action
  314.     return start_charge if @subject.start_charge
  315.     yse_execute_action_bacs
  316.   end
  317.  
  318.   #--------------------------------------------------------------------------
  319.   # alias method: process_action_end
  320.   #--------------------------------------------------------------------------
  321.   alias yse_process_action_end_bacs process_action_end
  322.   def process_action_end
  323.     process_charge_skill
  324.     yse_process_action_end_bacs
  325.   end
  326.  
  327.   #--------------------------------------------------------------------------
  328.   # new method: start_charge
  329.   #--------------------------------------------------------------------------
  330.   def start_charge
  331.     @subject.first_charge = true
  332.     return if @subject.current_action.item.start_msg.nil?
  333.     str = @subject.current_action.item.start_msg
  334.     skill = @subject.current_action.item
  335.     skill_text = sprintf("\\i[%d]%s", skill.icon_index, skill.name)
  336.     text = sprintf(str, @subject.name, skill_text)
  337.     @log_window.add_text(text)
  338.     3.times do @log_window.wait end
  339.     @log_window.back_one
  340.   end
  341.  
  342.   #--------------------------------------------------------------------------
  343.   # new method: process_charge_skill
  344.   #--------------------------------------------------------------------------
  345.   def process_charge_skill
  346.     return @subject.first_charge = false if @subject.first_charge
  347.     return unless @subject.charging?
  348.     return unless check_charge_turn
  349.     process_action_charge
  350.   end
  351.  
  352.   #--------------------------------------------------------------------------
  353.   # new method: check_charge_turn
  354.   #--------------------------------------------------------------------------
  355.   def check_charge_turn
  356.     continue = @subject.update_charge_skill
  357.     if continue
  358.       return true
  359.     else
  360.       return false if @subject.current_charging.item.continue_msg.nil?
  361.       str = @subject.current_charging.item.continue_msg
  362.       skill = @subject.current_charging.item
  363.       skill_text = sprintf("\\i[%d]%s", skill.icon_index, skill.name)
  364.       text = sprintf(str, @subject.name, skill_text)
  365.       @log_window.add_text(text)
  366.       3.times do @log_window.wait end
  367.       @log_window.back_one
  368.     end
  369.     return false
  370.   end
  371.  
  372.   #--------------------------------------------------------------------------
  373.   # new method: process_action_charge
  374.   #--------------------------------------------------------------------------
  375.   def process_action_charge
  376.     loop do
  377.       break if $game_troop.all_dead?
  378.       break unless @subject.current_action
  379.       @subject.current_action.prepare
  380.       execute_action if @subject.current_action.valid?
  381.       @subject.remove_current_action
  382.     end
  383.     @subject.charged = false
  384.   end
  385.  
  386. end # Scene_Battle
  387.  
  388. #==============================================================================
  389. #
  390. # ¥ End of File
  391. #
  392. #==============================================================================


环境脚本
RUBY 代码复制
  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.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-FieldStateEffects"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.11 - Started Script and Finished.
  17. #
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # Field States are states that are applied to all actors and enemies without
  22. # discrimination. Field states cannot be removed through usual means and can
  23. # only be applied through certain skills and items. Multiple field states can
  24. # be added at once whether side by side or overwriting any previous field
  25. # states. Skills and items can also alter the turns of existing field states.
  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. # <add field state: x>
  37. # <add field state: x, x>
  38. # Causes the action to add state x to the field, making it apply to everyone
  39. # and cannot be removed through normal state removal means. Insert multiples of
  40. # this tag to have the action cause multiple field states.
  41. #
  42. # <remove field state: x>
  43. # <remove field state: x, x>
  44. # Causes the action to remove state x from the field. This does not remove
  45. # states that were inflicted normally. Insert multiples of this tag to remove
  46. # multiple field states.
  47. #
  48. # <remove all field states>
  49. # Causes the action to remove all field states. This does not remove states
  50. # that were inflicted normally.
  51. #
  52. # <overwrite field state: x>
  53. # <overwrite field state: x, x>
  54. # Causes the action to remove all field states and then add field states x,
  55. # making it apply to everyone and cannot be removed through normal state
  56. # removal means. Insert multiples of this tag to have the action overwrite and
  57. # add more field states.
  58. #
  59. # <field state x turns: +y>
  60. # <field state x turns: -y>
  61. # Changes the remaining turns on field state x by y amount. If a field state
  62. # is to reach 0 or less turns through this process, the field state is removed.
  63. # This effect does not add turns to field states that weren't inflicted. Insert
  64. # multiples of this tag to adjust multiple field states at once.
  65. #
  66. # <all field state turns: +x>
  67. # <all field state turns: -x>
  68. # Changes the remaining turns on all field states by x amount. If a field state
  69. # is to reach 0 or less turns through this process, the field state is removed.
  70. #
  71. # -----------------------------------------------------------------------------
  72. # Item Notetags - These notetags go in the items notebox in the database.
  73. # -----------------------------------------------------------------------------
  74. # <add field state: x>
  75. # <add field state: x, x>
  76. # Causes the action to add state x to the field, making it apply to everyone
  77. # and cannot be removed through normal state removal means. Insert multiples of
  78. # this tag to have the action cause multiple field states.
  79. #
  80. # <remove field state: x>
  81. # <remove field state: x, x>
  82. # Causes the action to remove state x from the field. This does not remove
  83. # states that were inflicted normally. Insert multiples of this tag to remove
  84. # multiple field states.
  85. #
  86. # <remove all field states>
  87. # Causes the action to remove all field states. This does not remove states
  88. # that were inflicted normally.
  89. #
  90. # <overwrite field state: x>
  91. # <overwrite field state: x, x>
  92. # Causes the action to remove all field states and then add field states x,
  93. # making it apply to everyone and cannot be removed through normal state
  94. # removal means. Insert multiples of this tag to have the action overwrite and
  95. # add more field states.
  96. #
  97. # <field state x turns: +y>
  98. # <field state x turns: -y>
  99. # Changes the remaining turns on field state x by y amount. If a field state
  100. # is to reach 0 or less turns through this process, the field state is removed.
  101. # This effect does not add turns to field states that weren't inflicted. Insert
  102. # multiples of this tag to adjust multiple field states at once.
  103. #
  104. # <all field state turns: +x>
  105. # <all field state turns: -x>
  106. # Changes the remaining turns on all field states by x amount. If a field state
  107. # is to reach 0 or less turns through this process, the field state is removed.
  108. #
  109. # -----------------------------------------------------------------------------
  110. # State Notetags - These notetags go in the states notebox in the database.
  111. # -----------------------------------------------------------------------------
  112. # <field back 1: string>
  113. # <field back 2: string>
  114. # If this state is being used as a field state and this state is the state with
  115. # the highest priority, these notetags will determine the battlebacks used
  116. # while the field state is in effect. If this notetag is not used, there will
  117. # be no changes to the battleback.
  118. #
  119. #==============================================================================
  120. # ▼ Compatibility
  121. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  122. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  123. # it will run with RPG Maker VX without adjusting.
  124. #
  125. #==============================================================================
  126.  
  127. module YEA
  128.   module FIELD_STATES
  129.  
  130.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  131.     # - Visual Settings -
  132.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  133.     # This setting causes a wave effect to play whenever the battlebacks change
  134.     # due to field state effects.
  135.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  136.     WAVE_EFFECT = true  # Plays a wave effect when the battleback changes.
  137.  
  138.   end # FIELD_STATES
  139. end # YEA
  140.  
  141. #==============================================================================
  142. # ▼ Editting anything past this point may potentially result in causing
  143. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  144. # halitosis so edit at your own risk.
  145. #==============================================================================
  146.  
  147. module YEA
  148.   module REGEXP
  149.   module USABLEITEM
  150.  
  151.     ADD_FIELD_STATE =
  152.       /<(?:ADD_FIELD_STATE|add field state):[ ](\d+(?:\s*,\s*\d+)*)>/i
  153.     REMOVE_FIELD_STATE =
  154.       /<(?:REMOVE_FIELD_STATE|remove field state):[ ](\d+(?:\s*,\s*\d+)*)>/i
  155.     REMOVE_ALL_FIELD_STATES =
  156.       /<(?:REMOVE_ALL_FIELD_STATES|remove all field states)>/i
  157.     OVERWRITE_FIELD_STATE =
  158.     /<(?:OVERWRITE_FIELD_STATE|OVERWRITE field state):[ ](\d+(?:\s*,\s*\d+)*)>/i
  159.     CHANGE_FIELD_STATE_TURN =
  160.       /<(?:FIELD state)[ ](\d+)[ ](?:TURN|turns):[ ]([\+\-]\d+)>/i
  161.     CHANGE_ALL_FIELD_STATE_TURN =
  162.       /<(?:ALL_FIELD_STATE_TURNS|all field state turns):[ ]([\+\-]\d+)>/i
  163.  
  164.   end # USABLEITEM
  165.   module STATE
  166.  
  167.     FIELD_BATTLEBACK1 = /<(?:FIELD_BACK1|field back1|field back 1):[ ](.*)>/i
  168.     FIELD_BATTLEBACK2 = /<(?:FIELD_BACK2|field back2|field back 2):[ ](.*)>/i
  169.  
  170.   end # STATE
  171.   end # REGEXP
  172. end # YEA
  173.  
  174. #==============================================================================
  175. # ■ DataManager
  176. #==============================================================================
  177.  
  178. module DataManager
  179.  
  180.   #--------------------------------------------------------------------------
  181.   # alias method: load_database
  182.   #--------------------------------------------------------------------------
  183.   class <<self; alias load_database_fse load_database; end
  184.   def self.load_database
  185.     load_database_fse
  186.     load_notetags_fse
  187.   end
  188.  
  189.   #--------------------------------------------------------------------------
  190.   # new method: load_notetags_fse
  191.   #--------------------------------------------------------------------------
  192.   def self.load_notetags_fse
  193.     groups = [$data_skills, $data_items, $data_states]
  194.     for group in groups
  195.       for obj in group
  196.         next if obj.nil?
  197.         obj.load_notetags_fse
  198.       end
  199.     end
  200.   end
  201.  
  202. end # DataManager
  203.  
  204. #==============================================================================
  205. # ■ RPG::UsableItem
  206. #==============================================================================
  207.  
  208. class RPG::UsableItem < RPG::BaseItem
  209.  
  210.   #--------------------------------------------------------------------------
  211.   # public instance variables
  212.   #--------------------------------------------------------------------------
  213.   attr_accessor :add_field_state
  214.   attr_accessor :remove_field_state
  215.   attr_accessor :remove_all_field_states
  216.   attr_accessor :change_field_state_turns
  217.  
  218.   #--------------------------------------------------------------------------
  219.   # common cache: load_notetags_fse
  220.   #--------------------------------------------------------------------------
  221.   def load_notetags_fse
  222.     @add_field_state = []
  223.     @remove_field_state = []
  224.     @remove_all_field_states = false
  225.     @change_field_state_turns = {}
  226.     #---
  227.     self.note.split(/[\r\n]+/).each { |line|
  228.       case line
  229.       #---
  230.       when YEA::REGEXP::USABLEITEM::ADD_FIELD_STATE
  231.         $1.scan(/\d+/).each { |num|
  232.         @add_field_state.push(num.to_i) if num.to_i > 0 }
  233.       when YEA::REGEXP::USABLEITEM::REMOVE_FIELD_STATE
  234.         $1.scan(/\d+/).each { |num|
  235.         @remove_field_state.push(num.to_i) if num.to_i > 0 }
  236.       when YEA::REGEXP::USABLEITEM::REMOVE_ALL_FIELD_STATES
  237.         @remove_all_field_states = true
  238.       when YEA::REGEXP::USABLEITEM::OVERWRITE_FIELD_STATE
  239.         @remove_all_field_states = true
  240.         $1.scan(/\d+/).each { |num|
  241.         @add_field_state.push(num.to_i) if num.to_i > 0 }
  242.       when YEA::REGEXP::USABLEITEM::CHANGE_FIELD_STATE_TURN
  243.         @change_field_state_turns[$1.to_i] = $2.to_i
  244.       when YEA::REGEXP::USABLEITEM::CHANGE_ALL_FIELD_STATE_TURN
  245.         for i in 1...$data_states.size
  246.           @change_field_state_turns[i] = $1.to_i
  247.         end
  248.       end
  249.     } # self.note.split
  250.     #---
  251.   end
  252.  
  253. end # class RPG::UsableItem
  254.  
  255. #==============================================================================
  256. # ■ RPG::State
  257. #==============================================================================
  258.  
  259. class RPG::State < RPG::BaseItem
  260.  
  261.   #--------------------------------------------------------------------------
  262.   # public instance variables
  263.   #--------------------------------------------------------------------------
  264.   attr_accessor :field_battlebacks
  265.  
  266.   #--------------------------------------------------------------------------
  267.   # common cache: load_notetags_fse
  268.   #--------------------------------------------------------------------------
  269.   def load_notetags_fse
  270.     @field_battlebacks = ["", ""]
  271.     #---
  272.     self.note.split(/[\r\n]+/).each { |line|
  273.       case line
  274.       #---
  275.       when YEA::REGEXP::STATE::FIELD_BATTLEBACK1
  276.         @field_battlebacks[0] = $1.to_s
  277.       when YEA::REGEXP::STATE::FIELD_BATTLEBACK2
  278.         @field_battlebacks[1] = $1.to_s
  279.       end
  280.     } # self.note.split
  281.     #---
  282.   end
  283.  
  284. end # RPG::State
  285.  
  286. #==============================================================================
  287. # ■ BattleManager
  288. #==============================================================================
  289.  
  290. module BattleManager
  291.  
  292.   #--------------------------------------------------------------------------
  293.   # alias method: init_members
  294.   #--------------------------------------------------------------------------
  295.   class <<self; alias battlemanager_init_members_fse init_members; end
  296.   def self.init_members
  297.     battlemanager_init_members_fse
  298.     clear_field_states
  299.   end
  300.  
  301.   #--------------------------------------------------------------------------
  302.   # new method: field_states
  303.   #--------------------------------------------------------------------------
  304.   def self.field_states
  305.     return @field_states.collect {|id| $data_states[id] }
  306.   end
  307.  
  308.   #--------------------------------------------------------------------------
  309.   # new method: field_state_turns
  310.   #--------------------------------------------------------------------------
  311.   def self.field_state_turns(state_id)
  312.     return @field_state_turns[state_id]
  313.   end
  314.  
  315.   #--------------------------------------------------------------------------
  316.   # new method: field_state?
  317.   #--------------------------------------------------------------------------
  318.   def self.field_state?(state_id)
  319.     return @field_states.include?(state_id)
  320.   end
  321.  
  322.   #--------------------------------------------------------------------------
  323.   # new method: sort_field_states
  324.   #--------------------------------------------------------------------------
  325.   def self.sort_field_states
  326.     @field_states = @field_states.sort_by { |id|
  327.       [-$data_states[id].priority, id] }
  328.     set_field_battlebacks
  329.     set_field_state_icons
  330.   end
  331.  
  332.   #--------------------------------------------------------------------------
  333.   # new method: clear_field_states
  334.   #--------------------------------------------------------------------------
  335.   def self.clear_field_states
  336.     @field_states = []
  337.     @field_state_turns = {}
  338.     @field_state_battleback = ["", ""]
  339.     @field_state_icons = []
  340.   end
  341.  
  342.   #--------------------------------------------------------------------------
  343.   # new method: add_field_state
  344.   #--------------------------------------------------------------------------
  345.   def self.add_field_state(state_id)
  346.     return if $data_states[state_id].nil?
  347.     return if @field_states.include?(state_id)
  348.     @field_states.push(state_id)
  349.     state = $data_states[state_id]
  350.     variance = 1 + [state.max_turns - state.min_turns, 0].max
  351.     @field_state_turns[state_id] = state.min_turns + rand(variance)
  352.     sort_field_states
  353.   end
  354.  
  355.   #--------------------------------------------------------------------------
  356.   # new method: remove_field_state
  357.   #--------------------------------------------------------------------------
  358.   def self.remove_field_state(state_id)
  359.     return if $data_states[state_id].nil?
  360.     return unless @field_states.include?(state_id)
  361.     @field_states.delete(state_id)
  362.     @field_state_turns.delete(state_id)
  363.     sort_field_states
  364.   end
  365.  
  366.   #--------------------------------------------------------------------------
  367.   # new method: change_field_state_turns
  368.   #--------------------------------------------------------------------------
  369.   def self.change_field_state_turns(state_id, value)
  370.     return unless field_state?(state_id)
  371.     state_id = state_id.id if state_id.is_a?(RPG::State)
  372.     return if $data_states[state_id].auto_removal_timing <= 0
  373.     @field_state_turns[state_id] = 0 if @field_state_turns[state_id].nil?
  374.     @field_state_turns[state_id] = [value, 0].max
  375.     remove_field_state(state_id) if @field_state_turns[state_id] <= 0
  376.   end
  377.  
  378.   #--------------------------------------------------------------------------
  379.   # alias method: turn_end
  380.   #--------------------------------------------------------------------------
  381.   class <<self; alias battlemanager_turn_end_fse turn_end; end
  382.   def self.turn_end
  383.     battlemanager_turn_end_fse
  384.     update_field_states
  385.     remove_field_states_auto
  386.   end
  387.  
  388.   #--------------------------------------------------------------------------
  389.   # new method: update_field_states
  390.   #--------------------------------------------------------------------------
  391.   def self.update_field_states
  392.     for state_id in @field_states
  393.       next unless @field_state_turns[state_id] > 0
  394.       @field_state_turns[state_id] -= 1
  395.     end
  396.   end
  397.  
  398.   #--------------------------------------------------------------------------
  399.   # new method: remove_field_states_auto
  400.   #--------------------------------------------------------------------------
  401.   def self.remove_field_states_auto
  402.     for state_id in @field_states
  403.       next if $data_states[state_id].auto_removal_timing <= 0
  404.       remove_field_state(state_id) if @field_state_turns[state_id] <= 0
  405.     end
  406.   end
  407.  
  408.   #--------------------------------------------------------------------------
  409.   # new method: field_battlebacks
  410.   #--------------------------------------------------------------------------
  411.   def self.field_battlebacks
  412.     return @field_state_battleback
  413.   end
  414.  
  415.   #--------------------------------------------------------------------------
  416.   # new method: set_field_battlebacks
  417.   #--------------------------------------------------------------------------
  418.   def self.set_field_battlebacks
  419.     @field_state_battleback = ["", ""]
  420.     for state in field_states
  421.       next if state.field_battlebacks == ["", ""]
  422.       @field_state_battleback = state.field_battlebacks
  423.       return
  424.     end
  425.   end
  426.  
  427.   #--------------------------------------------------------------------------
  428.   # new method: field_state_icons
  429.   #--------------------------------------------------------------------------
  430.   def self.field_state_icons
  431.     return @field_state_icons
  432.   end
  433.  
  434.   #--------------------------------------------------------------------------
  435.   # new method: set_field_state_icons
  436.   #--------------------------------------------------------------------------
  437.   def self.set_field_state_icons
  438.     icons = field_states.collect {|state| state.icon_index }
  439.     icons.delete(0)
  440.     @field_state_icons = icons
  441.   end
  442.  
  443. end # BattleManager
  444.  
  445. #==============================================================================
  446. # ■ Game_BattlerBase
  447. #==============================================================================
  448.  
  449. class Game_BattlerBase
  450.  
  451.   #--------------------------------------------------------------------------
  452.   # public instance variables
  453.   #--------------------------------------------------------------------------
  454.   attr_accessor :anti_field_states
  455.  
  456.   #--------------------------------------------------------------------------
  457.   # alias method: states
  458.   #--------------------------------------------------------------------------
  459.   alias game_battlerbase_states_fse states
  460.   def states
  461.     result = game_battlerbase_states_fse
  462.     result |= field_states unless @anti_field_states
  463.     return result
  464.   end
  465.  
  466.   #--------------------------------------------------------------------------
  467.   # new method: field_states
  468.   #--------------------------------------------------------------------------
  469.   def field_states
  470.     return [] unless SceneManager.scene_is?(Scene_Battle)
  471.     return BattleManager.field_states
  472.   end
  473.  
  474.   #--------------------------------------------------------------------------
  475.   # alias method: state?
  476.   #--------------------------------------------------------------------------
  477.   alias game_battlerbase_state_fse state?
  478.   def state?(state_id)
  479.     return true if field_states.include?($data_states[state_id])
  480.     return game_battlerbase_state_fse(state_id)
  481.   end
  482.  
  483. end # Game_BattlerBase
  484.  
  485. #==============================================================================
  486. # ■ Game_Battler
  487. #==============================================================================
  488.  
  489. class Game_Battler < Game_BattlerBase
  490.  
  491.   #--------------------------------------------------------------------------
  492.   # alias method: item_apply
  493.   #--------------------------------------------------------------------------
  494.   alias game_battler_item_apply_fse item_apply
  495.   def item_apply(user, item)
  496.     game_battler_item_apply_fse(user, item)
  497.     apply_field_state_effect(item)
  498.   end
  499.  
  500.   #--------------------------------------------------------------------------
  501.   # new method: apply_field_state_effect
  502.   #--------------------------------------------------------------------------
  503.   def apply_field_state_effect(item)
  504.     return if item.nil?
  505.     return unless $game_party.in_battle
  506.     return unless SceneManager.scene_is?(Scene_Battle)
  507.     return @result.success = true if item.add_field_state != []
  508.     return @result.success = true if item.remove_field_state != []
  509.     return @result.success = true if item.remove_all_field_states
  510.     for key in item.change_field_state_turns
  511.       return @result.success = true if BattleManager.field_state?(key[0])
  512.     end
  513.   end
  514.  
  515.   #--------------------------------------------------------------------------
  516.   # alias method: on_restrict
  517.   #--------------------------------------------------------------------------
  518.   alias game_battler_on_restrict_fse on_restrict
  519.   def on_restrict
  520.     @anti_field_states = true
  521.     game_battler_on_restrict_fse
  522.     @anti_field_states = nil
  523.   end
  524.  
  525.   #--------------------------------------------------------------------------
  526.   # alias method: update_state_turns
  527.   #--------------------------------------------------------------------------
  528.   alias game_battler_update_state_turns_fse update_state_turns
  529.   def update_state_turns
  530.     @anti_field_states = true
  531.     game_battler_update_state_turns_fse
  532.     @anti_field_states = nil
  533.   end
  534.  
  535.   #--------------------------------------------------------------------------
  536.   # alias method: remove_battle_states
  537.   #--------------------------------------------------------------------------
  538.   alias game_battler_remove_battle_states_fse remove_battle_states
  539.   def remove_battle_states
  540.     @anti_field_states = true
  541.     game_battler_remove_battle_states_fse
  542.     @anti_field_states = nil
  543.   end
  544.  
  545.   #--------------------------------------------------------------------------
  546.   # alias method: remove_states_auto
  547.   #--------------------------------------------------------------------------
  548.   alias game_battler_remove_states_auto_fse remove_states_auto
  549.   def remove_states_auto(timing)
  550.     @anti_field_states = true
  551.     game_battler_remove_states_auto_fse(timing)
  552.     @anti_field_states = nil
  553.   end
  554.  
  555.   #--------------------------------------------------------------------------
  556.   # alias method: remove_states_by_damage
  557.   #--------------------------------------------------------------------------
  558.   alias game_battler_remove_states_by_damage_fse remove_states_by_damage
  559.   def remove_states_by_damage
  560.     @anti_field_states = true
  561.     game_battler_remove_states_by_damage_fse
  562.     @anti_field_states = nil
  563.   end
  564.  
  565. end # Game_Battler
  566.  
  567. #==============================================================================
  568. # ■ Spriteset_Battle
  569. #==============================================================================
  570.  
  571. class Spriteset_Battle
  572.  
  573.   #--------------------------------------------------------------------------
  574.   # alias method: create_viewports
  575.   #--------------------------------------------------------------------------
  576.   alias spriteset_battle_create_viewports_fse create_viewports
  577.   def create_viewports
  578.     spriteset_battle_create_viewports_fse
  579.     create_field_state_effect
  580.   end
  581.  
  582.   #--------------------------------------------------------------------------
  583.   # new method: create_field_state_effect
  584.   #--------------------------------------------------------------------------
  585.   def create_field_state_effect
  586.     @field_state_battleback = ["", ""]
  587.     @field_state_effect_sprite1 = Sprite.new(@viewport1)
  588.     @field_state_effect_sprite1.bitmap = Bitmap.new(640, 480)
  589.     @field_state_effect_sprite1.opacity = 0
  590.     @field_state_effect_sprite1.z = 3
  591.     @field_state_effect_sprite2 = Sprite.new(@viewport1)
  592.     @field_state_effect_sprite2.bitmap = Bitmap.new(640, 480)
  593.     @field_state_effect_sprite2.opacity = 0
  594.     @field_state_effect_sprite2.z = 4
  595.   end
  596.  
  597.   #--------------------------------------------------------------------------
  598.   # alias method: dispose
  599.   #--------------------------------------------------------------------------
  600.   alias spriteset_battle_dispose_fse dispose
  601.   def dispose
  602.     dispose_field_state_effect
  603.     spriteset_battle_dispose_fse
  604.   end
  605.  
  606.   #--------------------------------------------------------------------------
  607.   # new method: dispose_field_state_effect
  608.   #--------------------------------------------------------------------------
  609.   def dispose_field_state_effect
  610.     @field_state_effect_sprite1.bitmap.dispose
  611.     @field_state_effect_sprite1.dispose
  612.     @field_state_effect_sprite2.bitmap.dispose
  613.     @field_state_effect_sprite2.dispose
  614.   end
  615.  
  616.   #--------------------------------------------------------------------------
  617.   # alias method: update
  618.   #--------------------------------------------------------------------------
  619.   alias spriteset_battle_update_fse update
  620.   def update
  621.     update_field_state_effect
  622.     spriteset_battle_update_fse
  623.   end
  624.  
  625.   #--------------------------------------------------------------------------
  626.   # new method: update_field_state_effect
  627.   #--------------------------------------------------------------------------
  628.   def update_field_state_effect
  629.     update_field_battleback_images
  630.     update_field_battleback_opacity
  631.     #---
  632.     @field_state_effect_sprite1.update
  633.     @field_state_effect_sprite2.update
  634.   end
  635.  
  636.   #--------------------------------------------------------------------------
  637.   # new method: update_field_battleback_images
  638.   #--------------------------------------------------------------------------
  639.   def update_field_battleback_images
  640.     return if @field_state_battleback == BattleManager.field_battlebacks
  641.     @field_state_battleback = BattleManager.field_battlebacks.clone
  642.     change_field_battleback_images
  643.   end
  644.  
  645.   #--------------------------------------------------------------------------
  646.   # new method: change_field_battleback_images
  647.   #--------------------------------------------------------------------------
  648.   def change_field_battleback_images
  649.     #---
  650.     @field_state_effect_sprite1.bitmap.dispose
  651.     @field_state_effect_sprite1.bitmap =  @back1_sprite.bitmap.clone
  652.     @field_state_effect_sprite1.opacity = 255
  653.     @field_state_effect_sprite1.wave_amp = 0
  654.     center_sprite(@field_state_effect_sprite1)
  655.     #---
  656.     @field_state_effect_sprite2.bitmap.dispose
  657.     @field_state_effect_sprite2.bitmap = @back2_sprite.bitmap.clone
  658.     @field_state_effect_sprite2.opacity = 255
  659.     @field_state_effect_sprite2.wave_amp = 0
  660.     center_sprite(@field_state_effect_sprite2)
  661.     #---
  662.     if YEA::FIELD_STATES::WAVE_EFFECT
  663.       @field_state_effect_sprite1.wave_amp = 16
  664.       @field_state_effect_sprite2.wave_amp = 16
  665.     end
  666.     #---
  667.     @back1_sprite.bitmap.dispose
  668.     @back2_sprite.bitmap.dispose
  669.     if BattleManager.field_battlebacks == ["", ""]
  670.       bb1 = battleback1_bitmap
  671.       bb2 = battleback2_bitmap
  672.     else
  673.       bb1 = Cache.battleback1(BattleManager.field_battlebacks[0])
  674.       bb2 = Cache.battleback2(BattleManager.field_battlebacks[1])
  675.     end
  676.     @back1_sprite.bitmap = bb1
  677.     @back2_sprite.bitmap = bb2
  678.     center_sprite(@back1_sprite)
  679.     center_sprite(@back2_sprite)
  680.   end
  681.  
  682.   #--------------------------------------------------------------------------
  683.   # new method: update_field_battleback_opacity
  684.   #--------------------------------------------------------------------------
  685.   def update_field_battleback_opacity
  686.     return if @field_state_effect_sprite1.opacity <= 0
  687.     @field_state_effect_sprite1.opacity -= 1
  688.     @field_state_effect_sprite2.opacity -= 1
  689.   end
  690.  
  691. end # Spriteset_Battle
  692.  
  693. #==============================================================================
  694. # ■ Scene_Battle
  695. #==============================================================================
  696.  
  697. class Scene_Battle < Scene_Base
  698.  
  699.   #--------------------------------------------------------------------------
  700.   # alias method: use_item
  701.   #--------------------------------------------------------------------------
  702.   alias scene_battle_use_item_fse use_item
  703.   def use_item
  704.     item = @subject.current_action.item
  705.     scene_battle_use_item_fse
  706.     apply_field_state_effects(item)
  707.   end
  708.  
  709.   #--------------------------------------------------------------------------
  710.   # new method: apply_field_state_effects
  711.   #--------------------------------------------------------------------------
  712.   def apply_field_state_effects(item)
  713.     return if item.nil?
  714.     remove_all_field_state_effects(item)
  715.     remove_field_state_effects(item)
  716.     add_field_state_effects(item)
  717.     change_field_state_turns(item)
  718.     refresh_all_battlers
  719.   end
  720.  
  721.   #--------------------------------------------------------------------------
  722.   # new method: remove_all_field_state_effects
  723.   #--------------------------------------------------------------------------
  724.   def remove_all_field_state_effects(item)
  725.     return unless item.remove_all_field_states
  726.     BattleManager.clear_field_states
  727.   end
  728.  
  729.   #--------------------------------------------------------------------------
  730.   # new method: remove_field_state_effects
  731.   #--------------------------------------------------------------------------
  732.   def remove_field_state_effects(item)
  733.     return if BattleManager.field_states == []
  734.     return if item.remove_field_state == []
  735.     for state_id in item.remove_field_state
  736.       BattleManager.remove_field_state(state_id)
  737.     end
  738.   end
  739.  
  740.   #--------------------------------------------------------------------------
  741.   # new method: add_field_state_effects
  742.   #--------------------------------------------------------------------------
  743.   def add_field_state_effects(item)
  744.     return if item.add_field_state == []
  745.     for state_id in item.add_field_state
  746.       BattleManager.add_field_state(state_id)
  747.     end
  748.   end
  749.  
  750.   #--------------------------------------------------------------------------
  751.   # new method: change_field_state_turns
  752.   #--------------------------------------------------------------------------
  753.   def change_field_state_turns(item)
  754.     return if item.change_field_state_turns == {}
  755.     for key in item.change_field_state_turns
  756.       state_id = key[0]
  757.       next unless BattleManager.field_state?(state_id)
  758.       next unless $data_states[state_id].auto_removal_timing > 0
  759.       turns = BattleManager.field_state_turns(state_id)
  760.       BattleManager.change_field_state_turns(state_id, turns + key[1])
  761.     end
  762.   end
  763.  
  764.   #--------------------------------------------------------------------------
  765.   # new method: change_field_state_turns
  766.   #--------------------------------------------------------------------------
  767.   def refresh_all_battlers
  768.     all_battle_members.each { |battler| battler.refresh }
  769.     @status_window.refresh
  770.   end
  771.  
  772. end # Scene_Battle
  773.  
  774. #==============================================================================
  775. #
  776. # ▼ End of File
  777. #
  778. #==============================================================================


结尾脚本
RUBY 代码复制
  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. #==============================================================================
  17. # □ カスタマイズ  ~START~
  18. #==============================================================================
  19. module Ending
  20.   # エンディング後はタイトルに戻す(false:強制終了)
  21.   BACKTO_TITLE = true
  22.  
  23.   # クリアデータセーブを行う?
  24.   CLRED_SAVE = false
  25.   # クリアデータ上でONにするスイッチ
  26.   CLRED_SWITCH = 10
  27.  
  28.   # ボタン押下時にエンディングスキップ
  29.   ON_SKIP = true
  30.  
  31.   # 画像表示位置
  32.   #   0 : 画像いっぱい
  33.   #   1 : 特定位置へ表示
  34.   #   2 : 特定矩形へ表示
  35.   G_TYPE = 1
  36.   # 画像表示位置 [x, y] <G_TYPE=1>
  37.   G_POS = [0, 0]
  38.   # 画像表示矩形 <G_TYPE=2>
  39.   G_RECT = Rect.new(10, 100, 200, 200)
  40.  
  41.   # シーン番号ごとの切り替え間隔(frame数)
  42.   SC_WAIT = 60 * 3
  43.  
  44.   # シーン切り替え演出
  45.   #  0 : 演出なし
  46.   #  1 : トランジション(フェード)を挟む
  47.   SC_EFFECT = 1
  48.  
  49.   # ~FIN~表示位置 [x, y]
  50.   FIN_POS = [Graphics.width - 600, Graphics.height - 420]
  51.   # ~FIN~時のウェイト(nil:ボタンが押されるまでウェイト)
  52.   FIN_WAIT = 60 * 5
  53. end
  54.  
  55. #==============================================================================
  56. # ■ シーン制御設定
  57. #==============================================================================
  58. class Scene_Ending < Scene_Base
  59.   include Ending
  60.   #--------------------------------------------------------------------------
  61.   # ● エンドミュージック
  62.   #      n  : シーン番号
  63.   #--------------------------------------------------------------------------
  64.   def end_music(n=0)
  65.     case n
  66.     when 0  # 最初のBGM
  67.       return RPG::BGM.new("Theme3")
  68.     when -1 # Fin時のBGM
  69.       return RPG::BGM.new("Scene5", 80, 80)
  70.     end
  71.     return nil
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ● エンド背景
  75.   #      n      : シーン番号  (-1:Fin画像)
  76.   #--------------------------------------------------------------------------
  77.   def end_graphic(n=0)
  78.     case n
  79.     when 0  # 最初の画像
  80.       return Cache.picture("Mountains5")
  81.     when -1 # Fin画像
  82.       return Cache.picture("Fin")
  83.     when -2 # Fin画像2
  84.       return Cache.picture("StarlitSky")
  85. #~     when 3  # (例) 途中で画像をチェンジ
  86. #~        return Cache.picture("Ocean1")
  87.     end
  88.     return nil
  89.   end
  90.   #--------------------------------------------------------------------------
  91.   # ★ エンディングロール処理
  92.   #      n      : シーン番号
  93.   #--------------------------------------------------------------------------
  94.   TEXTS = [
  95.   # ["役割", "名前", "付属情報", …]
  96.     ["作者",           "光明魔法灵"],
  97.     ["特别合伙人",       "风"],
  98.     ["开场音楽",               "GILIGI EYE",],
  99.     ["游戏中音乐",         "默认的VA音乐"],
  100.     ["出场人物",         "\\n[11]", "\\n[12]", "\\n[13]", "\\n[14]", "\\n[15]", "\\n[16]", "\\n[17]", "\\n[18]", "\\n[19]", "\\n[20]", "\\n[21]"],
  101.     ["特别穿插", "火影人物类", "火影忍术创作", "火影人物穿插", "火影奥义"]
  102.   ]
  103.   def update_ending(n)
  104.     play_music(n)                   # BGM演奏
  105.     redraw_end_graphic(n)           # 画像描画
  106.     draw_text(10, 10, TEXTS[n])   # テキスト描画
  107.   end
  108.   #--------------------------------------------------------------------------
  109.   # ● Fin表示
  110.   #--------------------------------------------------------------------------
  111.   def finish
  112.     play_music(-1)
  113.     clear_graphic
  114. #~     draw_graphic(end_graphic_rect(-2, 0), -2) # 背景
  115.     draw_graphic(end_graphic_rect(-1, 1, FIN_POS[0], FIN_POS[1]), -1)
  116.   end
  117. end
  118.  
  119. #==============================================================================
  120. # □ カスタマイズ  ~END~
  121. #==============================================================================
  122.  
  123.  
  124. #==============================================================================
  125. # ■ 汎用メソッド  ★部分で使用する
  126. #==============================================================================
  127. class Scene_Ending < Scene_Base
  128.   #--------------------------------------------------------------------------
  129.   # ● ミュージック演奏
  130.   #      n      : シーン番号
  131.   #--------------------------------------------------------------------------
  132.   def play_music(n=0)
  133.     music = end_music(n)
  134.     return if music.nil?
  135.     music.play
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # ● エンド背景の描画先矩形
  139.   #      n      : シーン番号
  140.   #--------------------------------------------------------------------------
  141.   def end_graphic_rect(n=0, type=G_TYPE, x=G_POS[0], y=G_POS[1])
  142.     case type
  143.     when 0  # 画面いっぱいに描画
  144.       return @viewport.rect
  145.     when 1  # アスペクト比を維持して特定位置に描画
  146.       return Rect.new(x, y, end_graphic(n).width, end_graphic(n).height)
  147.     when 2  # 特定矩形に収まるように描画
  148.       return G_RECT
  149.     end
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● 画像描画
  153.   #      rect   : 描画先矩形
  154.   #      n      : シーン番号
  155.   #--------------------------------------------------------------------------
  156.   def draw_graphic(rect, n=0)
  157.     graphic = end_graphic(n)
  158.     src_rect = Rect.new
  159.     src_rect.width  = graphic.width
  160.     src_rect.height = graphic.height
  161.     @sprite.bitmap.stretch_blt(rect, graphic, src_rect)
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● 画像領域消去
  165.   #      rect   : 消去矩形
  166.   #--------------------------------------------------------------------------
  167.   def clear_graphic(rect=@viewport.rect)
  168.     @sprite.bitmap.clear_rect(rect)
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # ● シーン番号別  画像描画
  172.   #--------------------------------------------------------------------------
  173.   def draw_end_graphic(n=0, type=G_TYPE)
  174.     draw_graphic(end_graphic_rect(n, type), n)
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # ● シーン番号別  画像再描画
  178.   #--------------------------------------------------------------------------
  179.   def redraw_end_graphic(n=0, type=G_TYPE)
  180.     return if end_graphic(n).nil?
  181.     clear_graphic
  182.     draw_end_graphic(n, type)
  183.   end
  184.   #--------------------------------------------------------------------------
  185.   # ● テキスト描画
  186.   #--------------------------------------------------------------------------
  187.   def draw_text(x, y, texts)
  188.     texts.size.times do |i|
  189.       xx = (i == 0) ? x : (x+30)
  190.       @window.draw_text_ex(xx, y, texts[i])
  191.       y += @window.line_height
  192.     end
  193.   end
  194.   #--------------------------------------------------------------------------
  195.   # ● テキスト消去
  196.   #--------------------------------------------------------------------------
  197.   def clear_text
  198.     @window.contents.clear
  199.   end
  200. end
  201.  
  202.  
  203. #==============================================================================
  204. # ■ シーンクラス
  205. #==============================================================================
  206. class Scene_Ending < Scene_Base
  207.   #--------------------------------------------------------------------------
  208.   # ● オブジェクト初期化
  209.   #--------------------------------------------------------------------------
  210.   def initialize
  211.     super
  212.     @no = 0
  213.     @called_save = false
  214.   end
  215.   #--------------------------------------------------------------------------
  216.   # ● 開始処理
  217.   #--------------------------------------------------------------------------
  218.   def start
  219.     super
  220.     create_viewport
  221.     create_sprite
  222.     create_window
  223.     return goto_next_scene if @no >= TEXTS.size
  224.     update_ending(@no)
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # ● 画面Viewport生成
  228.   #--------------------------------------------------------------------------
  229.   def create_viewport
  230.     @viewport = Viewport.new
  231.   end
  232.   #--------------------------------------------------------------------------
  233.   # ● 画像表示用スプライト生成
  234.   #--------------------------------------------------------------------------
  235.   def create_sprite
  236.     @sprite = Sprite_Base.new(@viewport)
  237.     @sprite.bitmap = Bitmap.new(@viewport.rect.width, @viewport.rect.height)
  238.   end
  239.   #--------------------------------------------------------------------------
  240.   # ● 文字描画用ウィンドウ生成
  241.   #--------------------------------------------------------------------------
  242.   def create_window
  243.     r = @viewport.rect
  244.     @window = Window_Base.new(r.x, r.y, r.width, r.width)
  245.     @window.opacity = 0
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # ● 終了処理
  249.   #--------------------------------------------------------------------------
  250.   def terminate
  251.     dispose_sprite
  252.     dispose_viewport
  253.     super
  254.   end
  255.   #--------------------------------------------------------------------------
  256.   # ● 画面Viewport解放
  257.   #--------------------------------------------------------------------------
  258.   def dispose_viewport
  259.     @viewport.dispose
  260.   end
  261.   #--------------------------------------------------------------------------
  262.   # ● 画像表示用スプライト解放
  263.   #--------------------------------------------------------------------------
  264.   def dispose_sprite
  265.     @sprite.dispose
  266.   end
  267.   #--------------------------------------------------------------------------
  268.   # ● 次のシーンへ
  269.   #--------------------------------------------------------------------------
  270.   def goto_next_scene
  271.     if CLRED_SAVE and !@called_save
  272.       call_save
  273.     elsif BACKTO_TITLE
  274.       SceneManager.goto(Scene_Title)
  275.     else
  276.       fadeout_all
  277.       SceneManager.exit
  278.     end
  279.   end
  280.   #--------------------------------------------------------------------------
  281.   # ● クリアデータをセーブ
  282.   #--------------------------------------------------------------------------
  283.   def call_save
  284.     $game_switches[CLRED_SWITCH] = true
  285.     @called_save = true
  286.     SceneManager.call(Scene_Save)
  287.   end
  288.   #--------------------------------------------------------------------------
  289.   # ● フレーム更新
  290.   #--------------------------------------------------------------------------
  291.   def update
  292.     super
  293.     update_ending_scene
  294.   end
  295.   #--------------------------------------------------------------------------
  296.   # ● フレーム更新 <シーン切り替え制御>
  297.   #--------------------------------------------------------------------------
  298.   def update_ending_scene
  299.     return goto_next_scene if @no >= TEXTS.size
  300.     update_ending(@no)
  301.     perform_transition if SC_EFFECT == 1
  302.     wait
  303.     Graphics.freeze    if SC_EFFECT == 1
  304.     clear_text
  305.     @no += 1
  306.     if @no >= TEXTS.size
  307.       RPG::BGM.fade(transition_speed * 2) if
  308.       finish
  309.       Graphics.transition(transition_speed * 2) if SC_EFFECT == 1
  310.       finish_wait
  311.     end
  312.   end
  313.   #--------------------------------------------------------------------------
  314.   # ● トランジション速度の取得
  315.   #--------------------------------------------------------------------------
  316.   def transition_speed
  317.     return 30
  318.   end
  319.   #--------------------------------------------------------------------------
  320.   # ● トランジション速度の取得
  321.   #--------------------------------------------------------------------------
  322.   def skip_trigger?
  323.     Input.trigger?(:C) or Input.trigger?(:B)
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # ● フレーム更新
  327.   #--------------------------------------------------------------------------
  328.   def update_skipwait(skip=true)
  329.     update_basic
  330.     skip and skip_trigger?
  331.   end
  332.   #--------------------------------------------------------------------------
  333.   # ● ウェイト
  334.   #--------------------------------------------------------------------------
  335.   def wait(duration=SC_WAIT)
  336.     duration.times { |i| break if update_skipwait(ON_SKIP) }
  337.   end
  338.   #--------------------------------------------------------------------------
  339.   # ● Finishウェイト
  340.   #--------------------------------------------------------------------------
  341.   def finish_wait
  342.     if FIN_WAIT.nil?
  343.       loop do update_skipwait end
  344.     else
  345.       wait(FIN_WAIT)
  346.     end
  347.   end
  348. end


比较好的天气系统
RUBY 代码复制
  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.  
  94. # Take these out if you are using screen resolution script of Ccoa.
  95.   HEIGHT = 416
  96.   WIDTH = 544
  97.  
  98. #==============================================================================
  99. # ** Spriteset_Weather
  100. #------------------------------------------------------------------------------
  101.  
  102. class Spriteset_Weather
  103.   #--------------------------------------------------------------------------
  104.   # * Public Instance Variables
  105.   #--------------------------------------------------------------------------
  106.   attr_reader :type
  107.   attr_reader :power
  108.   attr_reader :ox
  109.   attr_reader :oy
  110.   #--------------------------------------------------------------------------
  111.   # * Object Initialization
  112.   #--------------------------------------------------------------------------
  113.   def initialize(viewport = nil)
  114.     @type = 0
  115.     @power = 0
  116.     @ox = 0
  117.     @oy = 0
  118.  
  119.     @count = 0
  120.     @current_pose = []
  121.     @info = []
  122.     @countarray = []
  123.  
  124.     make_bitmaps
  125.  
  126.     @sprites = []
  127.  
  128.     for i in 1..500
  129.       sprite = Sprite.new(viewport)
  130.       sprite.visible = false
  131.       sprite.opacity = 0
  132.       @sprites.push(sprite)
  133.       @current_pose.push(0)
  134.       @info.push(rand(50))
  135.       @countarray.push(rand(15))
  136.     end
  137.  
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # * Dispose
  141.   #--------------------------------------------------------------------------
  142.   def dispose
  143.     for sprite in @sprites
  144.       sprite.dispose
  145.     end
  146.     @rain_bitmap.dispose
  147.     @storm_bitmap.dispose
  148.     @snow_bitmap.dispose
  149.     @hail_bitmap.dispose
  150.     @petal_bitmap.dispose
  151.     @blood_rain_bitmap.dispose
  152.     @oil_rain_bitmap.dispose
  153.     @golden_rain_bitmap.dispose
  154.     @golden_storm_bitmap.dispose
  155.     @acid_rain_bitmap.dispose
  156.     @acid_storm_bitmap.dispose
  157.     @sepia_rain_bitmap.dispose
  158.     @sepia_storm_bitmap.dispose
  159.     @blood_storm_bitmap.dispose
  160.     @bloodblizz_bitmap.dispose
  161.     @meteor_bitmap.dispose
  162.     @flame_meteor_bitmap.dispose
  163.     @waterbomb_bitmap.dispose
  164.     @icybomb_bitmap.dispose
  165.     @flarebomb_bitmap.dispose
  166.     for image in @autumn_leaf_bitmaps
  167.       image.dispose
  168.     end
  169.     for image in @green_leaf_bitmaps
  170.       image.dispose
  171.     end
  172.     for image in @yellow_leaf_bitmaps
  173.       image.dispose
  174.     end
  175.     for image in @redmaple_leaf_bitmaps
  176.       image.dispose
  177.     end
  178.     for image in @rose_bitmaps
  179.       image.dispose
  180.     end
  181.     for image in @feather_bitmaps
  182.       image.dispose
  183.     end
  184.     for image in @sparkle_bitmaps
  185.       image.dispose
  186.     end
  187.     for image in @starburst_bitmaps
  188.       image.dispose
  189.     end
  190.     for image in @monostarburst_bitmaps
  191.       image.dispose
  192.     end
  193.     for image in @user_bitmaps
  194.       image.dispose
  195.     end
  196.     $WEATHER_UPDATE = true
  197.   end
  198.   #--------------------------------------------------------------------------
  199.   # * Set weather type
  200.   #     type : new weather type
  201.   #--------------------------------------------------------------------------
  202.   def type=(type)
  203.     return if @type == type
  204.     @type = type
  205.     case @type
  206.     when 1 # rain
  207.       bitmap = @rain_bitmap
  208.     when 2 # storm
  209.       bitmap = @storm_bitmap
  210.     when 3 # snow
  211.       bitmap = @snow_bitmap
  212.    when 4 # hail
  213.       bitmap = @hail_bitmap
  214.     when 5 # rain w/ thunder and lightning
  215.       bitmap = @rain_bitmap
  216.       @thunder = true
  217.     when 6 # falling autumn leaves
  218.       bitmap = @autumn_leaf_bitmaps[0]
  219.     when 7 # blowing autumn leaves
  220.       bitmap = @autumn_leaf_bitmaps[0]
  221.     when 8 # swirling autumn leaves
  222.       bitmap = @autumn_leaf_bitmaps[0]
  223.     when 9 # falling green leaves
  224.       bitmap = @green_leaf_bitmaps[0]
  225.     when 10 # sakura petals
  226.       bitmap = @petal_bitmap
  227.     when 11 # rose petals
  228.       bitmap = @rose_bitmaps[0]
  229.     when 12 # feathers
  230.       bitmap = @feather_bitmaps[0]
  231.     when 13 # blood rain
  232.       bitmap = @blood_rain_bitmap
  233.     when 14 # sparkles
  234.       bitmap = @sparkle_bitmaps[0]
  235.     when 15 # user-defined
  236.         bitmap = @user_bitmaps[rand(@user_bitmaps.size)]
  237.     when 16 # blowing snow
  238.       bitmap = @snow_bitmap
  239.     when 17 # meteors
  240.       bitmap = @meteor_bitmap
  241.     when 18 # falling ash
  242.       bitmap = @ash_bitmaps[rand(@ash_bitmaps.size)]
  243.     when 19 # bubbles
  244.       bitmap = @bubble_bitmaps[rand(@bubble_bitmaps.size)]
  245.     when 21 # sparkles up
  246.       bitmap = @sparkle_bitmaps[0]
  247.     when 22 # blowing green leaves
  248.       bitmap = @green_leaf_bitmaps[0]
  249.     when 23 # swirling green leaves
  250.       bitmap = @green_leaf_bitmaps[0]
  251.     when 24 # falling yellow leaves
  252.       bitmap = @yellow_leaf_bitmaps[0]
  253.     when 25 # blowing yellow leaves
  254.       bitmap = @yellow_leaf_bitmaps[0]
  255.     when 26 # swirling yellow leaves
  256.       bitmap = @yellow_leaf_bitmaps[0]
  257.     when 27 # oil rain
  258.        bitmap = @oil_rain_bitmap
  259.     when 28 # golden rain
  260.        bitmap = @golden_rain_bitmap
  261.     when 29 # flame meteors
  262.        bitmap = @flame_meteor_bitmap
  263.     when 30 # starburst
  264.       bitmap = @starburst_bitmaps[0]
  265.     when 31 # uprising starburst
  266.       bitmap = @starburst_bitmaps[0]
  267.     when 32 # starburst rain
  268.       bitmap = @starburst_bitmaps[0]
  269.     when 33 # mono-starburst
  270.       bitmap = @monostarburst_bitmaps[0]
  271.     when 34 # uprising mono-starburst
  272.       bitmap = @monostarburst_bitmaps[0]
  273.     when 35 # mono-starburst rain
  274.       bitmap = @monostarburst_bitmaps[0]
  275.     when 36 # Golden rain w\ thunder and ligthning
  276.       bitmap = @golden_rain_bitmap
  277.       @golden_thunder = true
  278.     when 37 # Golden storm
  279.       bitmap = @golden_storm_bitmap
  280.     when 38 # Oil storm
  281.       bitmap = @oil_storm_bitmap
  282.     when 39 # # Acid rain
  283.       bitmap = @acid_rain_bitmap
  284.     when 40 # Acid rain w\thunder and lightning
  285.       bitmap = @acid_rain_bitmap
  286.       @acid_thunder = true
  287.     when 41 # Acid storm
  288.       bitmap = @acid_storm_bitmap
  289.     when 42 # Sepia rain
  290.       bitmap = @sepia_rain_bitmap
  291.     when 43 # Sepia rain w\ thunder and lightning
  292.       bitmap = @sepia_rain_bitmap
  293.       @sepia_thunder = true
  294.     when 44 # Sepia storm
  295.       bitmap = @sepia_storm_bitmap
  296.     when 45 # Realistic storm
  297.       bitmap = @storm_bitmap
  298.       @real_storm = true
  299.     when 46 # Blood rain w\ thunder and lightning
  300.       bitmap = @blood_rain_bitmap
  301.       @crimson_thunder = true
  302.     when 47 # Blood storm
  303.       bitmap = @blood_storm_bitmap
  304.     when 48 # Blood blizzard
  305.       bitmap = @bloodblizz_bitmap
  306.     when 49 # Falling red maple leaves
  307.       bitmap = @redmaple_leaf_bitmaps[0]
  308.     when 50 # Blowing red maple leaves
  309.       bitmap = @redmaple_leaf_bitmaps[0]
  310.     when 51 # Swirling red maple leaves
  311.       bitmap = @redmaple_leaf_bitmaps[0]
  312.     when 52
  313.       bitmap = @waterbomb_bitmaps
  314.     when 53
  315.       bitmap = @icybomb_bitmaps
  316.     when 54
  317.       bitmap = @flarebomb_bitmaps
  318.     else
  319.       bitmap = nil
  320.     end
  321.  
  322.     if @type != 5
  323.       @thunder = false
  324.     end
  325.  
  326.     if @type != 36
  327.       @golden_thunder = false
  328.     end
  329.  
  330.     if @type != 40
  331.       @acid_thunder = false
  332.     end
  333.  
  334.     if @type != 43
  335.       @sepia_thunder = false
  336.     end
  337.  
  338.     if @type != 45
  339.       @real_storm = false
  340.     end
  341.  
  342.     if @type != 46
  343.       @crimson_thunder = false
  344.     end
  345.  
  346.     for i in [email]0...@sprites.size[/email]
  347.       sprite = @sprites[i]
  348.       sprite.visible = (i <= @power)
  349.       if @type == 19
  350.         sprite.bitmap = @bubble_bitmaps[rand(@bubble_bitmaps.size)]
  351.       elsif @type == 20
  352.         sprite.bitmap = @bubble2_bitmaps[rand(@bubble2_bitmaps.size)]
  353.       elsif @type == 3
  354.         r = rand(@snow_bitmaps.size)
  355.         @info[i] = r
  356.         sprite.bitmap = @snow_bitmaps[r]
  357.       else
  358.         sprite.bitmap = bitmap
  359.       end
  360.     end
  361.   end
  362.   #--------------------------------------------------------------------------
  363.   # * Set starting point X coordinate
  364.   #     ox : starting point X coordinate
  365.   #--------------------------------------------------------------------------
  366.   def ox=(ox)
  367.     return if @ox == ox;
  368.     @ox = ox
  369.     for sprite in @sprites
  370.       sprite.ox = @ox
  371.     end
  372.   end
  373.   #--------------------------------------------------------------------------
  374.   # * Set starting point Y coordinate
  375.   #     oy : starting point Y coordinate
  376.   #--------------------------------------------------------------------------
  377.   def oy=(oy)
  378.     return if @oy == oy;
  379.     @oy = oy
  380.     for sprite in @sprites
  381.       sprite.oy = @oy
  382.     end
  383.   end
  384.   #--------------------------------------------------------------------------
  385.   # * Set maximum number of sprites
  386.   #     max : maximum number of sprites
  387.   #--------------------------------------------------------------------------
  388.   def power=(power)
  389.     @power = power
  390.     for i in 1..40
  391.       sprite = @sprites[i]
  392.       sprite.visible = (i <= @power) if sprite != nil
  393.       if @type == 19
  394.           sprite.bitmap = @bubble_bitmaps[rand(@bubble_bitmaps.size)]
  395.         elsif @type == 20
  396.           sprite.bitmap = @bubble2_bitmaps[rand(@bubble2_bitmaps.size)]
  397.         elsif @type == 3
  398.           r = rand(@snow_bitmaps.size)
  399.           @info[i] = r
  400.           sprite.bitmap = @snow_bitmaps[r]
  401.         end
  402.     end
  403.   end
  404. #--------------------------------------------------------------------------
  405. # * Frame Update
  406. #--------------------------------------------------------------------------
  407.   def update
  408.     return if @type == 0
  409.     for i in 1..@power
  410.       sprite = @sprites[i]
  411.       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
  412.         if sprite.opacity <= 150
  413.           if @current_pose[i] == 0
  414.             sprite.y += @rain_bitmap.height
  415.             sprite.x -= @rain_bitmap.width
  416.             if @type == 1 or @type == 5
  417.               sprite.bitmap = @rain_splash
  418.             else
  419.               sprite.bitmap = @blood_rain_splash
  420.             end
  421.             if @type == 27
  422.               sprite.bitmap = @oil_rain_splash
  423.             end
  424.             if @type == 28
  425.               sprite.bitmap = @golden_rain_splash
  426.             end
  427.             if @type == 36
  428.               sprite.bitmap = @golden_rain_splash
  429.             end
  430.             if @type == 39
  431.               sprite.bitmap = @acid_rain_splash
  432.             end
  433.             if @type == 40
  434.               sprite.bitmap = @acid_rain_splash
  435.             end
  436.             if @type == 42
  437.               sprite.bitmap = @sepia_rain_splash
  438.             end
  439.             if @type == 43
  440.               sprite.bitmap = @sepia_rain_splash
  441.             end
  442.             if @type == 46
  443.               sprite.bitmap = @blood_rain_splash
  444.             end
  445.             @current_pose[i] = 1
  446.           end
  447.         else
  448.           if @current_pose[i] == 1
  449.             if @type == 1 or @type == 5
  450.               sprite.bitmap = @rain_bitmap
  451.             else
  452.               sprite.bitmap = @blood_rain_bitmap
  453.             end
  454.             if @type == 27
  455.               sprite.bitmap = @oil_rain_bitmap
  456.             end
  457.             if @type == 28
  458.               sprite.bitmap = @golden_rain_bitmap
  459.             end
  460.             if @type == 36
  461.               sprite.bitmap = @golden_rain_bitmap
  462.             end
  463.             if @type == 39
  464.               sprite.bitmap = @acid_rain_bitmap
  465.             end
  466.             if @type == 40
  467.               sprite.bitmap = @acid_rain_bitmap
  468.             end
  469.             if @type == 42
  470.               sprite.bitmap = @sepia_rain_bitmap
  471.             end
  472.             if @type == 43
  473.               sprite.bitmap = @sepia_rain_bitmap
  474.             end
  475.             if @type == 46
  476.               sprite.bitmap = @blood_rain_bitmap
  477.             end
  478.             @current_pose[i] = 0
  479.           end
  480.           sprite.x -= 2
  481.           sprite.y += 16
  482.           if @thunder and (rand(8000 - @power) == 0)
  483.             $game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
  484.             Audio.se_play("Audio/SE/Thunder1")
  485.           end
  486.         if @golden_thunder and (rand(8000 - @power) == 0)
  487.             $game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
  488.             Audio.se_play("Audio/SE/Thunder1")
  489.           end
  490.        if @acid_thunder and (rand(5000 - @power) == 0)
  491.             $game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
  492.             Audio.se_play("Audio/SE/Thunder1")
  493.           end
  494.        if @sepia_thunder and (rand(8000 - @power) == 0)
  495.             $game_map.screen.start_flash(Color.new(169, 152, 142, 255), 5)
  496.             Audio.se_play("Audio/SE/Thunder1")
  497.           end
  498.        if @sepia_thunder and (rand(8000 - @power) == 0)
  499.             $game_map.screen.start_flash(Color.new(169, 152, 142, 255), 5)
  500.             Audio.se_play("Audio/SE/Thunder1")
  501.           end
  502.        if @crimson_thunder and (rand(8000 - @power) == 0)
  503.           $game_map.screen.start_flash(Color.new(141, 9, 9, 255), 5)
  504.           Audio.se_play("Audio/SE/Thunder1")
  505.           end
  506.         end
  507.         sprite.opacity -= 8
  508.       end
  509.       if @type == 2 or @type == 37 or @type == 38 or @type == 41 or @type == 44 or @type == 45 or @type == 47 # storm
  510.         sprite.x -= 8
  511.         sprite.y += 16
  512.         sprite.opacity -= 12
  513.       end
  514.         if @real_storm and (rand(5000 - @power) == 0)
  515.         $game_map.screen.start_flash(Color.new(255, 255, 255, 255), 5)
  516.         $game_map.screen.start_shake(9, 4, 5)
  517.         Audio.se_play("Audio/SE/Thunder9")
  518.       end
  519.       if @type == 3 # snow
  520.         case @info[i]
  521.         when 0 # smallest flake, fall the slowest
  522.           sprite.y += 1
  523.         when 1
  524.           sprite.y += 3
  525.         when 2
  526.           sprite.y += 5
  527.         when 3
  528.           sprite.y += 7
  529.         end
  530.         sprite.opacity -= 3
  531.       end
  532.       if @type == 4 # hail
  533.         sprite.x -= 1
  534.         sprite.y += 18
  535.         sprite.opacity -= 15
  536.       end
  537.       if @type == 6 # falling autumn leaves
  538.         @count = rand(20)
  539.         if @count == 0
  540.           sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]]
  541.           @current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size
  542.         end
  543.         sprite.x -= 1
  544.         sprite.y += 1
  545.       end
  546.       if @type == 7 # blowing autumn leaves
  547.         @count = rand(20)
  548.         if @count == 0
  549.           sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]]
  550.           @current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size
  551.         end
  552.         sprite.x -= 10
  553.         sprite.y += (rand(4) - 2)
  554.       end
  555.       if @type == 8 # swirling autumn leaves
  556.         @count = rand(20)
  557.         if @count == 0
  558.           sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]]
  559.           @current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size
  560.         end
  561.         if @info[i] != 0
  562.           if @info[i] >= 1 and @info[i] <= 10
  563.             sprite.x -= 3
  564.             sprite.y -= 1
  565.           elsif @info[i] >= 11 and @info[i] <= 16
  566.             sprite.x -= 1
  567.             sprite.y -= 2
  568.           elsif @info[i] >= 17 and @info[i] <= 20
  569.             sprite.y -= 3
  570.           elsif @info[i] >= 21 and @info[i] <= 30
  571.             sprite.y -= 2
  572.             sprite.x += 1
  573.           elsif @info[i] >= 31 and @info[i] <= 36
  574.             sprite.y -= 1
  575.             sprite.x += 3
  576.           elsif @info[i] >= 37 and @info[i] <= 40
  577.             sprite.x += 5
  578.           elsif @info[i] >= 41 and @info[i] <= 46
  579.             sprite.y += 1
  580.             sprite.x += 3
  581.           elsif @info[i] >= 47 and @info[i] <= 58
  582.             sprite.y += 2
  583.             sprite.x += 1
  584.           elsif @info[i] >= 59 and @info[i] <= 64
  585.             sprite.y += 3
  586.           elsif @info[i] >= 65 and @info[i] <= 70
  587.             sprite.x -= 1
  588.             sprite.y += 2
  589.           elsif @info[i] >= 71 and @info[i] <= 81
  590.             sprite.x -= 3
  591.             sprite.y += 1
  592.           elsif @info[i] >= 82 and @info[i] <= 87
  593.             sprite.x -= 5
  594.           end
  595.           @info[i] = (@info[i] + 1) % 88
  596.         else
  597.           if rand(200) == 0
  598.             @info[i] = 1
  599.           end
  600.           sprite.x -= 5
  601.           sprite.y += 1
  602.         end
  603.       end
  604.         if @type == 49 # falling red maple leaves
  605.         @count = rand(20)
  606.         if @count == 0
  607.           sprite.bitmap = @redmaple_leaf_bitmaps[@current_pose[i]]
  608.           @current_pose[i] = (@current_pose[i] + 1) % @redmaple_leaf_bitmaps.size
  609.         end
  610.         sprite.x -= 1
  611.         sprite.y += 1
  612.       end
  613.       if @type == 50 # blowing red maple leaves
  614.         @count = rand(20)
  615.         if @count == 0
  616.           sprite.bitmap = @redmaple_leaf_bitmaps[@current_pose[i]]
  617.           @current_pose[i] = (@current_pose[i] + 1) % @redmaple_leaf_bitmaps.size
  618.         end
  619.         sprite.x -= 10
  620.         sprite.y += (rand(4) - 2)
  621.       end
  622.       if @type == 51 # swirling red maple leaves
  623.         @count = rand(20)
  624.         if @count == 0
  625.           sprite.bitmap = @redmaple_leaf_bitmaps[@current_pose[i]]
  626.           @current_pose[i] = (@current_pose[i] + 1) % @redmaple_leaf_bitmaps.size
  627.         end
  628.         if @info[i] != 0
  629.           if @info[i] >= 1 and @info[i] <= 10
  630.             sprite.x -= 3
  631.             sprite.y -= 1
  632.           elsif @info[i] >= 11 and @info[i] <= 16
  633.             sprite.x -= 1
  634.             sprite.y -= 2
  635.           elsif @info[i] >= 17 and @info[i] <= 20
  636.             sprite.y -= 3
  637.           elsif @info[i] >= 21 and @info[i] <= 30
  638.             sprite.y -= 2
  639.             sprite.x += 1
  640.           elsif @info[i] >= 31 and @info[i] <= 36
  641.             sprite.y -= 1
  642.             sprite.x += 3
  643.           elsif @info[i] >= 37 and @info[i] <= 40
  644.             sprite.x += 5
  645.           elsif @info[i] >= 41 and @info[i] <= 46
  646.             sprite.y += 1
  647.             sprite.x += 3
  648.           elsif @info[i] >= 47 and @info[i] <= 58
  649.             sprite.y += 2
  650.             sprite.x += 1
  651.           elsif @info[i] >= 59 and @info[i] <= 64
  652.             sprite.y += 3
  653.           elsif @info[i] >= 65 and @info[i] <= 70
  654.             sprite.x -= 1
  655.             sprite.y += 2
  656.           elsif @info[i] >= 71 and @info[i] <= 81
  657.             sprite.x -= 3
  658.             sprite.y += 1
  659.           elsif @info[i] >= 82 and @info[i] <= 87
  660.             sprite.x -= 5
  661.           end
  662.           @info[i] = (@info[i] + 1) % 88
  663.         else
  664.           if rand(200) == 0
  665.             @info[i] = 1
  666.           end
  667.           sprite.x -= 5
  668.           sprite.y += 1
  669.         end
  670.       end
  671.       if @type == 9 # falling green leaves
  672.         if @countarray[i] == 0
  673.           @current_pose[i] = (@current_pose[i] + 1) % @green_leaf_bitmaps.size
  674.           sprite.bitmap = @green_leaf_bitmaps[@current_pose[i]]
  675.           @countarray[i] = rand(15)
  676.         end
  677.         @countarray[i] = (@countarray[i] + 1) % 15
  678.         sprite.y += 1
  679.       end
  680.       if @type == 10 # sakura petals
  681.         if @info[i] < 25
  682.           sprite.x -= 1
  683.         else
  684.           sprite.x += 1
  685.         end
  686.         @info[i] = (@info[i] + 1) % 50
  687.         sprite.y += 1
  688.       end
  689.       if @type == 11 # rose petals
  690.         @count = rand(20)
  691.         if @count == 0
  692.           sprite.bitmap = @rose_bitmaps[@current_pose[i]]
  693.           @current_pose[i] = (@current_pose[i] + 1) % @rose_bitmaps.size
  694.         end
  695.         if @info[i] % 2 == 0
  696.           if @info[i] < 10
  697.             sprite.x -= 1
  698.           elsif
  699.             sprite.x += 1
  700.           end
  701.         end
  702.         sprite.y += 1
  703.       end
  704.       if @type == 12 # feathers
  705.         if @countarray[i] == 0
  706.           @current_pose[i] = (@current_pose[i] + 1) % @feather_bitmaps.size
  707.           sprite.bitmap = @feather_bitmaps[@current_pose[i]]
  708.         end
  709.         @countarray[i] = (@countarray[i] + 1) % 15
  710.         if rand(100) == 0
  711.           sprite.x -= 1
  712.         end
  713.         if rand(100) == 0
  714.           sprite.y -= 1
  715.         end
  716.         if @info[i] < 50
  717.           if rand(2) == 0
  718.             sprite.x -= 1
  719.           else
  720.             sprite.y -= 1
  721.           end
  722.         else
  723.           if rand(2) == 0
  724.             sprite.x += 1
  725.           else
  726.             sprite.y += 1
  727.           end
  728.         end
  729.         @info[i] = (@info[i] + 1) % 100
  730.       end
  731.  
  732.        if @type == 30 # starburst
  733.         if @countarray[i] == 0
  734.           @current_pose[i] = (@current_pose[i] + 1) % @starburst_bitmaps.size
  735.           sprite.bitmap = @starburst_bitmaps[@current_pose[i]]
  736.         end
  737.         @countarray[i] = (@countarray[i] + 1) % 15
  738.         sprite.y += 1
  739.         sprite.opacity -= 1
  740.       end
  741.       if @type == 31 # starburst up
  742.         if @countarray[i] == 0
  743.           @current_pose[i] = (@current_pose[i] + 1) % @starburst_bitmaps.size
  744.           sprite.bitmap = @starburst_bitmaps[@current_pose[i]]
  745.         end
  746.         @countarray[i] = (@countarray[i] + 1) % 15
  747.         sprite.y -= 1
  748.         sprite.opacity -= 1
  749.       end
  750.       if @type == 32 # starburst up
  751.         if @countarray[i] == 0
  752.           @current_pose[i] = (@current_pose[i] + 1) % @starburst_bitmaps.size
  753.           sprite.bitmap = @starburst_bitmaps[@current_pose[i]]
  754.         end
  755.         @countarray[i] = (@countarray[i] + 1) % 15
  756.         sprite.x -= 2
  757.         sprite.y += 8
  758.         sprite.opacity -= 1
  759.       end     
  760.  
  761.       if @type == 33 # mono-starburst
  762.         if @countarray[i] == 0
  763.           @current_pose[i] = (@current_pose[i] + 1) % @monostarburst_bitmaps.size
  764.           sprite.bitmap = @monostarburst_bitmaps[@current_pose[i]]
  765.         end
  766.         @countarray[i] = (@countarray[i] + 1) % 15
  767.         sprite.y += 1
  768.         sprite.opacity -= 1
  769.       end
  770.       if @type == 34 # mono-starburst up
  771.         if @countarray[i] == 0
  772.           @current_pose[i] = (@current_pose[i] + 1) % @monostarburst_bitmaps.size
  773.           sprite.bitmap = @monostarburst_bitmaps[@current_pose[i]]
  774.         end
  775.         @countarray[i] = (@countarray[i] + 1) % 15
  776.         sprite.y -= 1
  777.         sprite.opacity -= 1
  778.       end
  779.       if @type == 35 # mono-starburst rain
  780.         if @countarray[i] == 0
  781.           @current_pose[i] = (@current_pose[i] + 1) % @monostarburst_bitmaps.size
  782.           sprite.bitmap = @monostarburst_bitmaps[@current_pose[i]]
  783.         end
  784.         @countarray[i] = (@countarray[i] + 1) % 15
  785.         sprite.x -= 2
  786.         sprite.y += 8
  787.         sprite.opacity -= 1
  788.       end           
  789.         if @type == 29 # meteors
  790.         if @countarray[i] > 0
  791.           if rand(20) == 0
  792.             sprite.bitmap = @flame_impact_bitmap
  793.             @countarray[i] = -5
  794.           else
  795.             sprite.x -= 6
  796.             sprite.y += 10
  797.           end
  798.         else
  799.           @countarray[i] += 1
  800.           if @countarray[i] == 0
  801.             sprite.bitmap = @flame_meteor_bitmap
  802.             sprite.opacity = 0
  803.             @count_array = 1
  804.           end
  805.         end
  806.       end
  807.       if @type == 18 # ash
  808.         sprite.y += 2
  809.         case @countarray[i] % 3
  810.         when 0
  811.           sprite.x -= 1
  812.         when 1
  813.           sprite.x += 1
  814.         end
  815.       end      
  816.  
  817.       if @type == 14 # sparkles
  818.         if @countarray[i] == 0
  819.           @current_pose[i] = (@current_pose[i] + 1) % @sparkle_bitmaps.size
  820.           sprite.bitmap = @sparkle_bitmaps[@current_pose[i]]
  821.         end
  822.         @countarray[i] = (@countarray[i] + 1) % 15
  823.         sprite.y += 1
  824.         sprite.opacity -= 1
  825.       end
  826.       if @type == 15 # user-defined
  827.         if $WEATHER_UPDATE
  828.           update_user_defined
  829.           $WEATHER_UPDATE = false
  830.         end
  831.         if $WEATHER_ANIMATED and @countarray[i] == 0
  832.           @current_pose[i] = (@current_pose[i] + 1) % @user_bitmaps.size
  833.           sprite.bitmap = @user_bitmaps[@current_pose[i]]
  834.         end
  835.         sprite.x += $WEATHER_X
  836.         sprite.y += $WEATHER_Y
  837.         sprite.opacity -= $WEATHER_FADE
  838.       end
  839.       if @type == 16 # blowing snow
  840.         sprite.x -= 10
  841.         sprite.y += 6
  842.         sprite.opacity -= 4
  843.       end
  844.       if @type == 48 # blood blizzard
  845.         sprite.x -= 10
  846.         sprite.y += 6
  847.         sprite.opacity -= 4
  848.       end
  849.       if @type == 52 # water bombs
  850.         if @countarray[i] > 0
  851.           if rand(20) == 0
  852.             sprite.bitmap = @waterbomb_impact_bitmap
  853.             @countarray[i] = -5
  854.           else
  855.             sprite.x -= 3
  856.             sprite.y += 5
  857.           end
  858.         else
  859.           @countarray[i] += 1
  860.           if @countarray[i] == 0
  861.             sprite.bitmap = @waterbomb_bitmap
  862.             sprite.opacity = 0
  863.             @count_array = 1
  864.           end
  865.         end
  866.       end
  867.         if @type == 53 # icy bombs
  868.         if @countarray[i] > 0
  869.           if rand(20) == 0
  870.             sprite.bitmap = @icybomb_impact_bitmap
  871.             @countarray[i] = -5
  872.           else
  873.             sprite.x -= 3
  874.             sprite.y += 5
  875.           end
  876.         else
  877.           @countarray[i] += 1
  878.           if @countarray[i] == 0
  879.             sprite.bitmap = @icybomb_bitmap
  880.             sprite.opacity = 0
  881.             @count_array = 1
  882.           end
  883.         end
  884.       end
  885.       if @type == 54 # flare bombs
  886.         if @countarray[i] > 0
  887.           if rand(20) == 0
  888.             sprite.bitmap = @flarebomb_impact_bitmap
  889.             @countarray[i] = -5
  890.           else
  891.             sprite.x -= 3
  892.             sprite.y += 5
  893.           end
  894.         else
  895.           @countarray[i] += 1
  896.           if @countarray[i] == 0
  897.             sprite.bitmap = @flarebomb_bitmap
  898.             sprite.opacity = 0
  899.             @count_array = 1
  900.           end
  901.         end
  902.       end
  903.       if @type == 17 # meteors
  904.         if @countarray[i] > 0
  905.           if rand(20) == 0
  906.             sprite.bitmap = @impact_bitmap
  907.             @countarray[i] = -5
  908.           else
  909.             sprite.x -= 6
  910.             sprite.y += 10
  911.           end
  912.         else
  913.           @countarray[i] += 1
  914.           if @countarray[i] == 0
  915.             sprite.bitmap = @meteor_bitmap
  916.             sprite.opacity = 0
  917.             @count_array = 1
  918.           end
  919.         end
  920.       end
  921.       if @type == 18 # ash
  922.         sprite.y += 2
  923.         case @countarray[i] % 3
  924.         when 0
  925.           sprite.x -= 1
  926.         when 1
  927.           sprite.x += 1
  928.         end
  929.       end
  930.       if @type == 19 or @type == 20 # bubbles
  931.         switch = rand(75) + rand(75) + 1
  932.         if @info[i] < switch / 2
  933.           sprite.x -= 1
  934.         else
  935.           sprite.x += 1
  936.         end
  937.         @info[i] = (@info[i] + 1) % switch
  938.         sprite.y -= 1
  939.         if switch % 2 == 0
  940.           sprite.opacity -= 1
  941.         end
  942.       end
  943.       if @type == 21 # sparkles up
  944.         if @countarray[i] == 0
  945.           @current_pose[i] = (@current_pose[i] + 1) % @sparkle_bitmaps.size
  946.           sprite.bitmap = @sparkle_bitmaps[@current_pose[i]]
  947.         end
  948.         @countarray[i] = (@countarray[i] + 1) % 15
  949.         sprite.y -= 1
  950.         sprite.opacity -= 1
  951.       end
  952.          if @type == 24 # falling yellow leaves
  953.         @count = rand(20)
  954.         if @count == 0
  955.           sprite.bitmap = @yellow_leaf_bitmaps[@current_pose[i]]
  956.           @current_pose[i] = (@current_pose[i] + 1) % @yellow_leaf_bitmaps.size
  957.         end
  958.         sprite.x -= 1
  959.         sprite.y += 1
  960.       end
  961.        if @type == 22 # blowing green leaves
  962.         @count = rand(20)
  963.         if @count == 0
  964.           sprite.bitmap = @green_leaf_bitmaps[@current_pose[i]]
  965.           @current_pose[i] = (@current_pose[i] + 1) % @green_leaf_bitmaps.size
  966.         end
  967.         sprite.x -= 10
  968.         sprite.y += (rand(4) - 2)
  969.       end      
  970.       if @type == 23 # swirling green leaves
  971.         @count = rand(20)
  972.         if @count == 0
  973.           sprite.bitmap = @green_leaf_bitmaps[@current_pose[i]]
  974.           @current_pose[i] = (@current_pose[i] + 1) % @green_leaf_bitmaps.size
  975.         end
  976.         if @info[i] != 0
  977.           if @info[i] >= 1 and @info[i] <= 10
  978.             sprite.x -= 3
  979.             sprite.y -= 1
  980.           elsif @info[i] >= 11 and @info[i] <= 16
  981.             sprite.x -= 1
  982.             sprite.y -= 2
  983.           elsif @info[i] >= 17 and @info[i] <= 20
  984.             sprite.y -= 3
  985.           elsif @info[i] >= 21 and @info[i] <= 30
  986.             sprite.y -= 2
  987.             sprite.x += 1
  988.           elsif @info[i] >= 31 and @info[i] <= 36
  989.             sprite.y -= 1
  990.             sprite.x += 3
  991.           elsif @info[i] >= 37 and @info[i] <= 40
  992.             sprite.x += 5
  993.           elsif @info[i] >= 41 and @info[i] <= 46
  994.             sprite.y += 1
  995.             sprite.x += 3
  996.           elsif @info[i] >= 47 and @info[i] <= 58
  997.             sprite.y += 2
  998.             sprite.x += 1
  999.           elsif @info[i] >= 59 and @info[i] <= 64
  1000.             sprite.y += 3
  1001.           elsif @info[i] >= 65 and @info[i] <= 70
  1002.             sprite.x -= 1
  1003.             sprite.y += 2
  1004.           elsif @info[i] >= 71 and @info[i] <= 81
  1005.             sprite.x -= 3
  1006.             sprite.y += 1
  1007.           elsif @info[i] >= 82 and @info[i] <= 87
  1008.             sprite.x -= 5
  1009.           end
  1010.           @info[i] = (@info[i] + 1) % 88
  1011.         else
  1012.           if rand(200) == 0
  1013.             @info[i] = 1
  1014.           end
  1015.           sprite.x -= 5
  1016.           sprite.y += 1
  1017.         end
  1018.       end
  1019.         if @type == 24 # falling yellow leaves
  1020.         @count = rand(20)
  1021.         if @count == 0
  1022.           sprite.bitmap = @yellow_leaf_bitmaps[@current_pose[i]]
  1023.           @current_pose[i] = (@current_pose[i] + 1) % @yellow_leaf_bitmaps.size
  1024.         end
  1025.         sprite.x -= 1
  1026.         sprite.y += 1
  1027.       end      
  1028.      if @type == 25 # blowing yellow leaves
  1029.         @count = rand(20)
  1030.         if @count == 0
  1031.           sprite.bitmap = @yellow_leaf_bitmaps[@current_pose[i]]
  1032.           @current_pose[i] = (@current_pose[i] + 1) % @yellow_leaf_bitmaps.size
  1033.         end
  1034.         sprite.x -= 10
  1035.         sprite.y += (rand(4) - 2)
  1036.       end
  1037.        if @type == 26 # swirling yellow leaves
  1038.         @count = rand(20)
  1039.         if @count == 0
  1040.           sprite.bitmap = @yellow_leaf_bitmaps[@current_pose[i]]
  1041.           @current_pose[i] = (@current_pose[i] + 1) % @yellow_leaf_bitmaps.size
  1042.         end
  1043.         if @info[i] != 0
  1044.           if @info[i] >= 1 and @info[i] <= 10
  1045.             sprite.x -= 3
  1046.             sprite.y -= 1
  1047.           elsif @info[i] >= 11 and @info[i] <= 16
  1048.             sprite.x -= 1
  1049.             sprite.y -= 2
  1050.           elsif @info[i] >= 17 and @info[i] <= 20
  1051.             sprite.y -= 3
  1052.           elsif @info[i] >= 21 and @info[i] <= 30
  1053.             sprite.y -= 2
  1054.             sprite.x += 1
  1055.           elsif @info[i] >= 31 and @info[i] <= 36
  1056.             sprite.y -= 1
  1057.             sprite.x += 3
  1058.           elsif @info[i] >= 37 and @info[i] <= 40
  1059.             sprite.x += 5
  1060.           elsif @info[i] >= 41 and @info[i] <= 46
  1061.             sprite.y += 1
  1062.             sprite.x += 3
  1063.           elsif @info[i] >= 47 and @info[i] <= 58
  1064.             sprite.y += 2
  1065.             sprite.x += 1
  1066.           elsif @info[i] >= 59 and @info[i] <= 64
  1067.             sprite.y += 3
  1068.           elsif @info[i] >= 65 and @info[i] <= 70
  1069.             sprite.x -= 1
  1070.             sprite.y += 2
  1071.           elsif @info[i] >= 71 and @info[i] <= 81
  1072.             sprite.x -= 3
  1073.             sprite.y += 1
  1074.           elsif @info[i] >= 82 and @info[i] <= 87
  1075.             sprite.x -= 5
  1076.           end
  1077.           @info[i] = (@info[i] + 1) % 88
  1078.         else
  1079.           if rand(200) == 0
  1080.             @info[i] = 1
  1081.           end
  1082.           sprite.x -= 5
  1083.           sprite.y += 1
  1084.         end
  1085.       end
  1086.  
  1087.       x = sprite.x - @ox
  1088.       y = sprite.y - @oy
  1089.       if sprite.opacity < 64 or x < -50 or x > 750 or y < -300 or y > 500
  1090.         sprite.x = rand(800) - 50 + @ox
  1091.         sprite.y = rand(800) - 200 + @oy
  1092.         sprite.opacity = 255
  1093.       end
  1094.     end
  1095.   end
  1096. #-------------------------------------------------------------------------------  
  1097.   def make_bitmaps
  1098.     color1 = Color.new(255, 255, 255, 255)
  1099.     color2 = Color.new(255, 255, 255, 128)
  1100.     @rain_bitmap = Bitmap.new(7, 56)
  1101.     for i in 0..6
  1102.       @rain_bitmap.fill_rect(6-i, i*8, 1, 8, color1)
  1103.     end
  1104.     @rain_splash = Bitmap.new(8, 5)
  1105.     @rain_splash.fill_rect(1, 0, 6, 1, color2)
  1106.     @rain_splash.fill_rect(1, 4, 6, 1, color2)
  1107.     @rain_splash.fill_rect(0, 1, 1, 3, color2)
  1108.     @rain_splash.fill_rect(7, 1, 1, 3, color2)
  1109.     @rain_splash.set_pixel(1, 0, color1)
  1110.     @rain_splash.set_pixel(0, 1, color1)
  1111. #-------------------------------------------------------------------------------   
  1112.     @storm_bitmap = Bitmap.new(34, 64)
  1113.     for i in 0..31
  1114.       @storm_bitmap.fill_rect(33-i, i*2, 1, 2, color2)
  1115.       @storm_bitmap.fill_rect(32-i, i*2, 1, 2, color1)
  1116.       @storm_bitmap.fill_rect(31-i, i*2, 1, 2, color2)
  1117.     end
  1118. #-------------------------------------------------------------------------------   
  1119.     @snow_bitmap = Bitmap.new(6, 6)
  1120.     @snow_bitmap.fill_rect(0, 1, 6, 4, color2)
  1121.     @snow_bitmap.fill_rect(1, 0, 4, 6, color2)
  1122.     @snow_bitmap.fill_rect(1, 2, 4, 2, color1)
  1123.     @snow_bitmap.fill_rect(2, 1, 2, 4, color1)
  1124.     @sprites = []   
  1125.     @snow_bitmaps = []
  1126.  
  1127.     color3 = Color.new(255, 255, 255, 204)
  1128.     @snow_bitmaps[0] = Bitmap.new(3, 3)
  1129.     @snow_bitmaps[0].fill_rect(0, 0, 3, 3, color2)
  1130.     @snow_bitmaps[0].fill_rect(0, 1, 3, 1, color3)
  1131.     @snow_bitmaps[0].fill_rect(1, 0, 1, 3, color3)
  1132.     @snow_bitmaps[0].set_pixel(1, 1, color1)
  1133.  
  1134.     @snow_bitmaps[1] = Bitmap.new(4, 4)
  1135.     @snow_bitmaps[1].fill_rect(0, 1, 4, 2, color2)
  1136.     @snow_bitmaps[1].fill_rect(1, 0, 2, 4, color2)
  1137.     @snow_bitmaps[1].fill_rect(1, 1, 2, 2, color1)
  1138.  
  1139.     @snow_bitmaps[2] = Bitmap.new(5, 5)
  1140.     @snow_bitmaps[1].fill_rect(0, 1, 5, 3, color3)
  1141.     @snow_bitmaps[1].fill_rect(1, 0, 3, 5, color3)
  1142.     @snow_bitmaps[1].fill_rect(1, 1, 3, 3, color2)
  1143.     @snow_bitmaps[1].fill_rect(2, 1, 3, 1, color1)
  1144.     @snow_bitmaps[1].fill_rect(1, 2, 1, 3, color1)
  1145.  
  1146.     @snow_bitmaps[3] = Bitmap.new(7, 7)
  1147.     @snow_bitmaps[1].fill_rect(1, 1, 5, 5, color3)
  1148.     @snow_bitmaps[1].fill_rect(2, 0, 7, 3, color3)
  1149.     @snow_bitmaps[1].fill_rect(0, 2, 3, 7, color3)
  1150.     @snow_bitmaps[1].fill_rect(2, 1, 5, 3, color2)
  1151.     @snow_bitmaps[1].fill_rect(1, 2, 3, 5, color2)
  1152.     @snow_bitmaps[1].fill_rect(2, 2, 3, 3, color1)
  1153.     @snow_bitmaps[1].fill_rect(3, 1, 5, 1, color1)
  1154.     @snow_bitmaps[1].fill_rect(1, 3, 1, 5, color1)
  1155. #-------------------------------------------------------------------------------   
  1156.     #hail
  1157.  
  1158.     blueGrey  = Color.new(215, 227, 227, 150)
  1159.     grey      = Color.new(214, 217, 217, 150)
  1160.     lightGrey = Color.new(233, 233, 233, 250)
  1161.     lightBlue = Color.new(222, 239, 243, 250)
  1162.  
  1163.     @hail_bitmap = Bitmap.new(4, 4)
  1164.     @hail_bitmap.fill_rect(1, 0, 2, 1, blueGrey)
  1165.     @hail_bitmap.fill_rect(0, 1, 1, 2, blueGrey)
  1166.     @hail_bitmap.fill_rect(3, 1, 1, 2, grey)
  1167.     @hail_bitmap.fill_rect(1, 3, 2, 1, grey)
  1168.     @hail_bitmap.fill_rect(1, 1, 2, 2, lightGrey)
  1169.     @hail_bitmap.set_pixel(1, 1, lightBlue)
  1170.  
  1171. #-------------------------------------------------------------------------------   
  1172.     #sakura petals
  1173.  
  1174.     color3 = Color.new(255, 167, 192, 255) # light pink
  1175.     color4 = Color.new(213, 106, 136, 255) # dark pink
  1176.     @petal_bitmap = Bitmap.new(4, 4) #This creates a new bitmap that is 4 x 4 pixels
  1177.     @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)
  1178.     @petal_bitmap.fill_rect(1, 2, 1, 1, color3)
  1179.     @petal_bitmap.fill_rect(2, 1, 1, 1, color3)
  1180.     @petal_bitmap.fill_rect(3, 0, 1, 1, color3)
  1181.     @petal_bitmap.fill_rect(1, 3, 1, 1, color4)
  1182.     @petal_bitmap.fill_rect(2, 2, 1, 1, color4)
  1183.     @petal_bitmap.fill_rect(3, 1, 1, 1, color4)
  1184.  
  1185. #-------------------------------------------------------------------------------   
  1186.     #autumn brown leaves
  1187.  
  1188.     brightOrange = Color.new(248, 88, 0, 255)  
  1189.     orangeBrown  = Color.new(144, 80, 56, 255)
  1190.     burntRed     = Color.new(152, 0, 0, 255)
  1191.     paleOrange   = Color.new(232, 160, 128, 255)
  1192.     darkBrown    = Color.new(72, 40, 0, 255)
  1193.  
  1194.     @autumn_leaf_bitmaps = []
  1195.  
  1196.     @autumn_leaf_bitmaps.push(Bitmap.new(8, 8))
  1197.     # draw the first of the leaf1 bitmaps
  1198.     @autumn_leaf_bitmaps[0].set_pixel(5, 1, orangeBrown)
  1199.     @autumn_leaf_bitmaps[0].set_pixel(6, 1, brightOrange)
  1200.     @autumn_leaf_bitmaps[0].set_pixel(7, 1, paleOrange)
  1201.     @autumn_leaf_bitmaps[0].set_pixel(3, 2, orangeBrown)
  1202.     @autumn_leaf_bitmaps[0].fill_rect(4, 2, 2, 1, brightOrange)
  1203.     @autumn_leaf_bitmaps[0].set_pixel(6, 2, paleOrange)
  1204.     @autumn_leaf_bitmaps[0].set_pixel(2, 3, orangeBrown)
  1205.     @autumn_leaf_bitmaps[0].set_pixel(3, 3, brightOrange)
  1206.     @autumn_leaf_bitmaps[0].fill_rect(4, 3, 2, 1, paleOrange)
  1207.     @autumn_leaf_bitmaps[0].set_pixel(1, 4, orangeBrown)
  1208.     @autumn_leaf_bitmaps[0].set_pixel(2, 4, brightOrange)
  1209.     @autumn_leaf_bitmaps[0].set_pixel(3, 4, paleOrange)
  1210.     @autumn_leaf_bitmaps[0].set_pixel(1, 5, brightOrange)
  1211.     @autumn_leaf_bitmaps[0].set_pixel(2, 5, paleOrange)
  1212.     @autumn_leaf_bitmaps[0].set_pixel(0, 6, orangeBrown)
  1213.     @autumn_leaf_bitmaps[0].set_pixel(1, 6, paleOrange)
  1214.     @autumn_leaf_bitmaps[0].set_pixel(0, 7, paleOrange)
  1215.  
  1216.     # draw the 2nd of the leaf1 bitmaps
  1217.     @autumn_leaf_bitmaps.push(Bitmap.new(8, 8))
  1218.     @autumn_leaf_bitmaps[1].set_pixel(3, 0, brightOrange)
  1219.     @autumn_leaf_bitmaps[1].set_pixel(7, 0, brightOrange)
  1220.     @autumn_leaf_bitmaps[1].set_pixel(3, 1, orangeBrown)
  1221.     @autumn_leaf_bitmaps[1].set_pixel(4, 1, burntRed)
  1222.     @autumn_leaf_bitmaps[1].set_pixel(6, 1, brightOrange)
  1223.     @autumn_leaf_bitmaps[1].set_pixel(0, 2, paleOrange)
  1224.     @autumn_leaf_bitmaps[1].set_pixel(1, 2, brightOrange)
  1225.     @autumn_leaf_bitmaps[1].set_pixel(2, 2, orangeBrown)
  1226.     @autumn_leaf_bitmaps[1].set_pixel(3, 2, burntRed)
  1227.     @autumn_leaf_bitmaps[1].set_pixel(4, 2, orangeBrown)
  1228.     @autumn_leaf_bitmaps[1].set_pixel(5, 2, brightOrange)
  1229.     @autumn_leaf_bitmaps[1].fill_rect(1, 3, 3, 1, orangeBrown)
  1230.     @autumn_leaf_bitmaps[1].fill_rect(4, 3, 2, 1, brightOrange)
  1231.     @autumn_leaf_bitmaps[1].set_pixel(6, 3, orangeBrown)
  1232.     @autumn_leaf_bitmaps[1].set_pixel(2, 4, burntRed)
  1233.     @autumn_leaf_bitmaps[1].fill_rect(3, 4, 3, 1, brightOrange)
  1234.     @autumn_leaf_bitmaps[1].set_pixel(6, 4, burntRed)
  1235.     @autumn_leaf_bitmaps[1].set_pixel(7, 4, darkBrown)
  1236.     @autumn_leaf_bitmaps[1].set_pixel(1, 5, orangeBrown)
  1237.     @autumn_leaf_bitmaps[1].fill_rect(2, 5, 2, 1, brightOrange)
  1238.     @autumn_leaf_bitmaps[1].set_pixel(4, 5, orangeBrown)
  1239.     @autumn_leaf_bitmaps[1].set_pixel(5, 5, burntRed)
  1240.     @autumn_leaf_bitmaps[1].fill_rect(1, 6, 2, 1, brightOrange)
  1241.     @autumn_leaf_bitmaps[1].fill_rect(4, 6, 2, 1, burntRed)
  1242.     @autumn_leaf_bitmaps[1].set_pixel(0, 7, brightOrange)
  1243.     @autumn_leaf_bitmaps[1].set_pixel(5, 7, darkBrown)
  1244.  
  1245.     # draw the 3rd of the leaf1 bitmaps
  1246.     @autumn_leaf_bitmaps.push(Bitmap.new(8, 8))
  1247.     @autumn_leaf_bitmaps[2].set_pixel(7, 1, paleOrange)
  1248.     @autumn_leaf_bitmaps[2].set_pixel(6, 2, paleOrange)
  1249.     @autumn_leaf_bitmaps[2].set_pixel(7, 2, orangeBrown)
  1250.     @autumn_leaf_bitmaps[2].set_pixel(5, 3, paleOrange)
  1251.     @autumn_leaf_bitmaps[2].set_pixel(6, 3, brightOrange)
  1252.     @autumn_leaf_bitmaps[2].set_pixel(4, 4, paleOrange)
  1253.     @autumn_leaf_bitmaps[2].set_pixel(5, 4, brightOrange)
  1254.     @autumn_leaf_bitmaps[2].set_pixel(6, 4, orangeBrown)
  1255.     @autumn_leaf_bitmaps[2].fill_rect(2, 5, 2, 1, paleOrange)
  1256.     @autumn_leaf_bitmaps[2].set_pixel(4, 5, brightOrange)
  1257.     @autumn_leaf_bitmaps[2].set_pixel(5, 5, orangeBrown)
  1258.     @autumn_leaf_bitmaps[2].set_pixel(1, 6, paleOrange)
  1259.     @autumn_leaf_bitmaps[2].fill_rect(2, 6, 2, 1, brightOrange)
  1260.     @autumn_leaf_bitmaps[2].set_pixel(4, 6, orangeBrown)
  1261.     @autumn_leaf_bitmaps[2].set_pixel(0, 7, paleOrange)
  1262.     @autumn_leaf_bitmaps[2].set_pixel(1, 7, brightOrange)
  1263.     @autumn_leaf_bitmaps[2].set_pixel(2, 7, orangeBrown)
  1264.  
  1265.     # draw the 4th of the leaf1 bitmaps
  1266.     @autumn_leaf_bitmaps.push(Bitmap.new(8, 8))
  1267.     @autumn_leaf_bitmaps[3].set_pixel(3, 0, brightOrange)
  1268.     @autumn_leaf_bitmaps[3].set_pixel(7, 0, brightOrange)
  1269.     @autumn_leaf_bitmaps[3].set_pixel(3, 1, orangeBrown)
  1270.     @autumn_leaf_bitmaps[3].set_pixel(4, 1, burntRed)
  1271.     @autumn_leaf_bitmaps[3].set_pixel(6, 1, brightOrange)
  1272.     @autumn_leaf_bitmaps[3].set_pixel(0, 2, paleOrange)
  1273.     @autumn_leaf_bitmaps[3].set_pixel(1, 2, brightOrange)
  1274.     @autumn_leaf_bitmaps[3].set_pixel(2, 2, orangeBrown)
  1275.     @autumn_leaf_bitmaps[3].set_pixel(3, 2, burntRed)
  1276.     @autumn_leaf_bitmaps[3].set_pixel(4, 2, orangeBrown)
  1277.     @autumn_leaf_bitmaps[3].set_pixel(5, 2, brightOrange)
  1278.     @autumn_leaf_bitmaps[3].fill_rect(1, 3, 3, 1, orangeBrown)
  1279.     @autumn_leaf_bitmaps[3].fill_rect(4, 3, 2, 1, brightOrange)
  1280.     @autumn_leaf_bitmaps[3].set_pixel(6, 3, orangeBrown)
  1281.     @autumn_leaf_bitmaps[3].set_pixel(2, 4, burntRed)
  1282.     @autumn_leaf_bitmaps[3].fill_rect(3, 4, 3, 1, brightOrange)
  1283.     @autumn_leaf_bitmaps[3].set_pixel(6, 4, burntRed)
  1284.     @autumn_leaf_bitmaps[3].set_pixel(7, 4, darkBrown)
  1285.     @autumn_leaf_bitmaps[3].set_pixel(1, 5, orangeBrown)
  1286.     @autumn_leaf_bitmaps[3].fill_rect(2, 5, 2, 1, brightOrange)
  1287.     @autumn_leaf_bitmaps[3].set_pixel(4, 5, orangeBrown)
  1288.     @autumn_leaf_bitmaps[3].set_pixel(5, 5, burntRed)
  1289.     @autumn_leaf_bitmaps[3].fill_rect(1, 6, 2, 1, brightOrange)
  1290.     @autumn_leaf_bitmaps[3].fill_rect(4, 6, 2, 1, burntRed)
  1291.     @autumn_leaf_bitmaps[3].set_pixel(0, 7, brightOrange)
  1292.     @autumn_leaf_bitmaps[3].set_pixel(5, 7, darkBrown)
  1293.  
  1294. #-------------------------------------------------------------------------------
  1295.  
  1296.     # Red maple leaves
  1297.  
  1298.     @redmaple_leaf_bitmaps = []
  1299.     brightRed = Color.new(255, 0, 0, 255)
  1300.     midRed    = Color.new(179, 17, 17, 255)
  1301.     darkRed   = Color.new(141, 9, 9, 255)
  1302.  
  1303.     @redmaple_leaf_bitmaps.push(Bitmap.new(8, 8))
  1304.     # draw the first of the red maple leaves bitmaps
  1305.     @redmaple_leaf_bitmaps[0].set_pixel(5, 1, darkRed)
  1306.     @redmaple_leaf_bitmaps[0].set_pixel(6, 1, brightRed)
  1307.     @redmaple_leaf_bitmaps[0].set_pixel(7, 1, midRed)
  1308.     @redmaple_leaf_bitmaps[0].set_pixel(3, 2, darkRed)
  1309.     @redmaple_leaf_bitmaps[0].fill_rect(4, 2, 2, 1, brightRed)
  1310.     @redmaple_leaf_bitmaps[0].set_pixel(6, 2, midRed)
  1311.     @redmaple_leaf_bitmaps[0].set_pixel(2, 3, darkRed)
  1312.     @redmaple_leaf_bitmaps[0].set_pixel(3, 3, brightRed)
  1313.     @redmaple_leaf_bitmaps[0].fill_rect(4, 3, 2, 1, midRed)
  1314.     @redmaple_leaf_bitmaps[0].set_pixel(1, 4, brightRed)
  1315.     @redmaple_leaf_bitmaps[0].set_pixel(2, 4, brightRed)
  1316.     @redmaple_leaf_bitmaps[0].set_pixel(3, 4, midRed)
  1317.     @redmaple_leaf_bitmaps[0].set_pixel(1, 5, brightRed)
  1318.     @redmaple_leaf_bitmaps[0].set_pixel(2, 5, midRed)
  1319.     @redmaple_leaf_bitmaps[0].set_pixel(0, 6, darkRed)
  1320.     @redmaple_leaf_bitmaps[0].set_pixel(1, 6, midRed)
  1321.     @redmaple_leaf_bitmaps[0].set_pixel(0, 7, midRed)
  1322.  
  1323.     # draw the 2nd of the red maple leaves bitmaps
  1324.     @redmaple_leaf_bitmaps.push(Bitmap.new(8, 8))
  1325.     @redmaple_leaf_bitmaps[1].set_pixel(3, 0, brightRed)
  1326.     @redmaple_leaf_bitmaps[1].set_pixel(7, 0, brightRed)
  1327.     @redmaple_leaf_bitmaps[1].set_pixel(3, 1, darkRed)
  1328.     @redmaple_leaf_bitmaps[1].set_pixel(4, 1, burntRed)
  1329.     @redmaple_leaf_bitmaps[1].set_pixel(6, 1, brightRed)
  1330.     @redmaple_leaf_bitmaps[1].set_pixel(0, 2, midRed)
  1331.     @redmaple_leaf_bitmaps[1].set_pixel(1, 2, brightRed)
  1332.     @redmaple_leaf_bitmaps[1].set_pixel(2, 2, darkRed)
  1333.     @redmaple_leaf_bitmaps[1].set_pixel(3, 2, burntRed)
  1334.     @redmaple_leaf_bitmaps[1].set_pixel(4, 2, darkRed)
  1335.     @redmaple_leaf_bitmaps[1].set_pixel(5, 2, brightRed)
  1336.     @redmaple_leaf_bitmaps[1].fill_rect(1, 3, 3, 1, darkRed)
  1337.     @redmaple_leaf_bitmaps[1].fill_rect(4, 3, 2, 1, brightRed)
  1338.     @redmaple_leaf_bitmaps[1].set_pixel(6, 3, darkRed)
  1339.     @redmaple_leaf_bitmaps[1].set_pixel(2, 4, burntRed)
  1340.     @redmaple_leaf_bitmaps[1].fill_rect(3, 4, 3, 1, brightRed)
  1341.     @redmaple_leaf_bitmaps[1].set_pixel(6, 4, burntRed)
  1342.     @redmaple_leaf_bitmaps[1].set_pixel(7, 4, darkRed)
  1343.     @redmaple_leaf_bitmaps[1].set_pixel(1, 5, darkRed)
  1344.     @redmaple_leaf_bitmaps[1].fill_rect(2, 5, 2, 1, brightRed)
  1345.     @redmaple_leaf_bitmaps[1].set_pixel(4, 5, darkRed)
  1346.     @redmaple_leaf_bitmaps[1].set_pixel(5, 5, burntRed)
  1347.     @redmaple_leaf_bitmaps[1].fill_rect(1, 6, 2, 1, brightRed)
  1348.     @redmaple_leaf_bitmaps[1].fill_rect(4, 6, 2, 1, burntRed)
  1349.     @redmaple_leaf_bitmaps[1].set_pixel(0, 7, brightRed)
  1350.     @autumn_leaf_bitmaps[1].set_pixel(5, 7, darkRed)
  1351.  
  1352.     # draw the 3rd of the red maple leaves bitmaps
  1353.     @redmaple_leaf_bitmaps.push(Bitmap.new(8, 8))
  1354.     @redmaple_leaf_bitmaps[2].set_pixel(7, 1, midRed)
  1355.     @redmaple_leaf_bitmaps[2].set_pixel(6, 2, midRed)
  1356.     @redmaple_leaf_bitmaps[2].set_pixel(7, 2, darkRed)
  1357.     @redmaple_leaf_bitmaps[2].set_pixel(5, 3, midRed)
  1358.     @redmaple_leaf_bitmaps[2].set_pixel(6, 3, brightRed)
  1359.     @redmaple_leaf_bitmaps[2].set_pixel(4, 4, midRed)
  1360.     @redmaple_leaf_bitmaps[2].set_pixel(5, 4, brightRed)
  1361.     @redmaple_leaf_bitmaps[2].set_pixel(6, 4, darkRed)
  1362.     @redmaple_leaf_bitmaps[2].fill_rect(2, 5, 2, 1, midRed)
  1363.     @redmaple_leaf_bitmaps[2].set_pixel(4, 5, brightRed)
  1364.     @redmaple_leaf_bitmaps[2].set_pixel(5, 5, darkRed)
  1365.     @redmaple_leaf_bitmaps[2].set_pixel(1, 6, midRed)
  1366.     @redmaple_leaf_bitmaps[2].fill_rect(2, 6, 2, 1, brightRed)
  1367.     @redmaple_leaf_bitmaps[2].set_pixel(4, 6, darkRed)
  1368.     @redmaple_leaf_bitmaps[2].set_pixel(0, 7, midRed)
  1369.     @redmaple_leaf_bitmaps[2].set_pixel(1, 7, brightRed)
  1370.     @redmaple_leaf_bitmaps[2].set_pixel(2, 7, darkRed)
  1371.  
  1372.     # draw the 4th of the red maple leaves bitmaps
  1373.     @redmaple_leaf_bitmaps.push(Bitmap.new(8, 8))
  1374.     @redmaple_leaf_bitmaps[3].set_pixel(3, 0, brightRed)
  1375.     @redmaple_leaf_bitmaps[3].set_pixel(7, 0, brightRed)
  1376.     @redmaple_leaf_bitmaps[3].set_pixel(3, 1, darkRed)
  1377.     @redmaple_leaf_bitmaps[3].set_pixel(4, 1, burntRed)
  1378.     @redmaple_leaf_bitmaps[3].set_pixel(6, 1, brightRed)
  1379.     @redmaple_leaf_bitmaps[3].set_pixel(0, 2, midRed)
  1380.     @redmaple_leaf_bitmaps[3].set_pixel(1, 2, brightRed)
  1381.     @redmaple_leaf_bitmaps[3].set_pixel(2, 2, darkRed)
  1382.     @redmaple_leaf_bitmaps[3].set_pixel(3, 2, burntRed)
  1383.     @redmaple_leaf_bitmaps[3].set_pixel(4, 2, darkRed)
  1384.     @redmaple_leaf_bitmaps[3].set_pixel(5, 2, brightRed)
  1385.     @redmaple_leaf_bitmaps[3].fill_rect(1, 3, 3, 1, darkRed)
  1386.     @redmaple_leaf_bitmaps[3].fill_rect(4, 3, 2, 1, brightRed)
  1387.     @redmaple_leaf_bitmaps[3].set_pixel(6, 3, darkRed)
  1388.     @redmaple_leaf_bitmaps[3].set_pixel(2, 4, burntRed)
  1389.     @redmaple_leaf_bitmaps[3].fill_rect(3, 4, 3, 1, brightRed)
  1390.     @redmaple_leaf_bitmaps[3].set_pixel(6, 4, burntRed)
  1391.     @redmaple_leaf_bitmaps[3].set_pixel(7, 4, darkRed)
  1392.     @redmaple_leaf_bitmaps[3].set_pixel(1, 5, darkRed)
  1393.     @redmaple_leaf_bitmaps[3].fill_rect(2, 5, 2, 1, brightRed)
  1394.     @redmaple_leaf_bitmaps[3].set_pixel(4, 5, darkRed)
  1395.     @redmaple_leaf_bitmaps[3].set_pixel(5, 5, burntRed)
  1396.     @redmaple_leaf_bitmaps[3].fill_rect(1, 6, 2, 1, brightRed)
  1397.     @redmaple_leaf_bitmaps[3].fill_rect(4, 6, 2, 1, burntRed)
  1398.     @redmaple_leaf_bitmaps[3].set_pixel(0, 7, brightRed)
  1399.     @redmaple_leaf_bitmaps[3].set_pixel(5, 7, darkRed)
  1400. #-------------------------------------------------------------------------------   
  1401.     #Green leaves
  1402.  
  1403.     @green_leaf_bitmaps = []
  1404.     darkGreen  = Color.new(62, 76, 31, 255)
  1405.     midGreen   = Color.new(76, 91, 43, 255)
  1406.     khaki      = Color.new(105, 114, 66, 255)
  1407.     lightGreen = Color.new(128, 136, 88, 255)
  1408.     mint       = Color.new(146, 154, 106, 255)
  1409.  
  1410.     # 1st leaf bitmap
  1411.     @green_leaf_bitmaps[0] = Bitmap.new(8, 8)
  1412.     @green_leaf_bitmaps[0].set_pixel(1, 0, darkGreen)
  1413.     @green_leaf_bitmaps[0].set_pixel(1, 1, midGreen)
  1414.     @green_leaf_bitmaps[0].set_pixel(2, 1, darkGreen)
  1415.     @green_leaf_bitmaps[0].set_pixel(2, 2, khaki)
  1416.     @green_leaf_bitmaps[0].set_pixel(3, 2, darkGreen)
  1417.     @green_leaf_bitmaps[0].set_pixel(4, 2, khaki)
  1418.     @green_leaf_bitmaps[0].fill_rect(2, 3, 3, 1, midGreen)
  1419.     @green_leaf_bitmaps[0].set_pixel(5, 3, khaki)
  1420.     @green_leaf_bitmaps[0].fill_rect(2, 4, 2, 1, midGreen)
  1421.     @green_leaf_bitmaps[0].set_pixel(4, 4, darkGreen)
  1422.     @green_leaf_bitmaps[0].set_pixel(5, 4, lightGreen)
  1423.     @green_leaf_bitmaps[0].set_pixel(6, 4, khaki)
  1424.     @green_leaf_bitmaps[0].set_pixel(3, 5, midGreen)
  1425.     @green_leaf_bitmaps[0].set_pixel(4, 5, darkGreen)
  1426.     @green_leaf_bitmaps[0].set_pixel(5, 5, khaki)
  1427.     @green_leaf_bitmaps[0].set_pixel(6, 5, lightGreen)
  1428.     @green_leaf_bitmaps[0].set_pixel(4, 6, midGreen)
  1429.     @green_leaf_bitmaps[0].set_pixel(5, 6, darkGreen)
  1430.     @green_leaf_bitmaps[0].set_pixel(6, 6, lightGreen)
  1431.     @green_leaf_bitmaps[0].set_pixel(6, 7, khaki)
  1432.  
  1433.     # 2nd leaf bitmap
  1434.     @green_leaf_bitmaps[1] = Bitmap.new(8, 8)
  1435.     @green_leaf_bitmaps[1].fill_rect(1, 1, 1, 2, midGreen)
  1436.     @green_leaf_bitmaps[1].fill_rect(2, 2, 2, 1, khaki)
  1437.     @green_leaf_bitmaps[1].set_pixel(4, 2, lightGreen)
  1438.     @green_leaf_bitmaps[1].fill_rect(2, 3, 2, 1, darkGreen)
  1439.     @green_leaf_bitmaps[1].fill_rect(4, 3, 2, 1, lightGreen)
  1440.     @green_leaf_bitmaps[1].set_pixel(2, 4, midGreen)
  1441.     @green_leaf_bitmaps[1].set_pixel(3, 4, darkGreen)
  1442.     @green_leaf_bitmaps[1].set_pixel(4, 4, khaki)
  1443.     @green_leaf_bitmaps[1].fill_rect(5, 4, 2, 1, lightGreen)
  1444.     @green_leaf_bitmaps[1].set_pixel(3, 5, midGreen)
  1445.     @green_leaf_bitmaps[1].set_pixel(4, 5, darkGreen)
  1446.     @green_leaf_bitmaps[1].set_pixel(5, 5, khaki)
  1447.     @green_leaf_bitmaps[1].set_pixel(6, 5, lightGreen)
  1448.     @green_leaf_bitmaps[1].set_pixel(5, 6, darkGreen)
  1449.     @green_leaf_bitmaps[1].fill_rect(6, 6, 2, 1, khaki)
  1450.  
  1451.     # 3rd leaf bitmap
  1452.     @green_leaf_bitmaps[2] = Bitmap.new(8, 8)
  1453.     @green_leaf_bitmaps[2].set_pixel(1, 1, darkGreen)
  1454.     @green_leaf_bitmaps[2].fill_rect(1, 2, 2, 1, midGreen)
  1455.     @green_leaf_bitmaps[2].set_pixel(2, 3, midGreen)
  1456.     @green_leaf_bitmaps[2].set_pixel(3, 3, darkGreen)
  1457.     @green_leaf_bitmaps[2].set_pixel(4, 3, midGreen)
  1458.     @green_leaf_bitmaps[2].fill_rect(2, 4, 2, 1, midGreen)
  1459.     @green_leaf_bitmaps[2].set_pixel(4, 4, darkGreen)
  1460.     @green_leaf_bitmaps[2].set_pixel(5, 4, lightGreen)
  1461.     @green_leaf_bitmaps[2].set_pixel(3, 5, midGreen)
  1462.     @green_leaf_bitmaps[2].set_pixel(4, 5, darkGreen)
  1463.     @green_leaf_bitmaps[2].fill_rect(5, 5, 2, 1, khaki)
  1464.     @green_leaf_bitmaps[2].fill_rect(4, 6, 2, 1, midGreen)
  1465.     @green_leaf_bitmaps[2].set_pixel(6, 6, lightGreen)
  1466.     @green_leaf_bitmaps[2].set_pixel(6, 7, khaki)
  1467.  
  1468.     # 4th leaf bitmap
  1469.     @green_leaf_bitmaps[3] = Bitmap.new(8, 8)
  1470.     @green_leaf_bitmaps[3].fill_rect(0, 3, 1, 2, darkGreen)
  1471.     @green_leaf_bitmaps[3].set_pixel(1, 4, midGreen)
  1472.     @green_leaf_bitmaps[3].set_pixel(2, 4, khaki)
  1473.     @green_leaf_bitmaps[3].set_pixel(3, 4, lightGreen)
  1474.     @green_leaf_bitmaps[3].set_pixel(4, 4, darkGreen)
  1475.     @green_leaf_bitmaps[3].set_pixel(7, 4, midGreen)
  1476.     @green_leaf_bitmaps[3].set_pixel(1, 5, darkGreen)
  1477.     @green_leaf_bitmaps[3].set_pixel(2, 5, midGreen)
  1478.     @green_leaf_bitmaps[3].set_pixel(3, 5, lightGreen)
  1479.     @green_leaf_bitmaps[3].set_pixel(4, 5, mint)
  1480.     @green_leaf_bitmaps[3].set_pixel(5, 5, lightGreen)
  1481.     @green_leaf_bitmaps[3].set_pixel(6, 5, khaki)
  1482.     @green_leaf_bitmaps[3].set_pixel(7, 5, midGreen)
  1483.     @green_leaf_bitmaps[3].fill_rect(2, 6, 2, 1, midGreen)
  1484.     @green_leaf_bitmaps[3].set_pixel(4, 6, lightGreen)
  1485.     @green_leaf_bitmaps[3].set_pixel(5, 6, khaki)
  1486.     @green_leaf_bitmaps[3].set_pixel(6, 6, midGreen)
  1487.  
  1488.     # 5th leaf bitmap
  1489.     @green_leaf_bitmaps[4] = Bitmap.new(8, 8)
  1490.     @green_leaf_bitmaps[4].set_pixel(6, 2, midGreen)
  1491.     @green_leaf_bitmaps[4].set_pixel(7, 2, darkGreen)
  1492.     @green_leaf_bitmaps[4].fill_rect(4, 3, 2, 1, midGreen)
  1493.     @green_leaf_bitmaps[4].set_pixel(6, 3, khaki)
  1494.     @green_leaf_bitmaps[4].set_pixel(2, 4, darkGreen)
  1495.     @green_leaf_bitmaps[4].fill_rect(3, 4, 2, 1, khaki)
  1496.     @green_leaf_bitmaps[4].set_pixel(5, 4, lightGreen)
  1497.     @green_leaf_bitmaps[4].set_pixel(6, 4, khaki)
  1498.     @green_leaf_bitmaps[4].set_pixel(1, 5, midGreen)
  1499.     @green_leaf_bitmaps[4].set_pixel(2, 5, khaki)
  1500.     @green_leaf_bitmaps[4].set_pixel(3, 5, lightGreen)
  1501.     @green_leaf_bitmaps[4].set_pixel(4, 5, mint)
  1502.     @green_leaf_bitmaps[4].set_pixel(5, 5, midGreen)
  1503.     @green_leaf_bitmaps[4].set_pixel(2, 6, darkGreen)
  1504.     @green_leaf_bitmaps[4].fill_rect(3, 6, 2, 1, midGreen)
  1505.  
  1506.     # 6th leaf bitmap
  1507.     @green_leaf_bitmaps[5] = Bitmap.new(8, 8)
  1508.     @green_leaf_bitmaps[5].fill_rect(6, 2, 2, 1, midGreen)
  1509.     @green_leaf_bitmaps[5].fill_rect(4, 3, 2, 1, midGreen)
  1510.     @green_leaf_bitmaps[5].set_pixel(6, 3, khaki)
  1511.     @green_leaf_bitmaps[5].set_pixel(3, 4, midGreen)
  1512.     @green_leaf_bitmaps[5].set_pixel(4, 4, khaki)
  1513.     @green_leaf_bitmaps[5].set_pixel(5, 4, lightGreen)
  1514.     @green_leaf_bitmaps[5].set_pixel(6, 4, mint)
  1515.     @green_leaf_bitmaps[5].set_pixel(1, 5, midGreen)
  1516.     @green_leaf_bitmaps[5].set_pixel(2, 5, khaki)
  1517.     @green_leaf_bitmaps[5].fill_rect(3, 5, 2, 1, mint)
  1518.     @green_leaf_bitmaps[5].set_pixel(5, 5, lightGreen)
  1519.     @green_leaf_bitmaps[5].set_pixel(2, 6, midGreen)
  1520.     @green_leaf_bitmaps[5].set_pixel(3, 6, khaki)
  1521.     @green_leaf_bitmaps[5].set_pixel(4, 6, lightGreen)
  1522.  
  1523.     # 7th leaf bitmap
  1524.     @green_leaf_bitmaps[6] = Bitmap.new(8, 8)
  1525.     @green_leaf_bitmaps[6].fill_rect(6, 1, 1, 2, midGreen)
  1526.     @green_leaf_bitmaps[6].fill_rect(4, 2, 2, 1, midGreen)
  1527.     @green_leaf_bitmaps[6].fill_rect(6, 2, 1, 2, darkGreen)
  1528.     @green_leaf_bitmaps[6].fill_rect(3, 3, 2, 1, midGreen)
  1529.     @green_leaf_bitmaps[6].set_pixel(5, 3, khaki)
  1530.     @green_leaf_bitmaps[6].set_pixel(2, 4, midGreen)
  1531.     @green_leaf_bitmaps[6].set_pixel(3, 4, khaki)
  1532.     @green_leaf_bitmaps[6].set_pixel(4, 4, lightGreen)
  1533.     @green_leaf_bitmaps[6].set_pixel(5, 4, midGreen)
  1534.     @green_leaf_bitmaps[6].set_pixel(1, 5, midGreen)
  1535.     @green_leaf_bitmaps[6].set_pixel(2, 5, khaki)
  1536.     @green_leaf_bitmaps[6].fill_rect(3, 5, 2, 1, midGreen)
  1537.     @green_leaf_bitmaps[6].set_pixel(1, 6, darkGreen)
  1538.     @green_leaf_bitmaps[6].set_pixel(2, 6, midGreen)
  1539.  
  1540.     # 8th leaf bitmap
  1541.     @green_leaf_bitmaps[7] = Bitmap.new(8, 8)
  1542.     @green_leaf_bitmaps[7].set_pixel(6, 1, midGreen)
  1543.     @green_leaf_bitmaps[7].fill_rect(4, 2, 3, 2, midGreen)
  1544.     @green_leaf_bitmaps[7].set_pixel(3, 3, darkGreen)
  1545.     @green_leaf_bitmaps[7].set_pixel(2, 4, darkGreen)
  1546.     @green_leaf_bitmaps[7].set_pixel(3, 4, midGreen)
  1547.     @green_leaf_bitmaps[7].fill_rect(4, 4, 2, 1, khaki)
  1548.     @green_leaf_bitmaps[7].set_pixel(1, 5, darkGreen)
  1549.     @green_leaf_bitmaps[7].set_pixel(2, 5, midGreen)
  1550.     @green_leaf_bitmaps[7].fill_rect(3, 5, 2, 1, lightGreen)
  1551.     @green_leaf_bitmaps[7].set_pixel(2, 6, midGreen)
  1552.     @green_leaf_bitmaps[7].set_pixel(3, 6, lightGreen)
  1553.  
  1554.     # 9th leaf bitmap
  1555.     @green_leaf_bitmaps[8] = Bitmap.new(8, 8)
  1556.     @green_leaf_bitmaps[8].fill_rect(6, 1, 1, 2, midGreen)
  1557.     @green_leaf_bitmaps[8].fill_rect(4, 2, 2, 1, midGreen)
  1558.     @green_leaf_bitmaps[8].fill_rect(6, 2, 1, 2, darkGreen)
  1559.     @green_leaf_bitmaps[8].fill_rect(3, 3, 2, 1, midGreen)
  1560.     @green_leaf_bitmaps[8].set_pixel(5, 3, khaki)
  1561.     @green_leaf_bitmaps[8].set_pixel(2, 4, midGreen)
  1562.     @green_leaf_bitmaps[8].set_pixel(3, 4, khaki)
  1563.     @green_leaf_bitmaps[8].set_pixel(4, 4, lightGreen)
  1564.     @green_leaf_bitmaps[8].set_pixel(5, 4, midGreen)
  1565.     @green_leaf_bitmaps[8].set_pixel(1, 5, midGreen)
  1566.     @green_leaf_bitmaps[8].set_pixel(2, 5, khaki)
  1567.     @green_leaf_bitmaps[8].fill_rect(3, 5, 2, 1, midGreen)
  1568.     @green_leaf_bitmaps[8].set_pixel(1, 6, darkGreen)
  1569.     @green_leaf_bitmaps[8].set_pixel(2, 6, midGreen)
  1570.  
  1571.     # 10th leaf bitmap
  1572.     @green_leaf_bitmaps[9] = Bitmap.new(8, 8)
  1573.     @green_leaf_bitmaps[9].fill_rect(6, 2, 2, 1, midGreen)
  1574.     @green_leaf_bitmaps[9].fill_rect(4, 3, 2, 1, midGreen)
  1575.     @green_leaf_bitmaps[9].set_pixel(6, 3, khaki)
  1576.     @green_leaf_bitmaps[9].set_pixel(3, 4, midGreen)
  1577.     @green_leaf_bitmaps[9].set_pixel(4, 4, khaki)
  1578.     @green_leaf_bitmaps[9].set_pixel(5, 4, lightGreen)
  1579.     @green_leaf_bitmaps[9].set_pixel(6, 4, mint)
  1580.     @green_leaf_bitmaps[9].set_pixel(1, 5, midGreen)
  1581.     @green_leaf_bitmaps[9].set_pixel(2, 5, khaki)
  1582.     @green_leaf_bitmaps[9].fill_rect(3, 5, 2, 1, mint)
  1583.     @green_leaf_bitmaps[9].set_pixel(5, 5, lightGreen)
  1584.     @green_leaf_bitmaps[9].set_pixel(2, 6, midGreen)
  1585.     @green_leaf_bitmaps[9].set_pixel(3, 6, khaki)
  1586.     @green_leaf_bitmaps[9].set_pixel(4, 6, lightGreen)
  1587.  
  1588.     # 11th leaf bitmap
  1589.     @green_leaf_bitmaps[10] = Bitmap.new(8, 8)
  1590.     @green_leaf_bitmaps[10].set_pixel(6, 2, midGreen)
  1591.     @green_leaf_bitmaps[10].set_pixel(7, 2, darkGreen)
  1592.     @green_leaf_bitmaps[10].fill_rect(4, 3, 2, 1, midGreen)
  1593.     @green_leaf_bitmaps[10].set_pixel(6, 3, khaki)
  1594.     @green_leaf_bitmaps[10].set_pixel(2, 4, darkGreen)
  1595.     @green_leaf_bitmaps[10].fill_rect(3, 4, 2, 1, khaki)
  1596.     @green_leaf_bitmaps[10].set_pixel(5, 4, lightGreen)
  1597.     @green_leaf_bitmaps[10].set_pixel(6, 4, khaki)
  1598.     @green_leaf_bitmaps[10].set_pixel(1, 5, midGreen)
  1599.     @green_leaf_bitmaps[10].set_pixel(2, 5, khaki)
  1600.     @green_leaf_bitmaps[10].set_pixel(3, 5, lightGreen)
  1601.     @green_leaf_bitmaps[10].set_pixel(4, 5, mint)
  1602.     @green_leaf_bitmaps[10].set_pixel(5, 5, midGreen)
  1603.     @green_leaf_bitmaps[10].set_pixel(2, 6, darkGreen)
  1604.     @green_leaf_bitmaps[10].fill_rect(3, 6, 2, 1, midGreen)
  1605.  
  1606.     # 12th leaf bitmap
  1607.     @green_leaf_bitmaps[11] = Bitmap.new(8, 8)
  1608.     @green_leaf_bitmaps[11].fill_rect(0, 3, 1, 2, darkGreen)
  1609.     @green_leaf_bitmaps[11].set_pixel(1, 4, midGreen)
  1610.     @green_leaf_bitmaps[11].set_pixel(2, 4, khaki)
  1611.     @green_leaf_bitmaps[11].set_pixel(3, 4, lightGreen)
  1612.     @green_leaf_bitmaps[11].set_pixel(4, 4, darkGreen)
  1613.     @green_leaf_bitmaps[11].set_pixel(7, 4, midGreen)
  1614.     @green_leaf_bitmaps[11].set_pixel(1, 5, darkGreen)
  1615.     @green_leaf_bitmaps[11].set_pixel(2, 5, midGreen)
  1616.     @green_leaf_bitmaps[11].set_pixel(3, 5, lightGreen)
  1617.     @green_leaf_bitmaps[11].set_pixel(4, 5, mint)
  1618.     @green_leaf_bitmaps[11].set_pixel(5, 5, lightGreen)
  1619.     @green_leaf_bitmaps[11].set_pixel(6, 5, khaki)
  1620.     @green_leaf_bitmaps[11].set_pixel(7, 5, midGreen)
  1621.     @green_leaf_bitmaps[11].fill_rect(2, 6, 2, 1, midGreen)
  1622.     @green_leaf_bitmaps[11].set_pixel(4, 6, lightGreen)
  1623.     @green_leaf_bitmaps[11].set_pixel(5, 6, khaki)
  1624.     @green_leaf_bitmaps[11].set_pixel(6, 6, midGreen)
  1625.  
  1626.     # 13th leaf bitmap
  1627.     @green_leaf_bitmaps[12] = Bitmap.new(8, 8)
  1628.     @green_leaf_bitmaps[12].set_pixel(1, 1, darkGreen)
  1629.     @green_leaf_bitmaps[12].fill_rect(1, 2, 2, 1, midGreen)
  1630.     @green_leaf_bitmaps[12].set_pixel(2, 3, midGreen)
  1631.     @green_leaf_bitmaps[12].set_pixel(3, 3, darkGreen)
  1632.     @green_leaf_bitmaps[12].set_pixel(4, 3, midGreen)
  1633.     @green_leaf_bitmaps[12].fill_rect(2, 4, 2, 1, midGreen)
  1634.     @green_leaf_bitmaps[12].set_pixel(4, 4, darkGreen)
  1635.     @green_leaf_bitmaps[12].set_pixel(5, 4, lightGreen)
  1636.     @green_leaf_bitmaps[12].set_pixel(3, 5, midGreen)
  1637.     @green_leaf_bitmaps[12].set_pixel(4, 5, darkGreen)
  1638.     @green_leaf_bitmaps[12].fill_rect(5, 5, 2, 1, khaki)
  1639.     @green_leaf_bitmaps[12].fill_rect(4, 6, 2, 1, midGreen)
  1640.     @green_leaf_bitmaps[12].set_pixel(6, 6, lightGreen)
  1641.     @green_leaf_bitmaps[12].set_pixel(6, 7, khaki)
  1642. #-------------------------------------------------------------------------------   
  1643.     #rose petals
  1644.  
  1645.     @rose_bitmaps = []
  1646.  
  1647.     # 1st rose petal bitmap
  1648.     @rose_bitmaps[0] = Bitmap.new(3, 3)
  1649.     @rose_bitmaps[0].fill_rect(1, 0, 2, 1, brightRed)
  1650.     @rose_bitmaps[0].fill_rect(0, 1, 1, 2, brightRed)
  1651.     @rose_bitmaps[0].fill_rect(1, 1, 2, 2, midRed)
  1652.     @rose_bitmaps[0].set_pixel(2, 2, darkRed)
  1653.  
  1654.     # 2nd rose petal bitmap
  1655.     @rose_bitmaps[1] = Bitmap.new(3, 3)
  1656.     @rose_bitmaps[1].set_pixel(0, 1, midRed)
  1657.     @rose_bitmaps[1].set_pixel(1, 1, brightRed)
  1658.     @rose_bitmaps[1].fill_rect(1, 2, 1, 2, midRed)
  1659. #-------------------------------------------------------------------------------   
  1660.     #Feathers
  1661.  
  1662.     @feather_bitmaps = []
  1663.     white = Color.new(255, 255, 255, 255)
  1664.  
  1665.     # 1st feather bitmap
  1666.     @feather_bitmaps[0] = Bitmap.new(3, 3)
  1667.     @feather_bitmaps[0].set_pixel(0, 2, white)
  1668.     @feather_bitmaps[0].set_pixel(1, 2, grey)
  1669.     @feather_bitmaps[0].set_pixel(2, 1, grey)
  1670.  
  1671.     # 2nd feather bitmap
  1672.     @feather_bitmaps[0] = Bitmap.new(3, 3)
  1673.     @feather_bitmaps[0].set_pixel(0, 0, white)
  1674.     @feather_bitmaps[0].set_pixel(0, 1, grey)
  1675.     @feather_bitmaps[0].set_pixel(1, 2, grey)
  1676.  
  1677.     # 3rd feather bitmap
  1678.     @feather_bitmaps[0] = Bitmap.new(3, 3)
  1679.     @feather_bitmaps[0].set_pixel(2, 0, white)
  1680.     @feather_bitmaps[0].set_pixel(1, 0, grey)
  1681.     @feather_bitmaps[0].set_pixel(0, 1, grey)
  1682.  
  1683.     # 4th feather bitmap
  1684.     @feather_bitmaps[0] = Bitmap.new(3, 3)
  1685.     @feather_bitmaps[0].set_pixel(2, 2, white)
  1686.     @feather_bitmaps[0].set_pixel(2, 1, grey)
  1687.     @feather_bitmaps[0].set_pixel(1, 0, grey)
  1688. #-------------------------------------------------------------------------------   
  1689.     #Blood rain
  1690.  
  1691.     @blood_rain_bitmap = Bitmap.new(7, 56)
  1692.     for i in 0..6
  1693.       @blood_rain_bitmap.fill_rect(6-i, i*8, 1, 8, darkRed)
  1694.     end
  1695.     @blood_rain_splash = Bitmap.new(8, 5)
  1696.     @blood_rain_splash.fill_rect(1, 0, 6, 1, darkRed)
  1697.     @blood_rain_splash.fill_rect(1, 4, 6, 1, darkRed)
  1698.     @blood_rain_splash.fill_rect(0, 1, 1, 3, darkRed)
  1699.     @blood_rain_splash.fill_rect(7, 1, 1, 3, darkRed)
  1700. #-------------------------------------------------------------------------------
  1701.  
  1702.     #Blood storm
  1703.  
  1704.     @blood_storm_bitmap = Bitmap.new(34, 64)
  1705.     for i in 0..31
  1706.       @blood_storm_bitmap.fill_rect(33-i, i*2, 1, 2, darkRed)
  1707.       @blood_storm_bitmap.fill_rect(32-i, i*2, 1, 2, darkRed)
  1708.       @blood_storm_bitmap.fill_rect(31-i, i*2, 1, 2, darkRed)
  1709.     end
  1710.  
  1711. #-------------------------------------------------------------------------------
  1712.     #Blood blizzard
  1713.  
  1714.     @bloodblizz_bitmap = Bitmap.new(6, 6)
  1715.     @bloodblizz_bitmap.fill_rect(0, 1, 6, 4, midRed)
  1716.     @bloodblizz_bitmap.fill_rect(1, 0, 4, 6, midRed)
  1717.     @bloodblizz_bitmap.fill_rect(1, 2, 4, 2, darkRed)
  1718.     @bloodblizz_bitmap.fill_rect(2, 1, 2, 4, darkRed)
  1719.     @sprites = []   
  1720.     @bloodblizz_bitmaps = []
  1721.  
  1722.     @bloodblizz_bitmaps[0] = Bitmap.new(3, 3)
  1723.     @bloodblizz_bitmaps[0].fill_rect(0, 0, 3, 3, midRed)
  1724.     @bloodblizz_bitmaps[0].fill_rect(0, 1, 3, 1, darkRed)
  1725.     @bloodblizz_bitmaps[0].fill_rect(1, 0, 1, 3, darkRed)
  1726.     @bloodblizz_bitmaps[0].set_pixel(1, 1, darkRed)
  1727.  
  1728.     @bloodblizz_bitmaps[1] = Bitmap.new(4, 4)
  1729.     @bloodblizz_bitmaps[1].fill_rect(0, 1, 4, 2, midRed)
  1730.     @bloodblizz_bitmaps[1].fill_rect(1, 0, 2, 4, midRed)
  1731.     @bloodblizz_bitmaps[1].fill_rect(1, 1, 2, 2, darkRed)
  1732.  
  1733.     @bloodblizz_bitmaps[2] = Bitmap.new(5, 5)
  1734.     @bloodblizz_bitmaps[1].fill_rect(0, 1, 5, 3, darkRed)
  1735.     @bloodblizz_bitmaps[1].fill_rect(1, 0, 3, 5, darkRed)
  1736.     @bloodblizz_bitmaps[1].fill_rect(1, 1, 3, 3, midRed)
  1737.     @bloodblizz_bitmaps[1].fill_rect(2, 1, 3, 1, darkRed)
  1738.     @bloodblizz_bitmaps[1].fill_rect(1, 2, 1, 3, darkRed)
  1739.  
  1740.     @bloodblizz_bitmaps[3] = Bitmap.new(7, 7)
  1741.     @bloodblizz_bitmaps[1].fill_rect(1, 1, 5, 5, darkRed)
  1742.     @bloodblizz_bitmaps[1].fill_rect(2, 0, 7, 3, darkRed)
  1743.     @bloodblizz_bitmaps[1].fill_rect(0, 2, 3, 7, darkRed)
  1744.     @bloodblizz_bitmaps[1].fill_rect(2, 1, 5, 3, midRed)
  1745.     @bloodblizz_bitmaps[1].fill_rect(1, 2, 3, 5, midRed)
  1746.     @bloodblizz_bitmaps[1].fill_rect(2, 2, 3, 3, darkRed)
  1747.     @bloodblizz_bitmaps[1].fill_rect(3, 1, 5, 1, darkRed)
  1748.     @bloodblizz_bitmaps[1].fill_rect(1, 3, 1, 5, darkRed)
  1749. #-------------------------------------------------------------------------------  
  1750.  
  1751.     # Oil rain
  1752.  
  1753.     darkgrey = Color.new(15, 15, 15, 255)
  1754.     black = Color.new(0, 0, 0, 255)
  1755.  
  1756.     @oil_rain_bitmap = Bitmap.new(7, 56)
  1757.     for i in 0..6
  1758.     @oil_rain_bitmap.fill_rect(6-i, i*8, 1, 8, darkgrey)
  1759.       end
  1760.     @oil_rain_splash = Bitmap.new(8, 5)
  1761.     @oil_rain_splash.fill_rect(1, 0, 6, 1, darkgrey)
  1762.     @oil_rain_splash.fill_rect(1, 4, 6, 1, darkgrey)
  1763.     @oil_rain_splash.fill_rect(0, 1, 1, 3, black)
  1764.     @oil_rain_splash.fill_rect(7, 1, 1, 3, black)
  1765. #-------------------------------------------------------------------------------
  1766.  
  1767.     # Oil storm
  1768.  
  1769.       @oil_storm_bitmap = Bitmap.new(34, 64)
  1770.     for i in 0..31
  1771.       @oil_storm_bitmap.fill_rect(33-i, i*2, 1, 2, darkgrey)
  1772.       @oil_storm_bitmap.fill_rect(32-i, i*2, 1, 2, darkgrey)
  1773.       @oil_storm_bitmap.fill_rect(31-i, i*2, 1, 2, darkgrey)
  1774.     end
  1775. #-------------------------------------------------------------------------------
  1776.  
  1777.     # Golden rain
  1778.  
  1779.     darkYellow  = Color.new(110, 104, 3, 255)
  1780.     midYellow   = Color.new(205, 194, 23, 255)
  1781.     darkYellowtwo  = Color.new(186, 176, 14, 255)
  1782.     lightYellow = Color.new(218, 207, 36, 255)
  1783.     lightYellowtwo = Color.new(227, 217, 56, 255)   
  1784.  
  1785.     @golden_rain_bitmap = Bitmap.new(7, 56)
  1786.     for i in 0..6
  1787.     @golden_rain_bitmap.fill_rect(6-i, i*8, 1, 8, lightYellow)
  1788.       end
  1789.     @golden_rain_splash = Bitmap.new(8, 5)
  1790.     @golden_rain_splash.fill_rect(1, 0, 6, 1, lightYellow)
  1791.     @golden_rain_splash.fill_rect(1, 4, 6, 1, lightYellow)
  1792.     @golden_rain_splash.fill_rect(0, 1, 1, 3, lightYellow)
  1793.     @golden_rain_splash.fill_rect(7, 1, 1, 3, lightYellow)
  1794. #-------------------------------------------------------------------------------
  1795.  
  1796.      # Golden storm
  1797.  
  1798.       @golden_storm_bitmap = Bitmap.new(34, 64)
  1799.     for i in 0..31
  1800.       @golden_storm_bitmap.fill_rect(33-i, i*2, 1, 2, lightYellow)
  1801.       @golden_storm_bitmap.fill_rect(32-i, i*2, 1, 2, lightYellow)
  1802.       @golden_storm_bitmap.fill_rect(31-i, i*2, 1, 2, lightYellow)
  1803.     end
  1804. #-------------------------------------------------------------------------------
  1805.  
  1806.     # Acid rain
  1807.  
  1808.     @acid_rain_bitmap = Bitmap.new(7, 56)
  1809.     for i in 0..6
  1810.     @acid_rain_bitmap.fill_rect(6-i, i*8, 1, 8, midGreen)
  1811.       end
  1812.     @acid_rain_splash = Bitmap.new(8, 5)
  1813.     @acid_rain_splash.fill_rect(1, 0, 6, 1, white)
  1814.     @acid_rain_splash.fill_rect(1, 4, 6, 1, white)
  1815.     @acid_rain_splash.fill_rect(0, 1, 1, 3, white)
  1816.     @acid_rain_splash.fill_rect(7, 1, 1, 3, white)
  1817. #-------------------------------------------------------------------------------
  1818.  
  1819.      # Acid storm
  1820.  
  1821.       @acid_storm_bitmap = Bitmap.new(34, 64)
  1822.     for i in 0..31
  1823.       @acid_storm_bitmap.fill_rect(33-i, i*2, 1, 2, khaki)
  1824.       @acid_storm_bitmap.fill_rect(32-i, i*2, 1, 2, khaki)
  1825.       @acid_storm_bitmap.fill_rect(31-i, i*2, 1, 2, midGreen)
  1826.     end
  1827. #-------------------------------------------------------------------------------
  1828.  
  1829.     # Sepia rain
  1830.  
  1831.     sepia_color = Color.new(167, 149, 139, 255)
  1832.     sepia_colortwo = Color.new(100, 75, 63, 255)
  1833.  
  1834.     @sepia_rain_bitmap = Bitmap.new(7, 56)
  1835.     for i in 0..6
  1836.     @sepia_rain_bitmap.fill_rect(6-i, i*8, 1, 8, sepia_colortwo)
  1837.       end
  1838.     @sepia_rain_splash = Bitmap.new(8, 5)
  1839.     @sepia_rain_splash.fill_rect(1, 0, 6, 1, sepia_colortwo)
  1840.     @sepia_rain_splash.fill_rect(1, 4, 6, 1, sepia_color)
  1841.     @sepia_rain_splash.fill_rect(0, 1, 1, 3, sepia_colortwo)
  1842.     @sepia_rain_splash.fill_rect(7, 1, 1, 3, sepia_color)
  1843. #-------------------------------------------------------------------------------
  1844.  
  1845.      # Sepia storm
  1846.  
  1847.       @sepia_storm_bitmap = Bitmap.new(34, 64)
  1848.     for i in 0..31
  1849.       @sepia_storm_bitmap.fill_rect(33-i, i*2, 1, 2, sepia_colortwo)
  1850.       @sepia_storm_bitmap.fill_rect(32-i, i*2, 1, 2, sepia_colortwo)
  1851.       @sepia_storm_bitmap.fill_rect(31-i, i*2, 1, 2, sepia_color)
  1852.     end
  1853. #-------------------------------------------------------------------------------
  1854.  
  1855.     # Yellow leaves
  1856.  
  1857.     @yellow_leaf_bitmaps = []
  1858.  
  1859.    # 1st leaf bitmap
  1860.     @yellow_leaf_bitmaps[0] = Bitmap.new(8, 8)
  1861.     @yellow_leaf_bitmaps[0].set_pixel(1, 0, darkYellow)
  1862.     @yellow_leaf_bitmaps[0].set_pixel(1, 1, midYellow)
  1863.     @yellow_leaf_bitmaps[0].set_pixel(2, 1, darkYellow)
  1864.     @yellow_leaf_bitmaps[0].set_pixel(2, 2, darkYellowtwo)
  1865.     @yellow_leaf_bitmaps[0].set_pixel(3, 2, darkYellow)
  1866.     @yellow_leaf_bitmaps[0].set_pixel(4, 2, darkYellowtwo)
  1867.     @yellow_leaf_bitmaps[0].fill_rect(2, 3, 3, 1, midYellow)
  1868.     @yellow_leaf_bitmaps[0].set_pixel(5, 3, darkYellowtwo)
  1869.     @yellow_leaf_bitmaps[0].fill_rect(2, 4, 2, 1, midYellow)
  1870.     @yellow_leaf_bitmaps[0].set_pixel(4, 4, darkYellow)
  1871.     @yellow_leaf_bitmaps[0].set_pixel(5, 4, lightYellow)
  1872.     @yellow_leaf_bitmaps[0].set_pixel(6, 4, darkYellowtwo)
  1873.     @yellow_leaf_bitmaps[0].set_pixel(3, 5, midYellow)
  1874.     @yellow_leaf_bitmaps[0].set_pixel(4, 5, darkYellow)
  1875.     @yellow_leaf_bitmaps[0].set_pixel(5, 5, darkYellowtwo)
  1876.     @yellow_leaf_bitmaps[0].set_pixel(6, 5, lightYellow)
  1877.     @yellow_leaf_bitmaps[0].set_pixel(4, 6, midYellow)
  1878.     @yellow_leaf_bitmaps[0].set_pixel(5, 6, darkYellow)
  1879.     @yellow_leaf_bitmaps[0].set_pixel(6, 6, lightYellow)
  1880.     @yellow_leaf_bitmaps[0].set_pixel(6, 7, darkYellowtwo)
  1881.  
  1882.     # 2nd leaf bitmap
  1883.     @yellow_leaf_bitmaps[1] = Bitmap.new(8, 8)
  1884.     @yellow_leaf_bitmaps[1].fill_rect(1, 1, 1, 2, midYellow)
  1885.     @yellow_leaf_bitmaps[1].fill_rect(2, 2, 2, 1, darkYellowtwo)
  1886.     @yellow_leaf_bitmaps[1].set_pixel(4, 2, lightYellow)
  1887.     @yellow_leaf_bitmaps[1].fill_rect(2, 3, 2, 1, darkYellow)
  1888.     @yellow_leaf_bitmaps[1].fill_rect(4, 3, 2, 1, lightYellow)
  1889.     @yellow_leaf_bitmaps[1].set_pixel(2, 4, midYellow)
  1890.     @yellow_leaf_bitmaps[1].set_pixel(3, 4, darkYellow)
  1891.     @yellow_leaf_bitmaps[1].set_pixel(4, 4, darkYellowtwo)
  1892.     @yellow_leaf_bitmaps[1].fill_rect(5, 4, 2, 1, lightYellow)
  1893.     @yellow_leaf_bitmaps[1].set_pixel(3, 5, midYellow)
  1894.     @yellow_leaf_bitmaps[1].set_pixel(4, 5, darkYellow)
  1895.     @yellow_leaf_bitmaps[1].set_pixel(5, 5, darkYellowtwo)
  1896.     @yellow_leaf_bitmaps[1].set_pixel(6, 5, lightYellow)
  1897.     @yellow_leaf_bitmaps[1].set_pixel(5, 6, darkYellow)
  1898.     @yellow_leaf_bitmaps[1].fill_rect(6, 6, 2, 1, darkYellowtwo)
  1899.  
  1900.     # 3rd leaf bitmap
  1901.     @yellow_leaf_bitmaps[2] = Bitmap.new(8, 8)
  1902.     @yellow_leaf_bitmaps[2].set_pixel(1, 1, darkYellow)
  1903.     @yellow_leaf_bitmaps[2].fill_rect(1, 2, 2, 1, midYellow)
  1904.     @yellow_leaf_bitmaps[2].set_pixel(2, 3, midYellow)
  1905.     @yellow_leaf_bitmaps[2].set_pixel(3, 3, darkYellow)
  1906.     @yellow_leaf_bitmaps[2].set_pixel(4, 3, midYellow)
  1907.     @yellow_leaf_bitmaps[2].fill_rect(2, 4, 2, 1, midYellow)
  1908.     @yellow_leaf_bitmaps[2].set_pixel(4, 4, darkYellow)
  1909.     @yellow_leaf_bitmaps[2].set_pixel(5, 4, lightYellow)
  1910.     @yellow_leaf_bitmaps[2].set_pixel(3, 5, midYellow)
  1911.     @yellow_leaf_bitmaps[2].set_pixel(4, 5, darkYellow)
  1912.     @yellow_leaf_bitmaps[2].fill_rect(5, 5, 2, 1, darkYellowtwo)
  1913.     @yellow_leaf_bitmaps[2].fill_rect(4, 6, 2, 1, midYellow)
  1914.     @yellow_leaf_bitmaps[2].set_pixel(6, 6, lightYellow)
  1915.     @yellow_leaf_bitmaps[2].set_pixel(6, 7, darkYellowtwo)
  1916.  
  1917.     # 4th leaf bitmap
  1918.     @yellow_leaf_bitmaps[3] = Bitmap.new(8, 8)
  1919.     @yellow_leaf_bitmaps[3].fill_rect(0, 3, 1, 2, darkYellow)
  1920.     @yellow_leaf_bitmaps[3].set_pixel(1, 4, midYellow)
  1921.     @yellow_leaf_bitmaps[3].set_pixel(2, 4, darkYellowtwo)
  1922.     @yellow_leaf_bitmaps[3].set_pixel(3, 4, lightYellow)
  1923.     @yellow_leaf_bitmaps[3].set_pixel(4, 4, darkYellow)
  1924.     @yellow_leaf_bitmaps[3].set_pixel(7, 4, midYellow)
  1925.     @yellow_leaf_bitmaps[3].set_pixel(1, 5, darkYellow)
  1926.     @yellow_leaf_bitmaps[3].set_pixel(2, 5, midYellow)
  1927.     @yellow_leaf_bitmaps[3].set_pixel(3, 5, lightYellow)
  1928.     @yellow_leaf_bitmaps[3].set_pixel(4, 5, lightYellowtwo)
  1929.     @yellow_leaf_bitmaps[3].set_pixel(5, 5, lightYellow)
  1930.     @yellow_leaf_bitmaps[3].set_pixel(6, 5, darkYellowtwo)
  1931.     @yellow_leaf_bitmaps[3].set_pixel(7, 5, midYellow)
  1932.     @yellow_leaf_bitmaps[3].fill_rect(2, 6, 2, 1, midYellow)
  1933.     @yellow_leaf_bitmaps[3].set_pixel(4, 6, lightYellow)
  1934.     @yellow_leaf_bitmaps[3].set_pixel(5, 6, darkYellowtwo)
  1935.     @yellow_leaf_bitmaps[3].set_pixel(6, 6, midYellow)
  1936.  
  1937.     # 5th leaf bitmap
  1938.     @yellow_leaf_bitmaps[4] = Bitmap.new(8, 8)
  1939.     @yellow_leaf_bitmaps[4].set_pixel(6, 2, midYellow)
  1940.     @yellow_leaf_bitmaps[4].set_pixel(7, 2, darkYellow)
  1941.     @yellow_leaf_bitmaps[4].fill_rect(4, 3, 2, 1, midYellow)
  1942.     @yellow_leaf_bitmaps[4].set_pixel(6, 3, darkYellowtwo)
  1943.     @yellow_leaf_bitmaps[4].set_pixel(2, 4, darkYellow)
  1944.     @yellow_leaf_bitmaps[4].fill_rect(3, 4, 2, 1, darkYellowtwo)
  1945.     @yellow_leaf_bitmaps[4].set_pixel(5, 4, lightYellow)
  1946.     @yellow_leaf_bitmaps[4].set_pixel(6, 4, darkYellowtwo)
  1947.     @yellow_leaf_bitmaps[4].set_pixel(1, 5, midYellow)
  1948.     @yellow_leaf_bitmaps[4].set_pixel(2, 5, darkYellowtwo)
  1949.     @yellow_leaf_bitmaps[4].set_pixel(3, 5, lightYellow)
  1950.     @yellow_leaf_bitmaps[4].set_pixel(4, 5, lightYellowtwo)
  1951.     @yellow_leaf_bitmaps[4].set_pixel(5, 5, midYellow)
  1952.     @yellow_leaf_bitmaps[4].set_pixel(2, 6, darkYellow)
  1953.     @yellow_leaf_bitmaps[4].fill_rect(3, 6, 2, 1, midYellow)
  1954.  
  1955.     # 6th leaf bitmap
  1956.     @yellow_leaf_bitmaps[5] = Bitmap.new(8, 8)
  1957.     @yellow_leaf_bitmaps[5].fill_rect(6, 2, 2, 1, midYellow)
  1958.     @yellow_leaf_bitmaps[5].fill_rect(4, 3, 2, 1, midYellow)
  1959.     @yellow_leaf_bitmaps[5].set_pixel(6, 3, darkYellowtwo)
  1960.     @yellow_leaf_bitmaps[5].set_pixel(3, 4, midYellow)
  1961.     @yellow_leaf_bitmaps[5].set_pixel(4, 4, darkYellowtwo)
  1962.     @yellow_leaf_bitmaps[5].set_pixel(5, 4, lightYellow)
  1963.     @yellow_leaf_bitmaps[5].set_pixel(6, 4, lightYellowtwo)
  1964.     @yellow_leaf_bitmaps[5].set_pixel(1, 5, midYellow)
  1965.     @yellow_leaf_bitmaps[5].set_pixel(2, 5, darkYellowtwo)
  1966.     @yellow_leaf_bitmaps[5].fill_rect(3, 5, 2, 1, lightYellowtwo)
  1967.     @yellow_leaf_bitmaps[5].set_pixel(5, 5, lightYellow)
  1968.     @yellow_leaf_bitmaps[5].set_pixel(2, 6, midYellow)
  1969.     @yellow_leaf_bitmaps[5].set_pixel(3, 6, darkYellowtwo)
  1970.     @yellow_leaf_bitmaps[5].set_pixel(4, 6, lightYellow)
  1971.  
  1972.     # 7th leaf bitmap
  1973.     @yellow_leaf_bitmaps[6] = Bitmap.new(8, 8)
  1974.     @yellow_leaf_bitmaps[6].fill_rect(6, 1, 1, 2, midYellow)
  1975.     @yellow_leaf_bitmaps[6].fill_rect(4, 2, 2, 1, midYellow)
  1976.     @yellow_leaf_bitmaps[6].fill_rect(6, 2, 1, 2, darkYellow)
  1977.     @yellow_leaf_bitmaps[6].fill_rect(3, 3, 2, 1, midYellow)
  1978.     @yellow_leaf_bitmaps[6].set_pixel(5, 3, darkYellowtwo)
  1979.     @yellow_leaf_bitmaps[6].set_pixel(2, 4, midYellow)
  1980.     @yellow_leaf_bitmaps[6].set_pixel(3, 4, darkYellowtwo)
  1981.     @yellow_leaf_bitmaps[6].set_pixel(4, 4, lightYellow)
  1982.     @yellow_leaf_bitmaps[6].set_pixel(5, 4, midYellow)
  1983.     @yellow_leaf_bitmaps[6].set_pixel(1, 5, midYellow)
  1984.     @yellow_leaf_bitmaps[6].set_pixel(2, 5, darkYellowtwo)
  1985.     @yellow_leaf_bitmaps[6].fill_rect(3, 5, 2, 1, midYellow)
  1986.     @yellow_leaf_bitmaps[6].set_pixel(1, 6, darkYellow)
  1987.     @yellow_leaf_bitmaps[6].set_pixel(2, 6, midYellow)
  1988.  
  1989.     # 8th leaf bitmap
  1990.     @yellow_leaf_bitmaps[7] = Bitmap.new(8, 8)
  1991.     @yellow_leaf_bitmaps[7].set_pixel(6, 1, midYellow)
  1992.     @yellow_leaf_bitmaps[7].fill_rect(4, 2, 3, 2, midYellow)
  1993.     @yellow_leaf_bitmaps[7].set_pixel(3, 3, darkYellow)
  1994.     @yellow_leaf_bitmaps[7].set_pixel(2, 4, darkYellow)
  1995.     @yellow_leaf_bitmaps[7].set_pixel(3, 4, midYellow)
  1996.     @yellow_leaf_bitmaps[7].fill_rect(4, 4, 2, 1, darkYellowtwo)
  1997.     @yellow_leaf_bitmaps[7].set_pixel(1, 5, darkYellow)
  1998.     @yellow_leaf_bitmaps[7].set_pixel(2, 5, midYellow)
  1999.     @yellow_leaf_bitmaps[7].fill_rect(3, 5, 2, 1, lightYellow)
  2000.     @yellow_leaf_bitmaps[7].set_pixel(2, 6, midYellow)
  2001.     @yellow_leaf_bitmaps[7].set_pixel(3, 6, lightYellow)
  2002.  
  2003.     # 9th leaf bitmap
  2004.     @yellow_leaf_bitmaps[8] = Bitmap.new(8, 8)
  2005.     @yellow_leaf_bitmaps[8].fill_rect(6, 1, 1, 2, midYellow)
  2006.     @yellow_leaf_bitmaps[8].fill_rect(4, 2, 2, 1, midYellow)
  2007.     @yellow_leaf_bitmaps[8].fill_rect(6, 2, 1, 2, darkYellow)
  2008.     @yellow_leaf_bitmaps[8].fill_rect(3, 3, 2, 1, midYellow)
  2009.     @yellow_leaf_bitmaps[8].set_pixel(5, 3, darkYellowtwo)
  2010.     @yellow_leaf_bitmaps[8].set_pixel(2, 4, midYellow)
  2011.     @yellow_leaf_bitmaps[8].set_pixel(3, 4, darkYellowtwo)
  2012.     @yellow_leaf_bitmaps[8].set_pixel(4, 4, lightYellow)
  2013.     @yellow_leaf_bitmaps[8].set_pixel(5, 4, midYellow)
  2014.     @yellow_leaf_bitmaps[8].set_pixel(1, 5, midYellow)
  2015.     @yellow_leaf_bitmaps[8].set_pixel(2, 5, darkYellowtwo)
  2016.     @yellow_leaf_bitmaps[8].fill_rect(3, 5, 2, 1, midYellow)
  2017.     @yellow_leaf_bitmaps[8].set_pixel(1, 6, darkYellow)
  2018.     @yellow_leaf_bitmaps[8].set_pixel(2, 6, midYellow)
  2019.  
  2020.     # 10th leaf bitmap
  2021.     @yellow_leaf_bitmaps[9] = Bitmap.new(8, 8)
  2022.     @yellow_leaf_bitmaps[9].fill_rect(6, 2, 2, 1, midYellow)
  2023.     @yellow_leaf_bitmaps[9].fill_rect(4, 3, 2, 1, midYellow)
  2024.     @yellow_leaf_bitmaps[9].set_pixel(6, 3, darkYellowtwo)
  2025.     @yellow_leaf_bitmaps[9].set_pixel(3, 4, midYellow)
  2026.     @yellow_leaf_bitmaps[9].set_pixel(4, 4, darkYellowtwo)
  2027.     @yellow_leaf_bitmaps[9].set_pixel(5, 4, lightYellow)
  2028.     @yellow_leaf_bitmaps[9].set_pixel(6, 4, lightYellowtwo)
  2029.     @yellow_leaf_bitmaps[9].set_pixel(1, 5, midYellow)
  2030.     @yellow_leaf_bitmaps[9].set_pixel(2, 5, darkYellowtwo)
  2031.     @yellow_leaf_bitmaps[9].fill_rect(3, 5, 2, 1, lightYellowtwo)
  2032.     @yellow_leaf_bitmaps[9].set_pixel(5, 5, lightYellow)
  2033.     @yellow_leaf_bitmaps[9].set_pixel(2, 6, midYellow)
  2034.     @yellow_leaf_bitmaps[9].set_pixel(3, 6, darkYellowtwo)
  2035.     @yellow_leaf_bitmaps[9].set_pixel(4, 6, lightYellow)
  2036.  
  2037.     # 11th leaf bitmap
  2038.     @yellow_leaf_bitmaps[10] = Bitmap.new(8, 8)
  2039.     @yellow_leaf_bitmaps[10].set_pixel(6, 2, midYellow)
  2040.     @yellow_leaf_bitmaps[10].set_pixel(7, 2, darkYellow)
  2041.     @yellow_leaf_bitmaps[10].fill_rect(4, 3, 2, 1, midYellow)
  2042.     @yellow_leaf_bitmaps[10].set_pixel(6, 3, darkYellowtwo)
  2043.     @yellow_leaf_bitmaps[10].set_pixel(2, 4, darkYellow)
  2044.     @yellow_leaf_bitmaps[10].fill_rect(3, 4, 2, 1, darkYellowtwo)
  2045.     @yellow_leaf_bitmaps[10].set_pixel(5, 4, lightYellow)
  2046.     @yellow_leaf_bitmaps[10].set_pixel(6, 4, darkYellowtwo)
  2047.     @yellow_leaf_bitmaps[10].set_pixel(1, 5, midYellow)
  2048.     @yellow_leaf_bitmaps[10].set_pixel(2, 5, darkYellowtwo)
  2049.     @yellow_leaf_bitmaps[10].set_pixel(3, 5, lightYellow)
  2050.     @yellow_leaf_bitmaps[10].set_pixel(4, 5, lightYellowtwo)
  2051.     @yellow_leaf_bitmaps[10].set_pixel(5, 5, midYellow)
  2052.     @yellow_leaf_bitmaps[10].set_pixel(2, 6, darkYellow)
  2053.     @yellow_leaf_bitmaps[10].fill_rect(3, 6, 2, 1, midYellow)
  2054.  
  2055.     # 12th leaf bitmap
  2056.     @yellow_leaf_bitmaps[11] = Bitmap.new(8, 8)
  2057.     @yellow_leaf_bitmaps[11].fill_rect(0, 3, 1, 2, darkYellow)
  2058.     @yellow_leaf_bitmaps[11].set_pixel(1, 4, midYellow)
  2059.     @yellow_leaf_bitmaps[11].set_pixel(2, 4, darkYellowtwo)
  2060.     @yellow_leaf_bitmaps[11].set_pixel(3, 4, lightYellow)
  2061.     @yellow_leaf_bitmaps[11].set_pixel(4, 4, darkYellow)
  2062.     @yellow_leaf_bitmaps[11].set_pixel(7, 4, midYellow)
  2063.     @yellow_leaf_bitmaps[11].set_pixel(1, 5, darkYellow)
  2064.     @yellow_leaf_bitmaps[11].set_pixel(2, 5, midYellow)
  2065.     @yellow_leaf_bitmaps[11].set_pixel(3, 5, lightYellow)
  2066.     @yellow_leaf_bitmaps[11].set_pixel(4, 5, lightYellowtwo)
  2067.     @yellow_leaf_bitmaps[11].set_pixel(5, 5, lightYellow)
  2068.     @yellow_leaf_bitmaps[11].set_pixel(6, 5, darkYellowtwo)
  2069.     @yellow_leaf_bitmaps[11].set_pixel(7, 5, midYellow)
  2070.     @yellow_leaf_bitmaps[11].fill_rect(2, 6, 2, 1, midYellow)
  2071.     @yellow_leaf_bitmaps[11].set_pixel(4, 6, lightYellow)
  2072.     @yellow_leaf_bitmaps[11].set_pixel(5, 6, darkYellowtwo)
  2073.     @yellow_leaf_bitmaps[11].set_pixel(6, 6, midYellow)
  2074.  
  2075.     # 13th leaf bitmap
  2076.     @yellow_leaf_bitmaps[12] = Bitmap.new(8, 8)
  2077.     @yellow_leaf_bitmaps[12].set_pixel(1, 1, darkYellow)
  2078.     @yellow_leaf_bitmaps[12].fill_rect(1, 2, 2, 1, midYellow)
  2079.     @yellow_leaf_bitmaps[12].set_pixel(2, 3, midYellow)
  2080.     @yellow_leaf_bitmaps[12].set_pixel(3, 3, darkYellow)
  2081.     @yellow_leaf_bitmaps[12].set_pixel(4, 3, midYellow)
  2082.     @yellow_leaf_bitmaps[12].fill_rect(2, 4, 2, 1, midYellow)
  2083.     @yellow_leaf_bitmaps[12].set_pixel(4, 4, darkYellow)
  2084.     @yellow_leaf_bitmaps[12].set_pixel(5, 4, lightYellow)
  2085.     @yellow_leaf_bitmaps[12].set_pixel(3, 5, midYellow)
  2086.     @yellow_leaf_bitmaps[12].set_pixel(4, 5, darkYellow)
  2087.     @yellow_leaf_bitmaps[12].fill_rect(5, 5, 2, 1, darkYellowtwo)
  2088.     @yellow_leaf_bitmaps[12].fill_rect(4, 6, 2, 1, midYellow)
  2089.     @yellow_leaf_bitmaps[12].set_pixel(6, 6, lightYellow)
  2090.     @yellow_leaf_bitmaps[12].set_pixel(6, 7, darkYellowtwo)
  2091.  
  2092. #-------------------------------------------------------------------------------   
  2093.     @sparkle_bitmaps = []
  2094.  
  2095.     lightBlue = Color.new(181, 244, 255, 255)
  2096.     midBlue   = Color.new(126, 197, 235, 255)
  2097.     darkBlue  = Color.new(77, 136, 225, 255)
  2098.  
  2099.     # 1st sparkle bitmap
  2100.     @sparkle_bitmaps[0] = Bitmap.new(7, 7)
  2101.     @sparkle_bitmaps[0].set_pixel(3, 3, darkBlue)
  2102.  
  2103.     # 2nd sparkle bitmap
  2104.     @sparkle_bitmaps[1] = Bitmap.new(7, 7)
  2105.     @sparkle_bitmaps[1].fill_rect(3, 2, 1, 3, darkBlue)
  2106.     @sparkle_bitmaps[1].fill_rect(2, 3, 3, 1, darkBlue)
  2107.     @sparkle_bitmaps[1].set_pixel(3, 3, midBlue)
  2108.  
  2109.     # 3rd sparkle bitmap
  2110.     @sparkle_bitmaps[2] = Bitmap.new(7, 7)
  2111.     @sparkle_bitmaps[2].set_pixel(1, 1, darkBlue)
  2112.     @sparkle_bitmaps[2].set_pixel(5, 1, darkBlue)
  2113.     @sparkle_bitmaps[2].set_pixel(2, 2, midBlue)
  2114.     @sparkle_bitmaps[2].set_pixel(4, 2, midBlue)
  2115.     @sparkle_bitmaps[2].set_pixel(3, 3, lightBlue)
  2116.     @sparkle_bitmaps[2].set_pixel(2, 4, midBlue)
  2117.     @sparkle_bitmaps[2].set_pixel(4, 4, midBlue)
  2118.     @sparkle_bitmaps[2].set_pixel(1, 5, darkBlue)
  2119.     @sparkle_bitmaps[2].set_pixel(5, 5, darkBlue)
  2120.  
  2121.     # 4th sparkle bitmap
  2122.     @sparkle_bitmaps[3] = Bitmap.new(7, 7)
  2123.     @sparkle_bitmaps[3].fill_rect(3, 1, 1, 5, darkBlue)
  2124.     @sparkle_bitmaps[3].fill_rect(1, 3, 5, 1, darkBlue)
  2125.     @sparkle_bitmaps[3].fill_rect(3, 2, 1, 3, midBlue)
  2126.     @sparkle_bitmaps[3].fill_rect(2, 3, 3, 1, midBlue)
  2127.     @sparkle_bitmaps[3].set_pixel(3, 3, lightBlue)
  2128.  
  2129.     # 5th sparkle bitmap
  2130.     @sparkle_bitmaps[4] = Bitmap.new(7, 7)
  2131.     @sparkle_bitmaps[4].fill_rect(2, 2, 3, 3, midBlue)
  2132.     @sparkle_bitmaps[4].fill_rect(3, 2, 1, 3, darkBlue)
  2133.     @sparkle_bitmaps[4].fill_rect(2, 3, 3, 1, darkBlue)
  2134.     @sparkle_bitmaps[4].set_pixel(3, 3, lightBlue)
  2135.     @sparkle_bitmaps[4].set_pixel(1, 1, darkBlue)
  2136.     @sparkle_bitmaps[4].set_pixel(5, 1, darkBlue)
  2137.     @sparkle_bitmaps[4].set_pixel(1, 5, darkBlue)
  2138.     @sparkle_bitmaps[4].set_pixel(5, 1, darkBlue)
  2139.  
  2140.     # 6th sparkle bitmap
  2141.     @sparkle_bitmaps[5] = Bitmap.new(7, 7)
  2142.     @sparkle_bitmaps[5].fill_rect(2, 1, 3, 5, darkBlue)
  2143.     @sparkle_bitmaps[5].fill_rect(1, 2, 5, 3, darkBlue)
  2144.     @sparkle_bitmaps[5].fill_rect(2, 2, 3, 3, midBlue)
  2145.     @sparkle_bitmaps[5].fill_rect(3, 1, 1, 5, midBlue)
  2146.     @sparkle_bitmaps[5].fill_rect(1, 3, 5, 1, midBlue)
  2147.     @sparkle_bitmaps[5].fill_rect(3, 2, 1, 3, lightBlue)
  2148.     @sparkle_bitmaps[5].fill_rect(2, 3, 3, 1, lightBlue)
  2149.     @sparkle_bitmaps[5].set_pixel(3, 3, white)
  2150.  
  2151.     # 7th sparkle bitmap
  2152.     @sparkle_bitmaps[6] = Bitmap.new(7, 7)
  2153.     @sparkle_bitmaps[6].fill_rect(2, 1, 3, 5, midBlue)
  2154.     @sparkle_bitmaps[6].fill_rect(1, 2, 5, 3, midBlue)
  2155.     @sparkle_bitmaps[6].fill_rect(3, 0, 1, 7, darkBlue)
  2156.     @sparkle_bitmaps[6].fill_rect(0, 3, 7, 1, darkBlue)
  2157.     @sparkle_bitmaps[6].fill_rect(2, 2, 3, 3, lightBlue)
  2158.     @sparkle_bitmaps[6].fill_rect(3, 2, 1, 3, midBlue)
  2159.     @sparkle_bitmaps[6].fill_rect(2, 3, 3, 1, midBlue)
  2160.     @sparkle_bitmaps[6].set_pixel(3, 3, white)
  2161. #-------------------------------------------------------------------------------   
  2162.     # Meteor bitmap
  2163.  
  2164.     @meteor_bitmap = Bitmap.new(14, 12)
  2165.     @meteor_bitmap.fill_rect(0, 8, 5, 4, paleOrange)
  2166.     @meteor_bitmap.fill_rect(1, 7, 6, 4, paleOrange)
  2167.     @meteor_bitmap.set_pixel(7, 8, paleOrange)
  2168.     @meteor_bitmap.fill_rect(1, 8, 2, 2, brightOrange)
  2169.     @meteor_bitmap.set_pixel(2, 7, brightOrange)
  2170.     @meteor_bitmap.fill_rect(3, 6, 2, 1, brightOrange)
  2171.     @meteor_bitmap.set_pixel(3, 8, brightOrange)
  2172.     @meteor_bitmap.set_pixel(3, 10, brightOrange)
  2173.     @meteor_bitmap.set_pixel(4, 9, brightOrange)
  2174.     @meteor_bitmap.fill_rect(5, 5, 1, 5, brightOrange)
  2175.     @meteor_bitmap.fill_rect(6, 4, 1, 5, brightOrange)
  2176.     @meteor_bitmap.fill_rect(7, 3, 1, 5, brightOrange)
  2177.     @meteor_bitmap.fill_rect(8, 6, 1, 2, brightOrange)
  2178.     @meteor_bitmap.set_pixel(9, 5, brightOrange)
  2179.     @meteor_bitmap.set_pixel(3, 8, midRed)
  2180.     @meteor_bitmap.fill_rect(4, 7, 1, 2, midRed)
  2181.     @meteor_bitmap.set_pixel(4, 5, midRed)
  2182.     @meteor_bitmap.set_pixel(5, 4, midRed)
  2183.     @meteor_bitmap.set_pixel(5, 6, midRed)
  2184.     @meteor_bitmap.set_pixel(6, 5, midRed)
  2185.     @meteor_bitmap.set_pixel(6, 7, midRed)
  2186.     @meteor_bitmap.fill_rect(7, 4, 1, 3, midRed)
  2187.     @meteor_bitmap.fill_rect(8, 3, 1, 3, midRed)
  2188.     @meteor_bitmap.fill_rect(9, 2, 1, 3, midRed)
  2189.     @meteor_bitmap.fill_rect(10, 1, 1, 3, midRed)
  2190.     @meteor_bitmap.fill_rect(11, 0, 1, 3, midRed)
  2191.     @meteor_bitmap.fill_rect(12, 0, 1, 2, midRed)
  2192.     @meteor_bitmap.set_pixel(13, 0, midRed)
  2193.  
  2194.     # Impact bitmap
  2195.  
  2196.     @impact_bitmap = Bitmap.new(22, 11)
  2197.     @impact_bitmap.fill_rect(0, 5, 1, 2, brightOrange)
  2198.     @impact_bitmap.set_pixel(1, 4, brightOrange)
  2199.     @impact_bitmap.set_pixel(1, 6, brightOrange)
  2200.     @impact_bitmap.set_pixel(2, 3, brightOrange)
  2201.     @impact_bitmap.set_pixel(2, 7, brightOrange)
  2202.     @impact_bitmap.set_pixel(3, 2, midRed)
  2203.     @impact_bitmap.set_pixel(3, 7, midRed)
  2204.     @impact_bitmap.set_pixel(4, 2, brightOrange)
  2205.     @impact_bitmap.set_pixel(4, 8, brightOrange)
  2206.     @impact_bitmap.set_pixel(5, 2, midRed)
  2207.     @impact_bitmap.fill_rect(5, 8, 3, 1, brightOrange)
  2208.     @impact_bitmap.set_pixel(6, 1, midRed)
  2209.     @impact_bitmap.fill_rect(7, 1, 8, 1, brightOrange)
  2210.     @impact_bitmap.fill_rect(7, 9, 8, 1, midRed)
  2211. #-------------------------------------------------------------------------------   
  2212.     # Flame meteor bitmap
  2213.  
  2214.     @flame_meteor_bitmap = Bitmap.new(14, 12)
  2215.     @flame_meteor_bitmap.fill_rect(0, 8, 5, 4, brightOrange)
  2216.     @flame_meteor_bitmap.fill_rect(1, 7, 6, 4, brightOrange)
  2217.     @flame_meteor_bitmap.set_pixel(7, 8, brightOrange)
  2218.     @flame_meteor_bitmap.fill_rect(1, 8, 2, 2, midYellow)
  2219.     @flame_meteor_bitmap.set_pixel(2, 7, midYellow)
  2220.     @flame_meteor_bitmap.fill_rect(3, 6, 2, 1, midYellow)
  2221.     @flame_meteor_bitmap.set_pixel(3, 8, midYellow)
  2222.     @flame_meteor_bitmap.set_pixel(3, 10, midYellow)
  2223.     @flame_meteor_bitmap.set_pixel(4, 9, midYellow)
  2224.     @flame_meteor_bitmap.fill_rect(5, 5, 1, 5, midYellow)
  2225.     @flame_meteor_bitmap.fill_rect(6, 4, 1, 5, midYellow)
  2226.     @flame_meteor_bitmap.fill_rect(7, 3, 1, 5, midYellow)
  2227.     @flame_meteor_bitmap.fill_rect(8, 6, 1, 2, midYellow)
  2228.     @flame_meteor_bitmap.set_pixel(9, 5, midYellow)
  2229.     @flame_meteor_bitmap.set_pixel(3, 8, lightYellow)
  2230.     @flame_meteor_bitmap.fill_rect(4, 7, 1, 2, lightYellowtwo)
  2231.     @flame_meteor_bitmap.set_pixel(4, 5, lightYellow)
  2232.     @flame_meteor_bitmap.set_pixel(5, 4, lightYellow)
  2233.     @flame_meteor_bitmap.set_pixel(5, 6, lightYellow)
  2234.     @flame_meteor_bitmap.set_pixel(6, 5, lightYellow)
  2235.     @flame_meteor_bitmap.set_pixel(6, 7, lightYellow)
  2236.     @flame_meteor_bitmap.fill_rect(7, 4, 1, 3, lightYellow)
  2237.     @flame_meteor_bitmap.fill_rect(8, 3, 1, 3, lightYellow)
  2238.     @flame_meteor_bitmap.fill_rect(9, 2, 1, 3, lightYellow)
  2239.     @flame_meteor_bitmap.fill_rect(10, 1, 1, 3, lightYellow)
  2240.     @flame_meteor_bitmap.fill_rect(11, 0, 1, 3, lightYellow)
  2241.     @flame_meteor_bitmap.fill_rect(12, 0, 1, 2, lightYellow)
  2242.     @flame_meteor_bitmap.set_pixel(13, 0, lightYellow)
  2243.  
  2244.     # Flame impact bitmap
  2245.  
  2246.     @flame_impact_bitmap = Bitmap.new(22, 11)
  2247.     @flame_impact_bitmap.fill_rect(0, 5, 1, 2, midYellow)
  2248.     @flame_impact_bitmap.set_pixel(1, 4, midYellow)
  2249.     @flame_impact_bitmap.set_pixel(1, 6, midYellow)
  2250.     @flame_impact_bitmap.set_pixel(2, 3, midYellow)
  2251.     @flame_impact_bitmap.set_pixel(2, 7, midYellow)
  2252.     @flame_impact_bitmap.set_pixel(3, 2, midYellow)
  2253.     @flame_impact_bitmap.set_pixel(3, 7, lightYellow)
  2254.     @flame_impact_bitmap.set_pixel(4, 2, brightOrange)
  2255.     @flame_impact_bitmap.set_pixel(4, 8, brightOrange)
  2256.     @flame_impact_bitmap.set_pixel(5, 2, lightYellow)
  2257.     @flame_impact_bitmap.fill_rect(5, 8, 3, 1, midYellow)
  2258.     @flame_impact_bitmap.set_pixel(6, 1, lightYellow)
  2259.     @flame_impact_bitmap.fill_rect(7, 1, 8, 1, midYellow)
  2260.     @flame_impact_bitmap.fill_rect(7, 9, 8, 1, lightYellow)
  2261. #-------------------------------------------------------------------------------   
  2262.  
  2263.     # Ash bitmaps
  2264.  
  2265.     @ash_bitmaps = []
  2266.     @ash_bitmaps[0] = Bitmap.new(3, 3)
  2267.     @ash_bitmaps[0].fill_rect(0, 1, 1, 3, lightGrey)
  2268.     @ash_bitmaps[0].fill_rect(1, 0, 3, 1, lightGrey)
  2269.     @ash_bitmaps[0].set_pixel(1, 1, white)
  2270.     @ash_bitmaps[1] = Bitmap.new(3, 3)
  2271.     @ash_bitmaps[1].fill_rect(0, 1, 1, 3, grey)
  2272.     @ash_bitmaps[1].fill_rect(1, 0, 3, 1, grey)
  2273.     @ash_bitmaps[1].set_pixel(1, 1, lightGrey)
  2274. #-------------------------------------------------------------------------------   
  2275.  
  2276.     # Bubble bitmaps
  2277.  
  2278.     @bubble_bitmaps = []
  2279.     darkBlue  = Color.new(77, 136, 225, 160)
  2280.     aqua = Color.new(197, 253, 254, 160)
  2281.     lavender = Color.new(225, 190, 244, 160)
  2282.  
  2283.     # first bubble bitmap
  2284.     @bubble_bitmaps[0] = Bitmap.new(24, 24)
  2285.     @bubble_bitmaps[0].fill_rect(0, 9, 24, 5, darkBlue)
  2286.     @bubble_bitmaps[0].fill_rect(1, 6, 22, 11, darkBlue)
  2287.     @bubble_bitmaps[0].fill_rect(2, 5, 20, 13, darkBlue)
  2288.     @bubble_bitmaps[0].fill_rect(3, 4, 18, 15, darkBlue)
  2289.     @bubble_bitmaps[0].fill_rect(4, 3, 16, 17, darkBlue)
  2290.     @bubble_bitmaps[0].fill_rect(5, 2, 14, 19, darkBlue)
  2291.     @bubble_bitmaps[0].fill_rect(6, 1, 12, 21, darkBlue)
  2292.     @bubble_bitmaps[0].fill_rect(9, 0, 5, 24, darkBlue)
  2293.     @bubble_bitmaps[0].fill_rect(2, 11, 20, 4, aqua)
  2294.     @bubble_bitmaps[0].fill_rect(3, 7, 18, 10, aqua)
  2295.     @bubble_bitmaps[0].fill_rect(4, 6, 16, 12, aqua)
  2296.     @bubble_bitmaps[0].fill_rect(5, 5, 14, 14, aqua)
  2297.     @bubble_bitmaps[0].fill_rect(6, 4, 12, 16, aqua)
  2298.     @bubble_bitmaps[0].fill_rect(9, 2, 4, 20, aqua)
  2299.     @bubble_bitmaps[0].fill_rect(5, 10, 1, 7, lavender)
  2300.     @bubble_bitmaps[0].fill_rect(6, 14, 1, 5, lavender)
  2301.     @bubble_bitmaps[0].fill_rect(7, 15, 1, 4, lavender)
  2302.     @bubble_bitmaps[0].fill_rect(8, 16, 1, 4, lavender)
  2303.     @bubble_bitmaps[0].fill_rect(9, 17, 1, 3, lavender)
  2304.     @bubble_bitmaps[0].fill_rect(10, 18, 4, 3, lavender)
  2305.     @bubble_bitmaps[0].fill_rect(14, 18, 1, 2, lavender)
  2306.     @bubble_bitmaps[0].fill_rect(13, 5, 4, 4, white)
  2307.     @bubble_bitmaps[0].fill_rect(14, 4, 2, 1, white)
  2308.     @bubble_bitmaps[0].set_pixel(17, 6, white)
  2309.  
  2310.     # second bubble bitmap
  2311.     @bubble_bitmaps[1] = Bitmap.new(14, 15)
  2312.     @bubble_bitmaps[1].fill_rect(0, 4, 14, 7, darkBlue)
  2313.     @bubble_bitmaps[1].fill_rect(1, 3, 12, 9, darkBlue)
  2314.     @bubble_bitmaps[1].fill_rect(2, 2, 10, 11, darkBlue)
  2315.     @bubble_bitmaps[1].fill_rect(3, 1, 8, 13, darkBlue)
  2316.     @bubble_bitmaps[1].fill_rect(5, 0, 4, 15, darkBlue)
  2317.     @bubble_bitmaps[1].fill_rect(1, 5, 12, 4, aqua)
  2318.     @bubble_bitmaps[1].fill_rect(2, 4, 10, 6, aqua)
  2319.     @bubble_bitmaps[1].fill_rect(3, 3, 8, 8, aqua)
  2320.     @bubble_bitmaps[1].fill_rect(4, 2, 6, 10, aqua)
  2321.     @bubble_bitmaps[1].fill_rect(1, 5, 12, 4, aqua)
  2322.     @bubble_bitmaps[1].fill_rect(3, 9, 1, 2, lavender)
  2323.     @bubble_bitmaps[1].fill_rect(4, 10, 1, 2, lavender)
  2324.     @bubble_bitmaps[1].fill_rect(5, 11, 4, 1, lavender)
  2325.     @bubble_bitmaps[1].fill_rect(6, 12, 2, 1, white)
  2326.     @bubble_bitmaps[1].fill_rect(8, 3, 2, 2, white)
  2327.     @bubble_bitmaps[1].set_pixel(7, 4, white)
  2328.     @bubble_bitmaps[1].set_pixel(8, 5, white)
  2329.  
  2330.     # Other option for bubbles
  2331.     @bubble2_bitmaps = Array.new
  2332.     darkSteelGray = Color.new(145, 150, 155, 160)
  2333.     midSteelGray = Color.new(180, 180, 185, 160)
  2334.     lightSteelGray = Color.new(225, 225, 235, 160)
  2335.     steelBlue = Color.new(145, 145, 165, 160)
  2336.     lightSteelBlue = Color.new(165, 170, 180, 160)
  2337.     transparentWhite = Color.new(255, 255, 255, 160)
  2338.  
  2339.     # first bubble 2 bitmap
  2340.     @bubble2_bitmaps[0] = Bitmap.new(6, 6)
  2341.     @bubble2_bitmaps[0].fill_rect(0, 0, 6, 6, darkSteelGray)
  2342.     @bubble2_bitmaps[0].fill_rect(0, 2, 6, 2, midSteelGray)
  2343.     @bubble2_bitmaps[0].fill_rect(2, 0, 2, 6, midSteelGray)
  2344.     @bubble2_bitmaps[0].fill_rect(2, 2, 2, 2, lightSteelGray)
  2345.  
  2346.     # second bubble 2 bitmap
  2347.     @bubble2_bitmaps[1] = Bitmap.new(8, 8)
  2348.     @bubble2_bitmaps[1].fill_rect(0, 2, 2, 4, steelBlue)
  2349.     @bubble2_bitmaps[1].fill_rect(2, 0, 4, 2, darkSteelGray)
  2350.     @bubble2_bitmaps[1].fill_rect(6, 2, 2, 2, darkSteelGray)
  2351.     @bubble2_bitmaps[1].fill_rect(2, 6, 2, 2, darkSteelGray)
  2352.     @bubble2_bitmaps[1].fill_rect(6, 4, 2, 2, midSteelGray)
  2353.     @bubble2_bitmaps[1].fill_rect(4, 6, 2, 2, midSteelGray)
  2354.     @bubble2_bitmaps[1].fill_rect(4, 4, 2, 2, lightSteelBlue)
  2355.     @bubble2_bitmaps[1].fill_rect(2, 4, 2, 2, lightSteelGray)
  2356.     @bubble2_bitmaps[1].fill_rect(4, 2, 2, 2, lightSteelGray)
  2357.     @bubble2_bitmaps[1].fill_rect(2, 2, 2, 2, transparentWhite)
  2358.  
  2359.     # third bubble 2 bitmap
  2360.     @bubble2_bitmaps[2] = Bitmap.new(8, 10)
  2361.     @bubble2_bitmaps[2].fill_rect(8, 2, 2, 4, steelBlue)
  2362.     @bubble2_bitmaps[2].fill_rect(2, 0, 8, 2, darkSteelGray)
  2363.     @bubble2_bitmaps[2].fill_rect(2, 6, 8, 2, darkSteelGray)
  2364.     @bubble2_bitmaps[2].fill_rect(4, 0, 2, 2, midSteelGray)
  2365.     @bubble2_bitmaps[2].fill_rect(4, 6, 2, 2, midSteelGray)
  2366.     @bubble2_bitmaps[2].fill_rect(0, 2, 2, 2, midSteelGray)
  2367.     @bubble2_bitmaps[2].fill_rect(0, 4, 2, 2, lightSteelBlue)
  2368.     @bubble2_bitmaps[2].fill_rect(2, 2, 6, 4, lightSteelGray)
  2369.     @bubble2_bitmaps[2].fill_rect(2, 2, 4, 2, transparentWhite)
  2370.     @bubble2_bitmaps[2].fill_rect(4, 4, 2, 2, transparentWhite)
  2371.  
  2372.     # fourth bubble 2 bitmap
  2373.     @bubble2_bitmaps[3] = Bitmap.new(14, 14)
  2374.     @bubble2_bitmaps[3].fill_rect(4, 0, 4, 2, steelBlue)
  2375.     @bubble2_bitmaps[3].fill_rect(0, 4, 2, 4, steelBlue)
  2376.     @bubble2_bitmaps[3].fill_rect(12, 4, 2, 4, steelBlue)
  2377.     @bubble2_bitmaps[3].fill_rect(8, 0, 2, 2, darkSteelGray)
  2378.     @bubble2_bitmaps[3].fill_rect(0, 6, 2, 2, darkSteelGray)
  2379.     @bubble2_bitmaps[3].fill_rect(12, 6, 2, 2, darkSteelGray)
  2380.     @bubble2_bitmaps[3].fill_rect(4, 12, 6, 2, darkSteelGray)
  2381.     @bubble2_bitmaps[3].fill_rect(8, 0, 2, 2, darkSteelGray)
  2382.     @bubble2_bitmaps[3].fill_rect(2, 2, 10, 10, midSteelGray)
  2383.     @bubble2_bitmaps[3].fill_rect(6, 12, 2, 2, midSteelGray)
  2384.     @bubble2_bitmaps[3].fill_rect(2, 4, 10, 6, lightSteelGray)
  2385.     @bubble2_bitmaps[3].fill_rect(4, 2, 2, 2, lightSteelGray)
  2386.     @bubble2_bitmaps[3].fill_rect(6, 10, 4, 2, lightSteelGray)
  2387.     @bubble2_bitmaps[3].fill_rect(6, 4, 2, 2, transparentWhite)
  2388.     @bubble2_bitmaps[3].fill_rect(4, 6, 2, 2, transparentWhite)
  2389. #-------------------------------------------------------------------------------
  2390.  
  2391.     # Water bombs bitmap
  2392.  
  2393.     @waterbomb_bitmap = Bitmap.new(8, 8)
  2394.     @waterbomb_bitmap.fill_rect(0, 2, 2, 4, aqua)
  2395.     @waterbomb_bitmap.fill_rect(2, 0, 4, 2, aqua)
  2396.     @waterbomb_bitmap.fill_rect(6, 2, 2, 2, aqua)
  2397.     @waterbomb_bitmap.fill_rect(2, 6, 2, 2, aqua)
  2398.     @waterbomb_bitmap.fill_rect(6, 4, 2, 2, aqua)
  2399.     @waterbomb_bitmap.fill_rect(4, 6, 2, 2, aqua)
  2400.     @waterbomb_bitmap.fill_rect(4, 4, 2, 2, aqua)
  2401.     @waterbomb_bitmap.fill_rect(2, 4, 2, 2, aqua)
  2402.     @waterbomb_bitmap.fill_rect(4, 2, 2, 2, aqua)
  2403.     @waterbomb_bitmap.fill_rect(2, 2, 2, 2, aqua)
  2404.  
  2405.  
  2406.     # Water bombs impact bitmap
  2407.  
  2408.     @waterbomb_impact_bitmap = Bitmap.new(8, 5)
  2409.     @waterbomb_impact_bitmap.fill_rect(1, 0, 6, 1, aqua)
  2410.     @waterbomb_impact_bitmap.fill_rect(1, 4, 6, 1, aqua)
  2411.     @waterbomb_impact_bitmap.fill_rect(0, 1, 1, 3, aqua)
  2412.     @waterbomb_impact_bitmap.fill_rect(7, 1, 1, 3, aqua)
  2413.     @waterbomb_impact_bitmap.set_pixel(1, 0, aqua)
  2414.     @waterbomb_impact_bitmap.set_pixel(0, 1, aqua)
  2415. #-------------------------------------------------------------------------------
  2416.  
  2417.  
  2418.     # Icy bombs bitmap
  2419.  
  2420.     @icybomb_bitmap = Bitmap.new(8, 8)
  2421.     @icybomb_bitmap.fill_rect(0, 2, 2, 4, lightBlue)
  2422.     @icybomb_bitmap.fill_rect(2, 0, 4, 2, lightBlue)
  2423.     @icybomb_bitmap.fill_rect(6, 2, 2, 2, lightBlue)
  2424.     @icybomb_bitmap.fill_rect(2, 6, 2, 2, lightBlue)
  2425.     @icybomb_bitmap.fill_rect(6, 4, 2, 2, lightBlue)
  2426.     @icybomb_bitmap.fill_rect(4, 6, 2, 2, lightBlue)
  2427.     @icybomb_bitmap.fill_rect(4, 4, 2, 2, lightBlue)
  2428.     @icybomb_bitmap.fill_rect(2, 4, 2, 2, lightBlue)
  2429.     @icybomb_bitmap.fill_rect(4, 2, 2, 2, lightBlue)
  2430.     @icybomb_bitmap.fill_rect(2, 2, 2, 2, lightBlue)
  2431.  
  2432.  
  2433.     # Icy bombs impact bitmap
  2434.  
  2435.     @icybomb_impact_bitmap = Bitmap.new(8, 5)
  2436.     @icybomb_impact_bitmap.fill_rect(1, 0, 6, 1, lightBlue)
  2437.     @icybomb_impact_bitmap.fill_rect(1, 4, 6, 1, lightBlue)
  2438.     @icybomb_impact_bitmap.fill_rect(0, 1, 1, 3, lightBlue)
  2439.     @icybomb_impact_bitmap.fill_rect(7, 1, 1, 3, lightBlue)
  2440.     @icybomb_impact_bitmap.set_pixel(1, 0, lightBlue)
  2441.     @icybomb_impact_bitmap.set_pixel(0, 1, lightBlue)
  2442. #-------------------------------------------------------------------------------
  2443.  
  2444.  
  2445.     # Flare bombs bitmap
  2446.  
  2447.     @flarebomb_bitmap = Bitmap.new(8, 8)
  2448.     @flarebomb_bitmap.fill_rect(0, 2, 2, 4, midYellow)
  2449.     @flarebomb_bitmap.fill_rect(2, 0, 4, 2, midYellow)
  2450.     @flarebomb_bitmap.fill_rect(6, 2, 2, 2, midYellow)
  2451.     @flarebomb_bitmap.fill_rect(2, 6, 2, 2, brightOrange)
  2452.     @flarebomb_bitmap.fill_rect(6, 4, 2, 2, brightOrange)
  2453.     @flarebomb_bitmap.fill_rect(4, 6, 2, 2, midYellow)
  2454.     @flarebomb_bitmap.fill_rect(4, 4, 2, 2, brightOrange)
  2455.     @flarebomb_bitmap.fill_rect(2, 4, 2, 2, midYellow)
  2456.     @flarebomb_bitmap.fill_rect(4, 2, 2, 2, midYellow)
  2457.     @flarebomb_bitmap.fill_rect(2, 2, 2, 2, midYellow)
  2458.  
  2459.     # Flare bomb impact bitmap
  2460.  
  2461.     @flarebomb_impact_bitmap = Bitmap.new(8, 5)
  2462.     @flarebomb_impact_bitmap.fill_rect(1, 0, 6, 1, brightOrange)
  2463.     @flarebomb_impact_bitmap.fill_rect(1, 4, 6, 1, brightOrange)
  2464.     @flarebomb_impact_bitmap.fill_rect(0, 1, 1, 3, midYellow)
  2465.     @flarebomb_impact_bitmap.fill_rect(7, 1, 1, 3, midYellow)
  2466.     @flarebomb_impact_bitmap.set_pixel(1, 0, midYellow)
  2467.     @flarebomb_impact_bitmap.set_pixel(0, 1, midYellow)
  2468. #-------------------------------------------------------------------------------
  2469.  
  2470.     # Starburst bitmaps
  2471.  
  2472.     @starburst_bitmaps = []
  2473.  
  2474.     starburst_yellow = Color.new(233, 210, 142, 255)
  2475.     starburst_yellowtwo = Color.new(219, 191, 95, 255)
  2476.     starburst_lightyellow = Color.new(242, 229, 190, 255)
  2477.     starburst_pink = Color.new(241, 185, 187, 255)
  2478.     starburst_red = Color.new(196, 55, 84, 255)
  2479.     starburst_redtwo = Color.new(178, 15, 56, 255)
  2480.     starburst_cyan = Color.new(189, 225, 242, 255)
  2481.     starburst_blue = Color.new(102, 181, 221, 255)
  2482.     starburst_bluetwo = Color.new(5, 88, 168, 255)
  2483.     starburst_lightgreen = Color.new(205, 246, 205, 255)
  2484.     starburst_green = Color.new(88, 221, 89, 255)
  2485.     starburst_greentwo = Color.new(44, 166, 0, 255)
  2486.     starburst_purple = Color.new(216, 197, 255, 255)
  2487.     starburst_violet = Color.new(155, 107, 255, 255)
  2488.     starburst_violettwo = Color.new(71, 0, 222, 255)
  2489.     starburst_lightorange = Color.new(255, 220, 177, 255)
  2490.     starburst_orange = Color.new(255, 180, 85, 255)
  2491.     starburst_orangetwo = Color.new(222, 124, 0, 255)
  2492.  
  2493.     # 1st starburst bitmap
  2494.     @starburst_bitmaps[0] = Bitmap.new(8, 8)
  2495.     @starburst_bitmaps[0].set_pixel(3, 3, starburst_lightyellow)
  2496.  
  2497.     # 2nd starburst bitmap
  2498.     @starburst_bitmaps[1] = Bitmap.new(8, 8)
  2499.     @starburst_bitmaps[1].fill_rect(3, 2, 1, 3, starburst_yellow)
  2500.     @starburst_bitmaps[1].fill_rect(2, 3, 3, 1, starburst_yellow)
  2501.     @starburst_bitmaps[1].set_pixel(3, 3, starburst_lightyellow)
  2502.  
  2503.     # 3rd starburst bitmap
  2504.     @starburst_bitmaps[2] = Bitmap.new(7, 7)
  2505.     @starburst_bitmaps[2].set_pixel(1, 1, starburst_yellow)
  2506.     @starburst_bitmaps[2].set_pixel(5, 1, starburst_yellow)
  2507.     @starburst_bitmaps[2].set_pixel(2, 2, starburst_yellowtwo)
  2508.     @starburst_bitmaps[2].set_pixel(4, 2, starburst_yellow)
  2509.     @starburst_bitmaps[2].set_pixel(3, 3, starburst_lightyellow)
  2510.     @starburst_bitmaps[2].set_pixel(2, 4, starburst_yellowtwo)
  2511.     @starburst_bitmaps[2].set_pixel(4, 4, starburst_yellowtwo)
  2512.     @starburst_bitmaps[2].set_pixel(1, 5, starburst_yellow)
  2513.     @starburst_bitmaps[2].set_pixel(5, 5, starburst_yellow)
  2514.  
  2515.     # 4th starburst bitmap
  2516.     @starburst_bitmaps[3] = Bitmap.new(7, 7)
  2517.     @starburst_bitmaps[3].fill_rect(3, 1, 1, 5, starburst_yellow)
  2518.     @starburst_bitmaps[3].fill_rect(1, 3, 5, 1, starburst_yellowtwo)
  2519.     @starburst_bitmaps[3].fill_rect(3, 2, 1, 3, starburst_yellow)
  2520.     @starburst_bitmaps[3].fill_rect(2, 3, 3, 1, starburst_yellowtwo)
  2521.     @starburst_bitmaps[3].set_pixel(3, 3, starburst_lightyellow)
  2522.  
  2523.     # 5th starburst bitmap
  2524.     @starburst_bitmaps[4] = Bitmap.new(7, 7)
  2525.     @starburst_bitmaps[4].fill_rect(2, 2, 3, 3, starburst_yellow)
  2526.     @starburst_bitmaps[4].fill_rect(3, 2, 1, 3, starburst_yellow)
  2527.     @starburst_bitmaps[4].fill_rect(2, 3, 3, 1, starburst_yellowtwo)
  2528.     @starburst_bitmaps[4].set_pixel(3, 3, starburst_lightyellow)
  2529.     @starburst_bitmaps[4].set_pixel(1, 1, starburst_yellow)
  2530.     @starburst_bitmaps[4].set_pixel(5, 1, starburst_yellow)
  2531.     @starburst_bitmaps[4].set_pixel(1, 5, starburst_yellowtwo)
  2532.     @starburst_bitmaps[4].set_pixel(5, 1, starburst_yellowtwo)
  2533.  
  2534.     # 6th starburst bitmap
  2535.     @starburst_bitmaps[5] = Bitmap.new(8, 8)
  2536.     @starburst_bitmaps[5].fill_rect(3, 2, 1, 3, starburst_yellow)
  2537.     @starburst_bitmaps[5].fill_rect(2, 3, 3, 1, starburst_yellow)
  2538.     @starburst_bitmaps[5].set_pixel(3, 3, starburst_lightyellow)
  2539.  
  2540.     # 7th starburst bitmap
  2541.     @starburst_bitmaps[6] = Bitmap.new(8, 8)
  2542.     @starburst_bitmaps[6].fill_rect(3, 2, 1, 3, starburst_green)
  2543.     @starburst_bitmaps[6].fill_rect(2, 3, 3, 1, starburst_green)
  2544.     @starburst_bitmaps[6].set_pixel(3, 3, starburst_lightgreen)
  2545.  
  2546.     # 8th starburst bitmap
  2547.     @starburst_bitmaps[7] = Bitmap.new(7, 7)
  2548.     @starburst_bitmaps[7].set_pixel(1, 1, starburst_greentwo)
  2549.     @starburst_bitmaps[7].set_pixel(5, 1, starburst_greentwo)
  2550.     @starburst_bitmaps[7].set_pixel(2, 2, starburst_greentwo)
  2551.     @starburst_bitmaps[7].set_pixel(4, 2, starburst_greentwo)
  2552.     @starburst_bitmaps[7].set_pixel(3, 3, starburst_green)
  2553.     @starburst_bitmaps[7].set_pixel(2, 4, starburst_green)
  2554.     @starburst_bitmaps[7].set_pixel(4, 4, starburst_green)
  2555.     @starburst_bitmaps[7].set_pixel(1, 5, starburst_green)
  2556.     @starburst_bitmaps[7].set_pixel(5, 5, starburst_lightgreen)
  2557.  
  2558.     # 9th starburst bitmap
  2559.     @starburst_bitmaps[8] = Bitmap.new(7, 7)
  2560.     @starburst_bitmaps[8].fill_rect(3, 1, 1, 5, starburst_greentwo)
  2561.     @starburst_bitmaps[8].fill_rect(1, 3, 5, 1, starburst_greentwo)
  2562.     @starburst_bitmaps[8].fill_rect(3, 2, 1, 3, starburst_green)
  2563.     @starburst_bitmaps[8].fill_rect(2, 3, 3, 1, starburst_green)
  2564.     @starburst_bitmaps[8].set_pixel(3, 3, starburst_lightgreen)
  2565.  
  2566.     # 10th starburst bitmap
  2567.     @starburst_bitmaps[9] = Bitmap.new(7, 7)
  2568.     @starburst_bitmaps[9].fill_rect(2, 1, 3, 5, starburst_greentwo)
  2569.     @starburst_bitmaps[9].fill_rect(1, 2, 5, 3, starburst_greentwo)
  2570.     @starburst_bitmaps[9].fill_rect(2, 2, 3, 3, starburst_green)
  2571.     @starburst_bitmaps[9].fill_rect(3, 1, 1, 5, starburst_green)
  2572.     @starburst_bitmaps[9].fill_rect(1, 3, 5, 1, starburst_green)
  2573.     @starburst_bitmaps[9].fill_rect(3, 2, 1, 3, starburst_lightgreen)
  2574.     @starburst_bitmaps[9].fill_rect(2, 3, 3, 1, starburst_lightgreen)
  2575.     @starburst_bitmaps[9].set_pixel(3, 3, starburst_lightgreen)
  2576.  
  2577.     # 11en starburst bitmap
  2578.     @starburst_bitmaps[10] = Bitmap.new(7, 7)
  2579.     @starburst_bitmaps[10].fill_rect(2, 2, 3, 3, starburst_greentwo)
  2580.     @starburst_bitmaps[10].fill_rect(3, 2, 1, 3, starburst_greentwo)
  2581.     @starburst_bitmaps[10].fill_rect(2, 3, 3, 1, starburst_green)
  2582.     @starburst_bitmaps[10].set_pixel(3, 3, starburst_lightgreen)
  2583.     @starburst_bitmaps[10].set_pixel(1, 1, starburst_green)
  2584.     @starburst_bitmaps[10].set_pixel(5, 1, starburst_green)
  2585.     @starburst_bitmaps[10].set_pixel(1, 5, starburst_greentwo)
  2586.     @starburst_bitmaps[10].set_pixel(5, 1, starburst_greentwo)
  2587.  
  2588.     # 12en starburst bitmap
  2589.     @starburst_bitmaps[11] = Bitmap.new(8, 8)
  2590.     @starburst_bitmaps[11].fill_rect(3, 2, 1, 3, starburst_green)
  2591.     @starburst_bitmaps[11].fill_rect(2, 3, 3, 1, starburst_green)
  2592.     @starburst_bitmaps[11].set_pixel(3, 3, starburst_lightgreen)
  2593.  
  2594.     # 13en starburst bitmap
  2595.     @starburst_bitmaps[12] = Bitmap.new(8, 8)
  2596.     @starburst_bitmaps[12].fill_rect(3, 2, 1, 3, starburst_blue)
  2597.     @starburst_bitmaps[12].fill_rect(2, 3, 3, 1, starburst_blue)
  2598.     @starburst_bitmaps[12].set_pixel(3, 3, starburst_cyan)
  2599.  
  2600.     # 14en starburst bitmap
  2601.     @starburst_bitmaps[13] = Bitmap.new(7, 7)
  2602.     @starburst_bitmaps[13].set_pixel(1, 1, starburst_bluetwo)
  2603.     @starburst_bitmaps[13].set_pixel(5, 1, starburst_bluetwo)
  2604.     @starburst_bitmaps[13].set_pixel(2, 2, starburst_bluetwo)
  2605.     @starburst_bitmaps[13].set_pixel(4, 2, starburst_bluetwo)
  2606.     @starburst_bitmaps[13].set_pixel(3, 3, starburst_blue)
  2607.     @starburst_bitmaps[13].set_pixel(2, 4, starburst_blue)
  2608.     @starburst_bitmaps[13].set_pixel(4, 4, starburst_blue)
  2609.     @starburst_bitmaps[13].set_pixel(1, 5, starburst_blue)
  2610.     @starburst_bitmaps[13].set_pixel(5, 5, starburst_cyan)
  2611.  
  2612.     # 15en starburst bitmap
  2613.     @starburst_bitmaps[14] = Bitmap.new(7, 7)
  2614.     @starburst_bitmaps[14].fill_rect(3, 1, 1, 5, starburst_bluetwo)
  2615.     @starburst_bitmaps[14].fill_rect(1, 3, 5, 1, starburst_bluetwo)
  2616.     @starburst_bitmaps[14].fill_rect(3, 2, 1, 3, starburst_blue)
  2617.     @starburst_bitmaps[14].fill_rect(2, 3, 3, 1, starburst_blue)
  2618.     @starburst_bitmaps[14].set_pixel(3, 3, starburst_cyan)
  2619.  
  2620.     # 16en starburst bitmap
  2621.     @starburst_bitmaps[15] = Bitmap.new(7, 7)
  2622.     @starburst_bitmaps[15].fill_rect(2, 1, 3, 5, starburst_bluetwo)
  2623.     @starburst_bitmaps[15].fill_rect(1, 2, 5, 3, starburst_bluetwo)
  2624.     @starburst_bitmaps[15].fill_rect(2, 2, 3, 3, starburst_blue)
  2625.     @starburst_bitmaps[15].fill_rect(3, 1, 1, 5, starburst_blue)
  2626.     @starburst_bitmaps[15].fill_rect(1, 3, 5, 1, starburst_blue)
  2627.     @starburst_bitmaps[15].fill_rect(3, 2, 1, 3, starburst_cyan)
  2628.     @starburst_bitmaps[15].fill_rect(2, 3, 3, 1, starburst_cyan)
  2629.     @starburst_bitmaps[15].set_pixel(3, 3, starburst_cyan)
  2630.  
  2631.     # 17en starburst bitmap
  2632.     @starburst_bitmaps[16] = Bitmap.new(8, 8)
  2633.     @starburst_bitmaps[16].fill_rect(3, 2, 1, 3, starburst_blue)
  2634.     @starburst_bitmaps[16].fill_rect(2, 3, 3, 1, starburst_blue)
  2635.     @starburst_bitmaps[16].set_pixel(3, 3, starburst_cyan)
  2636.  
  2637.     # 18en starburst bitmap
  2638.     @starburst_bitmaps[17] = Bitmap.new(8, 8)
  2639.     @starburst_bitmaps[17].fill_rect(3, 2, 1, 3, starburst_violet)
  2640.     @starburst_bitmaps[17].fill_rect(2, 3, 3, 1, starburst_violet)
  2641.     @starburst_bitmaps[17].set_pixel(3, 3, starburst_purple)
  2642.  
  2643.     # 19en starburst bitmap
  2644.     @starburst_bitmaps[18] = Bitmap.new(7, 7)
  2645.     @starburst_bitmaps[18].set_pixel(1, 1, starburst_violettwo)
  2646.     @starburst_bitmaps[18].set_pixel(5, 1, starburst_violettwo)
  2647.     @starburst_bitmaps[18].set_pixel(2, 2, starburst_violettwo)
  2648.     @starburst_bitmaps[18].set_pixel(4, 2, starburst_violettwo)
  2649.     @starburst_bitmaps[18].set_pixel(3, 3, starburst_violet)
  2650.     @starburst_bitmaps[18].set_pixel(2, 4, starburst_violet)
  2651.     @starburst_bitmaps[18].set_pixel(4, 4, starburst_violet)
  2652.     @starburst_bitmaps[18].set_pixel(1, 5, starburst_violet)
  2653.     @starburst_bitmaps[18].set_pixel(5, 5, starburst_purple)
  2654.  
  2655.     # 20y starburst bitmap
  2656.     @starburst_bitmaps[19] = Bitmap.new(7, 7)
  2657.     @starburst_bitmaps[19].fill_rect(3, 1, 1, 5, starburst_violettwo)
  2658.     @starburst_bitmaps[19].fill_rect(1, 3, 5, 1, starburst_violettwo)
  2659.     @starburst_bitmaps[19].fill_rect(3, 2, 1, 3, starburst_violet)
  2660.     @starburst_bitmaps[19].fill_rect(2, 3, 3, 1, starburst_violet)
  2661.     @starburst_bitmaps[19].set_pixel(3, 3, starburst_violet)
  2662.  
  2663.     # 21st starburst bitmap
  2664.     @starburst_bitmaps[20] = Bitmap.new(7, 7)
  2665.     @starburst_bitmaps[20].fill_rect(2, 1, 3, 5, starburst_violettwo)
  2666.     @starburst_bitmaps[20].fill_rect(1, 2, 5, 3, starburst_violettwo)
  2667.     @starburst_bitmaps[20].fill_rect(2, 2, 3, 3, starburst_violet)
  2668.     @starburst_bitmaps[20].fill_rect(3, 1, 1, 5, starburst_violet)
  2669.     @starburst_bitmaps[20].fill_rect(1, 3, 5, 1, starburst_violet)
  2670.     @starburst_bitmaps[20].fill_rect(3, 2, 1, 3, starburst_purple)
  2671.     @starburst_bitmaps[20].fill_rect(2, 3, 3, 1, starburst_purple)
  2672.     @starburst_bitmaps[20].set_pixel(3, 3, starburst_purple)
  2673.  
  2674.     # 22nd starburst bitmap
  2675.     @starburst_bitmaps[21] = Bitmap.new(7, 7)
  2676.     @starburst_bitmaps[21].fill_rect(2, 1, 3, 5, starburst_violet)
  2677.     @starburst_bitmaps[21].fill_rect(1, 2, 5, 3, starburst_violet)
  2678.     @starburst_bitmaps[21].fill_rect(3, 0, 1, 7, starburst_violettwo)
  2679.     @starburst_bitmaps[21].fill_rect(0, 3, 7, 1, starburst_violettwo)
  2680.     @starburst_bitmaps[21].fill_rect(2, 2, 3, 3, starburst_purple)
  2681.     @starburst_bitmaps[21].fill_rect(3, 2, 1, 3, starburst_violet)
  2682.     @starburst_bitmaps[21].fill_rect(2, 3, 3, 1, starburst_violet)
  2683.     @starburst_bitmaps[21].set_pixel(3, 3, starburst_purple)
  2684.  
  2685.     # 23d starburst bitmap
  2686.     @starburst_bitmaps[22] = Bitmap.new(8, 8)
  2687.     @starburst_bitmaps[22].fill_rect(3, 2, 1, 3, starburst_violet)
  2688.     @starburst_bitmaps[22].fill_rect(2, 3, 3, 1, starburst_violet)
  2689.     @starburst_bitmaps[22].set_pixel(3, 3, starburst_purple)
  2690.  
  2691.     # 24th starburst bitmap
  2692.     @starburst_bitmaps[23] = Bitmap.new(8, 8)
  2693.     @starburst_bitmaps[23].fill_rect(3, 2, 1, 3, starburst_red)
  2694.     @starburst_bitmaps[23].fill_rect(2, 3, 3, 1, starburst_red)
  2695.     @starburst_bitmaps[23].set_pixel(3, 3, starburst_pink)
  2696.  
  2697.     # 25th starburst bitmap
  2698.     @starburst_bitmaps[24] = Bitmap.new(7, 7)
  2699.     @starburst_bitmaps[24].set_pixel(1, 1, starburst_redtwo)
  2700.     @starburst_bitmaps[24].set_pixel(5, 1, starburst_redtwo)
  2701.     @starburst_bitmaps[24].set_pixel(2, 2, starburst_redtwo)
  2702.     @starburst_bitmaps[24].set_pixel(4, 2, starburst_redtwo)
  2703.     @starburst_bitmaps[24].set_pixel(3, 3, starburst_red)
  2704.     @starburst_bitmaps[24].set_pixel(2, 4, starburst_red)
  2705.     @starburst_bitmaps[24].set_pixel(4, 4, starburst_red)
  2706.     @starburst_bitmaps[24].set_pixel(1, 5, starburst_red)
  2707.     @starburst_bitmaps[24].set_pixel(5, 5, starburst_pink)
  2708.  
  2709.     # 26th starburst bitmap
  2710.     @starburst_bitmaps[25] = Bitmap.new(7, 7)
  2711.     @starburst_bitmaps[25].fill_rect(3, 1, 1, 5, starburst_redtwo)
  2712.     @starburst_bitmaps[25].fill_rect(1, 3, 5, 1, starburst_redtwo)
  2713.     @starburst_bitmaps[25].fill_rect(3, 2, 1, 3, starburst_red)
  2714.     @starburst_bitmaps[25].fill_rect(2, 3, 3, 1, starburst_red)
  2715.     @starburst_bitmaps[25].set_pixel(3, 3, starburst_pink)
  2716.  
  2717.     # 27th starburst bitmap
  2718.     @starburst_bitmaps[26] = Bitmap.new(7, 7)
  2719.     @starburst_bitmaps[26].fill_rect(2, 1, 3, 5, starburst_redtwo)
  2720.     @starburst_bitmaps[26].fill_rect(1, 2, 5, 3, starburst_redtwo)
  2721.     @starburst_bitmaps[26].fill_rect(2, 2, 3, 3, starburst_red)
  2722.     @starburst_bitmaps[26].fill_rect(3, 1, 1, 5, starburst_red)
  2723.     @starburst_bitmaps[26].fill_rect(1, 3, 5, 1, starburst_red)
  2724.     @starburst_bitmaps[26].fill_rect(3, 2, 1, 3, starburst_pink)
  2725.     @starburst_bitmaps[26].fill_rect(2, 3, 3, 1, starburst_pink)
  2726.     @starburst_bitmaps[26].set_pixel(3, 3, starburst_pink)
  2727.  
  2728.     # 28th starburst bitmap
  2729.     @starburst_bitmaps[27] = Bitmap.new(7, 7)
  2730.     @starburst_bitmaps[27].fill_rect(2, 1, 3, 5, starburst_red)
  2731.     @starburst_bitmaps[27].fill_rect(1, 2, 5, 3, starburst_red)
  2732.     @starburst_bitmaps[27].fill_rect(3, 0, 1, 7, starburst_redtwo)
  2733.     @starburst_bitmaps[27].fill_rect(0, 3, 7, 1, starburst_redtwo)
  2734.     @starburst_bitmaps[27].fill_rect(2, 2, 3, 3, starburst_pink)
  2735.     @starburst_bitmaps[27].fill_rect(3, 2, 1, 3, starburst_red)
  2736.     @starburst_bitmaps[27].fill_rect(2, 3, 3, 1, starburst_red)
  2737.     @starburst_bitmaps[27].set_pixel(3, 3, starburst_pink)
  2738.  
  2739.     # 29th starburst bitmap
  2740.     @starburst_bitmaps[28] = Bitmap.new(8, 8)
  2741.     @starburst_bitmaps[28].fill_rect(3, 2, 1, 3, starburst_red)
  2742.     @starburst_bitmaps[28].fill_rect(2, 3, 3, 1, starburst_red)
  2743.     @starburst_bitmaps[28].set_pixel(3, 3, starburst_pink)
  2744.  
  2745.     # 30y starburst bitmap
  2746.     @starburst_bitmaps[29] = Bitmap.new(8, 8)
  2747.     @starburst_bitmaps[29].fill_rect(3, 2, 1, 3, starburst_orange)
  2748.     @starburst_bitmaps[29].fill_rect(2, 3, 3, 1, starburst_orange)
  2749.     @starburst_bitmaps[29].set_pixel(3, 3, starburst_lightorange)
  2750.  
  2751.     # 31st starburst bitmap
  2752.     @starburst_bitmaps[30] = Bitmap.new(7, 7)
  2753.     @starburst_bitmaps[30].set_pixel(1, 1, starburst_orangetwo)
  2754.     @starburst_bitmaps[30].set_pixel(5, 1, starburst_orangetwo)
  2755.     @starburst_bitmaps[30].set_pixel(2, 2, starburst_orangetwo)
  2756.     @starburst_bitmaps[30].set_pixel(4, 2, starburst_orangetwo)
  2757.     @starburst_bitmaps[30].set_pixel(3, 3, starburst_orange)
  2758.     @starburst_bitmaps[30].set_pixel(2, 4, starburst_orange)
  2759.     @starburst_bitmaps[30].set_pixel(4, 4, starburst_orange)
  2760.     @starburst_bitmaps[30].set_pixel(1, 5, starburst_orange)
  2761.     @starburst_bitmaps[30].set_pixel(5, 5, starburst_lightorange)
  2762.  
  2763.     # 32nd starburst bitmap
  2764.     @starburst_bitmaps[31] = Bitmap.new(7, 7)
  2765.     @starburst_bitmaps[31].fill_rect(3, 1, 1, 5, starburst_orangetwo)
  2766.     @starburst_bitmaps[31].fill_rect(1, 3, 5, 1, starburst_orangetwo)
  2767.     @starburst_bitmaps[31].fill_rect(3, 2, 1, 3, starburst_orange)
  2768.     @starburst_bitmaps[31].fill_rect(2, 3, 3, 1, starburst_orange)
  2769.     @starburst_bitmaps[31].set_pixel(3, 3, starburst_lightorange)
  2770.  
  2771.     # 33d starburst bitmap
  2772.     @starburst_bitmaps[32] = Bitmap.new(7, 7)
  2773.     @starburst_bitmaps[32].fill_rect(2, 1, 3, 5, starburst_orangetwo)
  2774.     @starburst_bitmaps[32].fill_rect(1, 2, 5, 3, starburst_orangetwo)
  2775.     @starburst_bitmaps[32].fill_rect(2, 2, 3, 3, starburst_orange)
  2776.     @starburst_bitmaps[32].fill_rect(3, 1, 1, 5, starburst_orange)
  2777.     @starburst_bitmaps[32].fill_rect(1, 3, 5, 1, starburst_orange)
  2778.     @starburst_bitmaps[32].fill_rect(3, 2, 1, 3, starburst_lightorange)
  2779.     @starburst_bitmaps[32].fill_rect(2, 3, 3, 1, starburst_lightorange)
  2780.     @starburst_bitmaps[32].set_pixel(3, 3, starburst_lightorange)
  2781.  
  2782.     # 34th starburst bitmap
  2783.     @starburst_bitmaps[33] = Bitmap.new(7, 7)
  2784.     @starburst_bitmaps[33].fill_rect(2, 1, 3, 5, starburst_orange)
  2785.     @starburst_bitmaps[33].fill_rect(1, 2, 5, 3, starburst_orange)
  2786.     @starburst_bitmaps[33].fill_rect(3, 0, 1, 7, starburst_orangetwo)
  2787.     @starburst_bitmaps[33].fill_rect(0, 3, 7, 1, starburst_orangetwo)
  2788.     @starburst_bitmaps[33].fill_rect(2, 2, 3, 3, starburst_lightorange)
  2789.     @starburst_bitmaps[33].fill_rect(3, 2, 1, 3, starburst_orange)
  2790.     @starburst_bitmaps[33].fill_rect(2, 3, 3, 1, starburst_orange)
  2791.     @starburst_bitmaps[33].set_pixel(3, 3, starburst_lightorange)
  2792.  
  2793.     # 35th starburst bitmap
  2794.     @starburst_bitmaps[34] = Bitmap.new(8, 8)
  2795.     @starburst_bitmaps[34].fill_rect(3, 2, 1, 3, starburst_orange)
  2796.     @starburst_bitmaps[34].fill_rect(2, 3, 3, 1, starburst_orange)
  2797.     @starburst_bitmaps[34].set_pixel(3, 3, starburst_lightorange)
  2798.  
  2799.     # 36th starburst bitmap
  2800.     @starburst_bitmaps[35] = Bitmap.new(8, 8)
  2801.     @starburst_bitmaps[35].set_pixel(3, 3, starburst_lightorange)   
  2802. #-------------------------------------------------------------------------------      
  2803.     @monostarburst_bitmaps = []
  2804.  
  2805.     # 1st starburst bitmap
  2806.     @monostarburst_bitmaps[0] = Bitmap.new(8, 8)
  2807.     @monostarburst_bitmaps[0].set_pixel(3, 3, starburst_lightyellow)
  2808.  
  2809.     # 2nd starburst bitmap
  2810.     @monostarburst_bitmaps[1] = Bitmap.new(8, 8)
  2811.     @monostarburst_bitmaps[1].fill_rect(3, 2, 1, 3, starburst_yellow)
  2812.     @monostarburst_bitmaps[1].fill_rect(2, 3, 3, 1, starburst_yellow)
  2813.     @monostarburst_bitmaps[1].set_pixel(3, 3, starburst_lightyellow)
  2814.  
  2815.     # 3d starburst bitmap
  2816.     @monostarburst_bitmaps[2] = Bitmap.new(7, 7)
  2817.     @monostarburst_bitmaps[2].set_pixel(1, 1, starburst_yellowtwo)
  2818.     @monostarburst_bitmaps[2].set_pixel(5, 1, starburst_yellowtwo)
  2819.     @monostarburst_bitmaps[2].set_pixel(2, 2, starburst_yellowtwo)
  2820.     @monostarburst_bitmaps[2].set_pixel(4, 2, starburst_yellowtwo)
  2821.     @monostarburst_bitmaps[2].set_pixel(3, 3, starburst_yellow)
  2822.     @monostarburst_bitmaps[2].set_pixel(2, 4, starburst_yellow)
  2823.     @monostarburst_bitmaps[2].set_pixel(4, 4, starburst_yellow)
  2824.     @monostarburst_bitmaps[2].set_pixel(1, 5, starburst_yellow)
  2825.     @monostarburst_bitmaps[2].set_pixel(5, 5, starburst_lightyellow)
  2826.  
  2827.     # 4th starburst bitmap
  2828.     @monostarburst_bitmaps[3] = Bitmap.new(7, 7)
  2829.     @monostarburst_bitmaps[3].fill_rect(3, 1, 1, 5, starburst_yellowtwo)
  2830.     @monostarburst_bitmaps[3].fill_rect(1, 3, 5, 1, starburst_yellowtwo)
  2831.     @monostarburst_bitmaps[3].fill_rect(3, 2, 1, 3, starburst_yellow)
  2832.     @monostarburst_bitmaps[3].fill_rect(2, 3, 3, 1, starburst_yellow)
  2833.     @monostarburst_bitmaps[3].set_pixel(3, 3, starburst_lightyellow)
  2834.  
  2835.     # 5th starburst bitmap
  2836.     @monostarburst_bitmaps[4] = Bitmap.new(7, 7)
  2837.     @monostarburst_bitmaps[4].fill_rect(2, 1, 3, 5, starburst_yellowtwo)
  2838.     @monostarburst_bitmaps[4].fill_rect(1, 2, 5, 3, starburst_yellowtwo)
  2839.     @monostarburst_bitmaps[4].fill_rect(2, 2, 3, 3, starburst_yellow)
  2840.     @monostarburst_bitmaps[4].fill_rect(3, 1, 1, 5, starburst_yellow)
  2841.     @monostarburst_bitmaps[4].fill_rect(1, 3, 5, 1, starburst_yellow)
  2842.     @monostarburst_bitmaps[4].fill_rect(3, 2, 1, 3, starburst_lightyellow)
  2843.     @monostarburst_bitmaps[4].fill_rect(2, 3, 3, 1, starburst_lightyellow)
  2844.     @monostarburst_bitmaps[4].set_pixel(3, 3, starburst_lightyellow)
  2845.  
  2846.     # 6th starburst bitmap
  2847.     @monostarburst_bitmaps[5] = Bitmap.new(7, 7)
  2848.     @monostarburst_bitmaps[5].fill_rect(2, 1, 3, 5, starburst_yellow)
  2849.     @monostarburst_bitmaps[5].fill_rect(1, 2, 5, 3, starburst_yellow)
  2850.     @monostarburst_bitmaps[5].fill_rect(3, 0, 1, 7, starburst_yellowtwo)
  2851.     @monostarburst_bitmaps[5].fill_rect(0, 3, 7, 1, starburst_yellowtwo)
  2852.     @monostarburst_bitmaps[5].fill_rect(2, 2, 3, 3, starburst_lightyellow)
  2853.     @monostarburst_bitmaps[5].fill_rect(3, 2, 1, 3, starburst_yellow)
  2854.     @monostarburst_bitmaps[5].fill_rect(2, 3, 3, 1, starburst_yellow)
  2855.     @monostarburst_bitmaps[5].set_pixel(3, 3, starburst_lightyellow)
  2856.  
  2857.     # 7th starburst bitmap
  2858.     @monostarburst_bitmaps[6] = Bitmap.new(8, 8)
  2859.     @monostarburst_bitmaps[6].fill_rect(3, 2, 1, 3, starburst_yellow)
  2860.     @monostarburst_bitmaps[6].fill_rect(2, 3, 3, 1, starburst_yellow)
  2861.     @monostarburst_bitmaps[6].set_pixel(3, 3, starburst_lightyellow)
  2862.  
  2863.     # 8th starburst bitmap
  2864.     @monostarburst_bitmaps[7] = Bitmap.new(8, 8)
  2865.     @monostarburst_bitmaps[7].set_pixel(3, 3, starburst_lightyellow)
  2866. #-------------------------------------------------------------------------------   
  2867.  
  2868.     @user_bitmaps = []
  2869.     update_user_defined
  2870.   end
  2871.  
  2872.   def update_user_defined
  2873.     for image in @user_bitmaps
  2874.       image.dispose
  2875.     end
  2876.  
  2877.     #user-defined bitmaps
  2878.     for name in $WEATHER_IMAGES
  2879.       @user_bitmaps.push(RPG::Cache.picture(name))
  2880.     end
  2881.     for sprite in @sprites
  2882.       sprite.bitmap = @user_bitmaps[rand(@user_bitmaps.size)]
  2883.     end
  2884.   end
  2885. end
  2886.  
  2887. class Scene_Map
  2888.   def change_weather
  2889.     @spriteset.change_weather  
  2890.   end
  2891. end
  2892.  
  2893. class Spriteset_Map
  2894.   attr_accessor :change_weather
  2895. end


战斗天气:与上面那个能完美融合哦
RUBY 代码复制
  1. =begin
  2.       RGSS3
  3.       
  4.       ★ 戦闘内天候持ち越し ★
  5.  
  6.       天候を戦闘にも反映させます。
  7.       
  8.       ver1.00
  9.  
  10.       Last Update : 2011/12/17
  11.       12/17 : RGSS2からの移植
  12.       
  13.       ろかん   [url]http://kaisou-ryouiki.sakura.ne.jp/[/url]
  14. =end
  15.  
  16. #===================================
  17. #  ●設定箇所
  18. #===================================
  19. module BattleWeather
  20.   # 戦闘中に天候が変更された場合、戦闘後のマップにも反映させるかどうか
  21.   BCEMW = true
  22. end
  23. #===================================
  24. #  ここまで
  25. #===================================
  26.  
  27. $rsi ||= {}
  28. $rsi["戦闘内天候持ち越し"] = true
  29.  
  30. class Game_Screen
  31.   #--------------------------------------------------------------------------
  32.   # ● 公開インスタンス変数
  33.   #--------------------------------------------------------------------------
  34.   attr_writer   :weather_type
  35.   attr_writer   :weather_power
  36. end
  37.  
  38. class Game_Interpreter
  39.   #--------------------------------------------------------------------------
  40.   # ● 天候の設定   ※再定義
  41.   #--------------------------------------------------------------------------
  42.   def command_236
  43.     screen.change_weather(@params[0], @params[1], @params[2])
  44.     wait(@params[2]) if @params[3]
  45.   end
  46. end
  47.  
  48. class Spriteset_Battle
  49.   #--------------------------------------------------------------------------
  50.   # ● インクルード BattleWeather
  51.   #--------------------------------------------------------------------------
  52.   include BattleWeather
  53.   #--------------------------------------------------------------------------
  54.   # ● オブジェクト初期化
  55.   #--------------------------------------------------------------------------
  56.   alias battle_weather_initialize initialize
  57.   def initialize
  58.     battle_weather_initialize
  59.     create_weather
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # ● 天候の作成
  63.   #--------------------------------------------------------------------------
  64.   def create_weather
  65.     $game_troop.screen.weather_type = $game_map.screen.weather_type
  66.     $game_troop.screen.weather_power = $game_map.screen.weather_power
  67.     @weather = Spriteset_Weather.new(@viewport2)
  68.     @weather.update
  69.     Graphics.update
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● 解放
  73.   #--------------------------------------------------------------------------
  74.   alias battle_weather_dispose dispose
  75.   def dispose
  76.     if BCEMW
  77.       $game_map.screen.weather_type = @weather.type
  78.       $game_map.screen.weather_power = @weather.power
  79.     end
  80.     dispose_weather
  81.     battle_weather_dispose
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 天候の解放
  85.   #--------------------------------------------------------------------------
  86.   def dispose_weather
  87.     @weather.dispose
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # ● フレーム更新
  91.   #--------------------------------------------------------------------------
  92.   alias update_battle_weather update
  93.   def update
  94.     update_battle_weather
  95.     update_weather
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● 天候の更新
  99.   #--------------------------------------------------------------------------
  100.   def update_weather
  101.     if @weather
  102.       @weather.type = $game_troop.screen.weather_type
  103.       @weather.power = $game_troop.screen.weather_power
  104.       @weather.update
  105.     end
  106.   end
  107. end


状态信息
RUBY 代码复制
  1. # ステ―ト詳細確認ウィンドウ
  2. #
  3. # 戦闘時、パーティコマンドに付与されているステートの詳細を確認するためのコマンド
  4. # を追加します。
  5.  
  6. $imported_yana_scripts ||= {}
  7. $imported_yana_scripts["StateHelpWindow"] = true
  8.  
  9. module StateHelp
  10.   Buffs = {}
  11.   States = []
  12.  
  13. # 请按照下面的描写进行备注
  14.  
  15.   Buffs[[0,:up]] = "HP+25%,最高5级\n持续5回合"
  16.   Buffs[[1,:up]] = "MP+25%,最高5级\n持续5回合"
  17.   Buffs[[2,:up]] = "物攻+25%,最高5级\n持续5回合"
  18.   Buffs[[3,:up]] = "物防+25%,最高5级\n持续5回合"
  19.   Buffs[[4,:up]] = "魔攻+25%,最高5级\n持续5回合"
  20.   Buffs[[5,:up]] = "魔防+25%,最高5级\n持续5回合"
  21.   Buffs[[6,:up]] = "敏捷+25%,最高5级\n持续5回合"
  22.   Buffs[[7,:up]] = "幸运+25%,最高5级\n持续5回合"
  23.  
  24.   Buffs[[0,:down]] = "HP-25%,最高5级\n持续5回合"
  25.   Buffs[[1,:down]] = "MP-25%,最高5级\n持续5回合"
  26.   Buffs[[2,:down]] = "物攻-25%,最高5级\n持续5回合"
  27.   Buffs[[3,:down]] = "物防-25%,最高5级\n持续5回合"
  28.   Buffs[[4,:down]] = "魔攻-25%,最高5级\n持续5回合"
  29.   Buffs[[5,:down]] = "魔防-25%,最高5级\n持续5回合"
  30.   Buffs[[6,:down]] = "敏捷-25%,最高5级\n持续5回合"
  31.   Buffs[[7,:down]] = "幸运-25%,最高5级\n持续5回合"
  32.  
  33.   States[1]  = "无法战斗:死亡。"
  34.   States[2]  = "毒:生命再生-10%\n永续。"
  35.   States[3]  = "致盲:物理命中率-60%\n2~4回合。"
  36.   States[4]  = "沉默:无法使用技能\n2~3回合。"
  37.   States[5]  = "混乱:会攻击双方人物\n2~4回合。"
  38.   States[6]  = "睡眠:无法使用法术技能受到伤害立刻解除\n3~5回合。"
  39.   States[7]  = "麻痹:无法行动,不会闪避任何伤害30%解除\n4~6回合。"
  40.   States[8]  = "眩晕:无法行动,20%解除\n1~2回合。"
  41.   States[53]  = "秘剑:(被动技能)\n技能增加全属性值,减少伤害比例。永续。"
  42.   States[14]  = "体力再生:每回合回复5%体力值\n2回合。"
  43.   States[15]  = "魔力再生:每回合回复5%魔力值\n2回合。"
  44.   States[16]  = "特技再生:每回合回复5%特技值\n2回合。"
  45.   States[24]  = "免疫异常:免疫所有异常状态\n5回合。"
  46.   States[26]  = "月读:攻击附加多种异常状态\n2回合。"
  47.   States[25]  = "魔法回路:减少魔法消耗\n5回合。"
  48.   States[28]  = "雷电天牢:无法行动,每回合减少2%HP\n2回合。"
  49.   States[29]  = "血继限界:(被动技能)\n增加属性百分比,受到伤害反射中毒。永续。"
  50.   States[51]  = "禁锢:无法行动\n2回合。"
  51.   States[52]  = "压制:无法行动,全属性降低5%\n2回合。"
  52.   States[35]  = "仙人模式:增加2%HP MP 攻击 魔攻 防御 特防和5%再生率\n3-5回合。"
  53.   States[45]  = "焚烧:每回合扣除1%HP MP\n2-5回合。"
  54.   States[56]  = "石化:无法行动,增加被伤害值60%减少闪避率20%一定几率解除。\n2-4回合。"
  55.   States[57]  = "永恒睡眠:无法行动,增加150%防御特防和生命上限,增加再生率10%\n4回合。"
  56.   States[59]  = "失魂:无法使用任何类型的技能\n2回合。"
  57.   States[50]  = "王之宝库:增加2次普攻,每次普攻几率附加天之锁状态\n永续。"
  58.   States[48]  = "Gate of Babylon:增加一次普攻,25%增加一次行动\n永续。"
  59.   States[37]  = "仙人屏障:(被动技能)\n增加再生率,增加闪避率和反射率。永续。"
  60.   States[47]  = "圣灵:(被动技能)\n增加20%的攻击魔攻防御特防。永续。"
  61.   States[18]  = "魔法闪避:增加80%魔法闪避\n3回合。"
  62.   States[19]  = "魔法反射:增加80%魔法反射\n3回合。"
  63.   States[60]  = "技能延迟:释放延迟类技能会出现的1回合行动后解除\n1回合。"
  64.   States[58]  = "仙法*天牢:无法行动,每回合减少3%HP\n2-4回合。"
  65.   States[61]  = "无限月读:无法行动,减少全属性20%受到攻击10%会解除或等到6回合后。"
  66.   States[62]  = "神眼:(被动技能)增加暴击率和命中率10%减少魔法消耗20%并减少自身伤害\n永续。"
  67.   States[63]  = "虚弱:减少所有属性20%\n2回合。"
  68.   States[64]  = "连射模式:增加自身攻击次数2次,同时攻击会附加剧毒\n2回合。"
  69.   States[65]  = "神鹰之眼:被动技能:增加暴击率和攻击力15%。命中率30%\n每回合提供5能量暴击造成150%伤害。"
  70.   States[66]  = "免伤:获得减免伤害30%\n1回合。"
  71.   States[67]  = "轮回血印吸收:获得伤害吸收\n1回合。"
  72.   States[68]  = "仙法*轮回之力:大大提高自身的能力。"
  73.   States[69]  = "仙法*反印结:(被动技能)提高伤害反射10%\n永续。"
  74.   States[70]  = "灵魂掌控:(被动技能)提高免疫异常的能力\n永续。"
  75.   States[71]  = "魔法盾术:可以将法力来挡伤害。\n 1MP吸收15比率为50%。"
  76.   States[72]  = "阴之力:大幅度增加双抗,回血回蓝,免疫异常。\n3回合。"
  77.   States[73]  = "阳之力:大幅度增加双攻,增加暴击率,普攻附带虚弱。\n3回合。"
  78.   States[74]  = "免死:免疫死亡。\n1-2回合。"
  79.   States[75]  = "火系附加:攻击附加火属性。\n永续。"
  80.   States[76]  = "冰系附加:攻击附加冰属性。\n永续。"
  81.   States[77]  = "雷系附加:攻击附加雷属性。\n永续。"
  82.   States[78]  = "土系附加:攻击附加土属性。\n永续。"
  83.   States[79]  = "风系附加:攻击附加风属性。\n永续。"
  84.   States[80]  = "时空结界:暂停时间。\n3回合。"
  85.   States[80]  = "时空结界:暂停时间。\n3回合。"
  86.   States[81]  = "圣之时空:增加双抗10%并且增加治疗效果\n每次自己对队友(包括自己使用技能目标回血0-150)"
  87.   States[82]  = "魔之时空:增加双闪避,反击率10%,暴击率30%每回合扣除2%血量\n新被动:每次攻击敌人伤害增加30%+敏捷*2"
  88.   States[83]  = "时空人格变数:攻击附加各种非停止行动的状态。\n永续。"
  89.   States[84]  = "时空暂停:暂停时间。\n1-2回合。"
  90.   States[85]  = "时空倒流:死亡后直接复活。\n3回合。"
  91.   States[86]  = "燃烧时空盾:减少30%,减免蓝的10%伤害并且反射。\n3回合。"
  92.   States[87]  = "时空连接:将伤害连接,可以传达伤害。\n3回合。"
  93.   States[88]  = "被链接:将积蓄的伤害20%传达给这个单位。\n3回合。"
  94.   States[89]  = "永生本能:减少0-70%的伤害,危急生命每次扣血会回复血量。\n被动技能。"
  95.   States[90]  = "灼热之痕:减少命中、闪避、必杀率5%。\n2回合。"
  96.   States[91]  = "金:攻击附加敏捷*3的伤害。\n增加10%MP上限。"
  97.   States[92]  = "木:每次伤害回血。\n增加5%敏捷。"
  98.   States[93]  = "水:每次伤害回蓝。\n增加10%MP上限。"
  99.   States[94]  = "火:每次伤害附加双攻的伤害*2。\n增加双攻10%。"
  100.   States[95]  = "土:减少伤害,反射防御力*2的伤害。\n增加双抗10%。"
  101.   States[96]  = "反馈:受到伤害在回合结束时,给对方给予一定伤害。"
  102.   States[97]  = "嗜血收割:伤害增加1.5倍,提高80%双攻。\n2回合"
  103.   States[98]  = "狩猎打击:每回合扣血伤害值。\n2回合"
  104.   States[99]  = "强弩之翼攻击:增加攻击+敏捷的伤害。"
  105.   States[100]  = "强弩之翼防御:减少伤害,反射敏捷*2+防御*2的伤害。"
  106.   States[101]  = "强狙速影:攻击 敏捷 物抗提高30%。"
  107.   States[102]  = "空间回溯:2次行动后回复到之前的回血。"
  108.   States[103]  = "影杀:技能必定暴击"
  109.   States[104]  = "时空穿梭:10%几率行动两次,5%几率行动三次"
  110.   States[115]  = "灵魂掌控:减少强控几率30%"
  111.   States[116]  = "缭乱写轮眼:暴击+10%免伤+20%魔法消耗-20%命中+10%\n法强+50%物攻+50%法抗+50%"
  112.   States[117]  = "秘境之眼:多行动一次,暴击+20%命中+20%"
  113.   States[118]  = "光明降生:每回合回血300回蓝100"
  114.   States[125]  = "空间折叠:必杀闪避,物理闪避,魔法闪避+10%\n3回合内每回合回复50+0-200血量"
  115.   States[126]  = "空间结界:免疫基础强控"
  116.   States[127]  = "幻术*魔镜幻巷:15%多行动一次,免疫剧毒沉默睡眠焚烧"
  117.   States[132]  = "六道之力:增加物品掉落几率和金币双倍\n增加恢复能力,每次攻击随机获得三回治疗"
  118.   States[133]  = "混沌之力:攻击附加双方全属性"
  119.   States[134]  = "时空掌握:附加15%暴击率和命中率,5%反射力"
  120.   States[135]  = "时空混乱:每回合扣除全属性的血量"
  121.  
  122.  
  123.  
  124. end
  125.  
  126. class Game_BattlerBase
  127.   attr_reader :buffs
  128. end
  129.  
  130. class Window_State < Window_Selectable
  131.   def initialize(help_window)
  132.     super(0,0,32,32)
  133. #~     self.x = [Graphics.width / 2 - self.width / 2,0].max
  134. #~     self.y = [Graphics.height / 2 - self.height / 2,help_window.height].max
  135.     self.openness = 0
  136.     @help_window = help_window
  137.     refresh
  138.   end
  139.   def all_battle_members;($game_party.battle_members + $game_troop.members).select{|m| m.exist? };end
  140.   def row_max;all_battle_members.size;end
  141.   def col_max
  142.     m = all_battle_members.max_by{|a| a.state_icons.size + a.buff_icons.size }
  143.     [m.state_icons.size + m.buff_icons.size,1].max
  144.   end
  145.   def item_max;row_max*col_max;end
  146.   def item_height; line_height + 2 ; end
  147.   def item_width; line_height + 2 ; end
  148.  
  149.   def fitting_window
  150.     self.height = item_height * row_max + standard_padding*2
  151.     self.width = 144+(col_max*item_width) + standard_padding*2
  152.     self.x = [Graphics.width / 2 - self.width / 2,0].max
  153.     self.y = [Graphics.height / 2 - self.height / 2,help_window.height].max
  154.   end
  155.   def refresh
  156.     fitting_window
  157.     make_data
  158.     create_contents
  159.     all_battle_members.each_with_index{|a,i|
  160.       draw_actor_name(a,0,i*item_height+1)
  161.       draw_text(128,i*item_height+1,20,line_height,":")
  162.       draw_icons(a, 144, i*item_height+1, contents.width - 144)
  163.     }
  164.   end
  165.  
  166.   def draw_icons(subject, x, y, width = 96)
  167.     icons = (subject.state_icons + subject.buff_icons)[0, width / item_width]
  168.     icons.each_with_index {|n, i| draw_icon(n, x + item_width * i, y) }
  169.   end
  170.  
  171.   def item_rect(index)
  172.     rect = Rect.new
  173.     rect.width = item_width
  174.     rect.height = item_height
  175.     rect.x = index % col_max * item_width + 143
  176.     rect.y = index / col_max * item_height
  177.     rect
  178.   end
  179.  
  180.   def update_help
  181.     @help_window.set_text(description)
  182.   end
  183.  
  184.   def make_data
  185.     @data = all_battle_members.inject([]){|r,m|
  186.       a = []
  187.       a += m.states.select{|st| st.icon_index != 0 }
  188.       bf = []
  189.       m.buffs.each_with_index{|b,i| bf.push([i,b > 0 ? :up : :down]) if b != 0}
  190.       a += bf
  191.       a += Array.new(col_max - a.size){nil} if col_max > a.size
  192.       r += a
  193.     }
  194.   end
  195.  
  196.   def description
  197.     return "" unless @data[index]
  198.     if @data[index].is_a?(Array)
  199.       return StateHelp::Buffs[@data[index]]
  200.     else
  201.       return StateHelp::States[@data[index].id]
  202.     end
  203.   end
  204.   def cursor_down(wrap = false)
  205.     return if @data.compact.empty?
  206.     loop do
  207.       select((index + col_max) % item_max)
  208.       break if @data[index]
  209.     end
  210.   end
  211.   def cursor_up(wrap = false)
  212.     return if @data.compact.empty?
  213.     loop do
  214.       select((index - col_max + item_max) % item_max)
  215.       break if @data[index]
  216.     end
  217.   end
  218.   def cursor_right(wrap = false)
  219.     return if @data.compact.empty?
  220.     loop do
  221.       select((index + 1) % item_max)
  222.       break if @data[index]
  223.     end
  224.   end
  225.   def cursor_left(wrap = false)
  226.     return if @data.compact.empty?
  227.     loop do
  228.       select((index - 1 + item_max) % item_max)
  229.       break if @data[index]
  230.     end
  231.   end
  232.   def smooth_select
  233.     return select(0) if @data.compact.empty?
  234.     @data.each_with_index{|d,i|
  235.       if d
  236.         select(i)
  237.         return
  238.       end
  239.     }
  240.   end
  241. end
  242.  
  243. class Window_PartyCommand < Window_Command
  244.   alias _ex_state_make_command_list make_command_list
  245.   def make_command_list
  246.     _ex_state_make_command_list
  247.     add_command("状态信息",  :state)
  248.   end
  249. end
  250.  
  251. class Scene_Battle < Scene_Base
  252.   alias _ex_state_create_all_windows create_all_windows
  253.   def create_all_windows
  254.     _ex_state_create_all_windows
  255.     create_state_window
  256.   end
  257.   alias _ex_state_create_party_command_window create_party_command_window
  258.   def create_party_command_window
  259.     _ex_state_create_party_command_window
  260.     @party_command_window.set_handler(:state, method(:command_state))
  261.   end
  262.  
  263.   def create_state_window
  264.     @state_window = Window_State.new(@help_window)
  265.     @state_window.set_handler(:ok,  method(:command_state_cancel))
  266.     @state_window.set_handler(:cancel, method(:command_state_cancel))
  267.     @state_window.unselect
  268.   end
  269.  
  270.   def command_state
  271.     @party_command_window.deactivate
  272.     @state_window.refresh
  273.     @state_window.open.activate.smooth_select
  274.     @help_window.show
  275.   end
  276.  
  277.   def command_state_cancel
  278.     @state_window.deactivate.close.unselect
  279.     @party_command_window.activate
  280.     @help_window.hide
  281.   end
  282. end


随机技能
RUBY 代码复制
  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.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-RandomSkillInvoke"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2011.12.17 - Started Script and Finished.
  17. #
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # This script grants the option, that when designated skills with random
  22. # invokes are used, they have the ability to result in other skills (within the
  23. # skill's designated random pool). Only valid skills are capable of being used
  24. # (meaning that they must meet the conditions to be used).
  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. # Skill Notetags - These notetags go in the skills notebox in the database.
  34. # -----------------------------------------------------------------------------
  35. # <random invoke: x>举个例子比如在1号技能上备注<random invoke: 2>代表你使用1号技能可能会放1号技能或者2号技能
  36. # <random invoke: x, x>
  37. # This adds skill x to the random invoke pool (which includes the base skill
  38. # itself, too). When the base skill is used, it will random select from all of
  39. # the skills within the random invoke pool and use one. Only skills that meet
  40. # the requirements of being used can be selected (meaning the battler must have
  41. # sufficient MP costs, TP costs, no states that seal it, etc.). Multiples of
  42. # this tag may be used to add more skills, and multiples of the same skill may
  43. # be added to the random invoke pool.
  44. #
  45. #==============================================================================
  46. # ▼ Compatibility
  47. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  48. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  49. # it will run with RPG Maker VX without adjusting.
  50. #
  51. #==============================================================================
  52. # ▼ Editting anything past this point may potentially result in causing
  53. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  54. # halitosis so edit at your own risk.
  55. #==============================================================================
  56.  
  57. module YEA
  58.   module REGEXP
  59.   module SKILL
  60.  
  61.     RANDOM_INVOKE =
  62.       /<(?:RANDOM_INVOKE|random invoke):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  63.  
  64.   end # SKILL
  65.   end # REGEXP
  66. end # YEA
  67.  
  68. #==============================================================================
  69. # ■ DataManager
  70. #==============================================================================
  71.  
  72. module DataManager
  73.  
  74.   #--------------------------------------------------------------------------
  75.   # alias method: load_database
  76.   #--------------------------------------------------------------------------
  77.   class <<self; alias load_database_rsi load_database; end
  78.   def self.load_database
  79.     load_database_rsi
  80.     load_notetags_rsi
  81.   end
  82.  
  83.   #--------------------------------------------------------------------------
  84.   # new method: load_notetags_rsi
  85.   #--------------------------------------------------------------------------
  86.   def self.load_notetags_rsi
  87.     for skill in $data_skills
  88.       next if skill.nil?
  89.       skill.load_notetags_rsi
  90.     end
  91.   end
  92.  
  93. end # DataManager
  94.  
  95. #==============================================================================
  96. # ■ RPG::Skill
  97. #==============================================================================
  98.  
  99. class RPG::Skill < RPG::UsableItem
  100.  
  101.   #--------------------------------------------------------------------------
  102.   # public instance variables
  103.   #--------------------------------------------------------------------------
  104.   attr_accessor :random_invoke
  105.  
  106.   #--------------------------------------------------------------------------
  107.   # common cache: load_notetags_rsi
  108.   #--------------------------------------------------------------------------
  109.   def load_notetags_rsi
  110.     @random_invoke = []
  111.     #---
  112.     self.note.split(/[\r\n]+/).each { |line|
  113.       case line
  114.       #---
  115.       when YEA::REGEXP::SKILL::RANDOM_INVOKE
  116.         $1.scan(/\d+/).each { |num|
  117.         @random_invoke.push(num.to_i) if num.to_i > 0 }
  118.       #---
  119.       end
  120.     } # self.note.split
  121.     #---
  122.   end
  123.  
  124. end # RPG::Weapon
  125.  
  126. #==============================================================================
  127. # ■ Game_Battler
  128. #==============================================================================
  129.  
  130. class Game_Battler < Game_BattlerBase
  131.  
  132.   #--------------------------------------------------------------------------
  133.   # new method: invoke_random_skill
  134.   #--------------------------------------------------------------------------
  135.   def invoke_random_skill
  136.     return unless current_action.item.is_a?(RPG::Skill)
  137.     valid_skills = [current_action.item]
  138.     for random_skill_id in current_action.item.random_invoke
  139.       next unless usable?($data_skills[random_skill_id])
  140.       valid_skills.push($data_skills[random_skill_id])
  141.     end
  142.     skill_id = valid_skills.sample.id
  143.     current_action.set_skill(skill_id)
  144.   end
  145.  
  146. end # Game_Battler
  147.  
  148. #==============================================================================
  149. # ■ Scene_Battle
  150. #==============================================================================
  151.  
  152. class Scene_Battle < Scene_Base
  153.  
  154.   #--------------------------------------------------------------------------
  155.   # alias method: use_item
  156.   #--------------------------------------------------------------------------
  157.   alias scene_battle_use_item_rsi use_item
  158.   def use_item
  159.     @subject.invoke_random_skill
  160.     scene_battle_use_item_rsi
  161.   end
  162.  
  163. end # Scene_Battle
  164.  
  165. #==============================================================================
  166. #
  167. # ▼ End of File
  168. #
  169. #==============================================================================


敌人信息显示
RUBY 代码复制
  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.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-EnemyTargetInfo"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.01 - Bug Fixed: <scan info: all> didn't work properly.
  17. # 2011.12.30 - Bug Fixed: Crash when using Ace Battle Engine's F8 debug.
  18. # 2011.12.29 - Started Script and Finished.
  19. #
  20. #==============================================================================
  21. # ▼ Introduction
  22. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  23. # The enemy target info window can be activated in battle to show enemy data
  24. # at the bottom of the screen. Information can be revealed straight from the
  25. # start or requires the player to actively reveal the information on their own
  26. # through either defeating the enemies, using skills on them, or scanning them
  27. # in various ways produced by the script.
  28. #
  29. #==============================================================================
  30. # ▼ Instructions
  31. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  32. # To install this script, open up your script editor and copy/paste this script
  33. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  34. #
  35. # -----------------------------------------------------------------------------
  36. # Skill Notetags - These notetags go in the skill notebox in the database.
  37. # -----------------------------------------------------------------------------
  38. # <scan info: all>
  39. # This will scan the target enemy of all properties that are shown in the
  40. # comparison windows. Unless the enemy has a permanent hide tag, all of the
  41. # data becomes available.
  42. #
  43. # <scan info: parameters>
  44. # This will scan the target enemy's parameters and reveal them to the player
  45. # unless the enemy has a permanent hide tag.
  46. #
  47. # <scan info: elements>
  48. # This will scan the target enemy's elemental resistances and reveal them to
  49. # the player unless the enemy has a permanent hide tag.
  50. #
  51. # <scan info: states>
  52. # This will scan the target enemy's state resistances and reveal them to the
  53. # player unless the enemy has a permanent hide tag.
  54. #
  55. # <scan element: x>
  56. # <scan element: x, x>
  57. # This will scan the target enemy's elemental resistance for element x. Insert
  58. # multiple of these tags to scan more elements. If you have the automatic scan
  59. # element setting on in the module, all skills and items will automatically
  60. # scan whatever element the skill or item deals damage with innately.
  61. #
  62. # <scan state: x>
  63. # <scan state: x, x>
  64. # This will scan the target enemy's state resistance for element x. Insert
  65. # multiple of these tags to scan more states. If you have the automatic scan
  66. # state setting on in the module, all skills and items will automatically
  67. # scan whatever state the skill or item inflicts innately.
  68. #
  69. # -----------------------------------------------------------------------------
  70. # Item Notetags - These notetags go in the item notebox in the database.
  71. # -----------------------------------------------------------------------------
  72. # <scan info: all>
  73. # This will scan the target enemy of all properties that are shown in the
  74. # comparison windows. Unless the enemy has a permanent hide tag, all of the
  75. # data becomes available.
  76. #
  77. # <scan info: parameters>
  78. # This will scan the target enemy's parameters and reveal them to the player
  79. # unless the enemy has a permanent hide tag.
  80. #
  81. # <scan info: elements>
  82. # This will scan the target enemy's elemental resistances and reveal them to
  83. # the player unless the enemy has a permanent hide tag.
  84. #
  85. # <scan info: states>
  86. # This will scan the target enemy's state resistances and reveal them to the
  87. # player unless the enemy has a permanent hide tag.
  88. #
  89. # <scan element: x>
  90. # <scan element: x, x>
  91. # This will scan the target enemy's elemental resistance for element x. Insert
  92. # multiple of these tags to scan more elements. If you have the automatic scan
  93. # element setting on in the module, all skills and items will automatically
  94. # scan whatever element the skill or item deals damage with innately.
  95. #
  96. # <scan state: x>
  97. # <scan state: x, x>
  98. # This will scan the target enemy's state resistance for element x. Insert
  99. # multiple of these tags to scan more states. If you have the automatic scan
  100. # state setting on in the module, all skills and items will automatically
  101. # scan whatever state the skill or item inflicts innately.
  102. #
  103. # -----------------------------------------------------------------------------
  104. # Enemy Notetags - These notetags go in the enemies notebox in the database.
  105. # -----------------------------------------------------------------------------
  106. # <hide info: all>
  107. # <show info: all>
  108. # These notetags will set the enemy to either always hide all of their battle
  109. # information or to always show all of their info. The tags will override
  110. # each other if both are used simultaneously.
  111. #
  112. # <hide info: parameters>
  113. # <show info: parameters>
  114. # These notetags will set the enemy to either always hide their parameter
  115. # information or to always show their parameter info. The tags will override
  116. # each other if both are used simultaneously.
  117. #
  118. # <hide info: elements>
  119. # <show info: elements>
  120. # These notetags will set the enemy to either always hide their element
  121. # information or to always show their element info. The tags will override
  122. # each other if both are used simultaneously.
  123. #
  124. # <hide info: states>
  125. # <show info: states>
  126. # These notetags will set the enemy to either always hide their state
  127. # information or to always show their state info. The tags will override
  128. # each other if both are used simultaneously.
  129. #
  130. #==============================================================================
  131. # ▼ Compatibility
  132. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  133. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  134. # it will run with RPG Maker VX without adjusting.
  135. #
  136. # This script requires Yanfly Engine Ace - Ace Battle Engine v1.10+ and the
  137. # script must be placed under Ace Battle Engine in the script listing.
  138. #
  139. #==============================================================================
  140.  
  141. module YEA
  142.   module ENEMY_INFO
  143.  
  144.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  145.     # - Info Window Settings -
  146.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  147.     # These are the general settings revolving around the info windows shown in
  148.     # battle such as the sound effect played, the button used to open up the
  149.     # menus, the page orders, and the info text.
  150.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  151.     INFO_SFX = RPG::SE.new("Book2", 80, 150) # SFX played for Info Window.
  152.  
  153.     # Button used to toggle the Info Window. Keep in mind that L and R are
  154.     # used for moving between pages so it's best to not use those.
  155.     INFO_BUTTON = :SHIFT
  156.  
  157.     # This sets the page order in which data is displayed for the player. The
  158.     # player can switch pages by pressing L or R.
  159.     PAGE_ORDER =[
  160.       :parameters,
  161.       :elements,
  162.       :states,
  163.     ] # Do not remove this.
  164.  
  165.     # If testplay is being used, reveal all battle information for non-hidden
  166.     # enemy information?
  167.     SHOW_DEBUG_ALL = true
  168.  
  169.     # The follow adjusts the settings regarding the help window. If this
  170.     # setting is on, the the help info will be displayed.
  171.     SHOW_HELP_INFO = true
  172.     HELP_WINDOW_Y  = 72    # Y location of the help window.
  173.  
  174.     # This is the text displayed to let the player know how to activate and
  175.     # show the info windows.
  176.     HELP_INFO_SHOW = "\e}按 \eC[4]SHIFT键\eC[0] 查看信息."
  177.  
  178.     # This is the text displayed to let the player know how to switch between
  179.     # pages for the info windows.
  180.     HELP_INFO_SWITCH = "\e}按 \eC[4]L键\eC[0] or \eC[4]R键\eC[0] 查看其他信息."
  181.  
  182.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  183.     # - General Page Settings -
  184.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  185.     # The general page shows the stats of the battlers. The player can compare
  186.     # and contrast the stats of both battlers relative to each other. The
  187.     # settings here adjust the font size, the text displayed if parameters are
  188.     # hidden, and whether or not to show parameters by default?
  189.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  190.     PARAM_FONT_SIZE     = 20       # Font size used for parameters.
  191.     HIDDEN_PARAM_TEXT   = "???"    # Text used if parameters are hidden.
  192.  
  193.     # Show the parameters by default? If false, the enemy must be defeated once
  194.     # or scanned to show the those parameters.
  195.     DEFAULT_SHOW_PARAMS = false
  196.  
  197.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  198.     # - Element Page Settings -
  199.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  200.     # The elements page shows the elemental resistances of the battlers. The
  201.     # player can compare and contrast the resistances relative to each other.
  202.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  203.     ELE_FONT_SIZE   = 20       # Font size used for element resistances.
  204.     HIDDEN_ELE_TEXT = "???"    # Text used if element resistances are hidden.
  205.     SHOWN_ELEMENTS  = [3..10]  # Elements shown. Maximum of 8 can be shown.
  206.     ELEMENT_ICONS   ={         # Contains element icon information.
  207.     # Element ID => Icon,
  208.                3 =>  96, # Fire
  209.                4 =>  97, # Ice
  210.                5 =>  98, # Thunder
  211.                6 =>  99, # Water
  212.                7 => 100, # Earth
  213.                8 => 101, # Wind
  214.                9 => 102, # Holy
  215.               10 => 103, # Dark
  216.     } # Do not remove this.
  217.  
  218.     # Show the elemental resistances by default? If false, a skill with the
  219.     # specific element must be used on the enemy to reveal the element data if
  220.     # the AUTO_SCAN_ELEMENT setting is set to true.
  221.     DEFAULT_SHOW_ELEMENTS = false
  222.  
  223.     # If this is set to true, then skills with elemental properties will
  224.     # automatically scan the specific elemental resistance of that enemy type
  225.     # when used against that enemy.
  226.     AUTO_SCAN_ELEMENT = true
  227.  
  228.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  229.     # - States Page Settings -
  230.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  231.     # The states page shows the state resistances of the battlers. The player
  232.     # can compare and contrast the resistances relative to each other.
  233.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  234.     STATE_FONT_SIZE   = 20     # Font size used for state resistances.
  235.     HIDDEN_STATE_TEXT = "???"  # Text used if state resistances are hidden.
  236.     SHOWN_STATES = [7..14]     # States shown. Maximum of 8 can be shown.
  237.  
  238.     # Show the state resistances by default? If false, a skill with the
  239.     # specific state must be used on the enemy to reveal the element data if
  240.     # the AUTO_SCAN_STATES setting is set to true.
  241.     DEFAULT_SHOW_STATES = false
  242.  
  243.     # If this is set to true, then skills with state applying properties will
  244.     # automatically scan the specific state resistance of that enemy type
  245.     # when used against that enemy.
  246.     AUTO_SCAN_STATES = true
  247.  
  248.   end # ENEMY_INFO
  249. end # YEA
  250.  
  251. #==============================================================================
  252. # ▼ Editting anything past this point may potentially result in causing
  253. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  254. # halitosis so edit at your own risk.
  255. #==============================================================================
  256.  
  257. if $imported["YEA-BattleEngine"]
  258.  
  259. module YEA
  260.   module ENEMY_INFO
  261.     module_function
  262.     #--------------------------------------------------------------------------
  263.     # convert_integer_array
  264.     #--------------------------------------------------------------------------
  265.     def convert_integer_array(array)
  266.       result = []
  267.       array.each { |i|
  268.         case i
  269.         when Range; result |= i.to_a
  270.         when Integer; result |= [i]
  271.         end }
  272.       return result
  273.     end
  274.     #--------------------------------------------------------------------------
  275.     # converted_contants
  276.     #--------------------------------------------------------------------------
  277.     SHOWN_ELEMENTS = convert_integer_array(SHOWN_ELEMENTS)
  278.     SHOWN_STATES = convert_integer_array(SHOWN_STATES)
  279.   end # ENEMY_INFO
  280.   module REGEXP
  281.   module ENEMY
  282.  
  283.     HIDE_INFO = /<(?:HIDE_INFO|hide info):[ ](.*)>/i
  284.     SHOW_INFO = /<(?:SHOW_INFO|show info):[ ](.*)>/i
  285.  
  286.   end # ENEMY
  287.   module USABLEITEM
  288.  
  289.     SCAN_INFO = /<(?:SCAN_INFO|scan info):[ ](.*)>/i
  290.     SCAN_ELE = /<(?:SCAN_ELE|scan ele|scan element):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  291.     SCAN_STATE = /<(?:SCAN_STATE|scan state):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  292.  
  293.   end # USABLEITEM
  294.   end # REGEXP
  295. end # YEA
  296.  
  297. #==============================================================================
  298. # ■ Icon
  299. #==============================================================================
  300.  
  301. module Icon
  302.  
  303.   #--------------------------------------------------------------------------
  304.   # self.element
  305.   #--------------------------------------------------------------------------
  306.   def self.element(id)
  307.     return 0 unless YEA::ENEMY_INFO::ELEMENT_ICONS.include?(id)
  308.     return YEA::ENEMY_INFO::ELEMENT_ICONS[id]
  309.   end
  310.  
  311. end # Icon
  312.  
  313. #==============================================================================
  314. # ■ Numeric
  315. #==============================================================================
  316.  
  317. class Numeric
  318.  
  319.   #--------------------------------------------------------------------------
  320.   # new method: group_digits
  321.   #--------------------------------------------------------------------------
  322.   unless $imported["YEA-CoreEngine"]
  323.   def group; return self.to_s; end
  324.   end # $imported["YEA-CoreEngine"]
  325.  
  326. end # Numeric
  327.  
  328. #==============================================================================
  329. # ■ DataManager
  330. #==============================================================================
  331.  
  332. module DataManager
  333.  
  334.   #--------------------------------------------------------------------------
  335.   # alias method: load_database
  336.   #--------------------------------------------------------------------------
  337.   class <<self; alias load_database_eti load_database; end
  338.   def self.load_database
  339.     load_database_eti
  340.     load_notetags_etin
  341.   end
  342.  
  343.   #--------------------------------------------------------------------------
  344.   # new method: load_notetags_etin
  345.   #--------------------------------------------------------------------------
  346.   def self.load_notetags_etin
  347.     groups = [$data_enemies, $data_skills, $data_items]
  348.     for group in groups
  349.       for obj in group
  350.         next if obj.nil?
  351.         obj.load_notetags_etin
  352.       end
  353.     end
  354.   end
  355.  
  356. end # DataManager
  357.  
  358. #==============================================================================
  359. # ■ RPG::Enemy
  360. #==============================================================================
  361.  
  362. class RPG::Enemy < RPG::BaseItem
  363.  
  364.   #--------------------------------------------------------------------------
  365.   # public instance variables
  366.   #--------------------------------------------------------------------------
  367.   attr_accessor :hide_info
  368.   attr_accessor :show_info
  369.  
  370.   #--------------------------------------------------------------------------
  371.   # common cache: load_notetags_etin
  372.   #--------------------------------------------------------------------------
  373.   def load_notetags_etin
  374.     @hide_info = []
  375.     @show_info = []
  376.     #---
  377.     self.note.split(/[\r\n]+/).each { |line|
  378.       case line
  379.       #---
  380.       when YEA::REGEXP::ENEMY::HIDE_INFO
  381.         case $1.upcase
  382.         when "PARAM", "PARAMETER", "PARAMETERS"
  383.           @hide_info.push(:param)
  384.           @show_info.delete(:param)
  385.         when "ELE", "ELEMENT", "ELEMENTS"
  386.           @hide_info.push(:ele)
  387.           @show_info.delete(:ele)
  388.         when "STATE", "STATES"
  389.           @hide_info.push(:state)
  390.           @show_info.delete(:state)
  391.         when "ALL"
  392.           @hide_info.push(:all)
  393.           @show_info.delete(:all)
  394.         end
  395.       #---
  396.       when YEA::REGEXP::ENEMY::SHOW_INFO
  397.         case $1.upcase
  398.         when "PARAM", "PARAMETER", "PARAMETERS"
  399.           @show_info.push(:param)
  400.           @hide_info.delete(:param)
  401.         when "ELE", "ELEMENT", "ELEMENTS"
  402.           @show_info.push(:ele)
  403.           @hide_info.delete(:ele)
  404.         when "STATE", "STATES"
  405.           @show_info.push(:state)
  406.           @hide_info.delete(:state)
  407.         when "ALL"
  408.           @show_info.push(:all)
  409.           @hide_info.delete(:all)
  410.         end
  411.       #---
  412.       end
  413.     } # self.note.split
  414.     #---
  415.   end
  416.  
  417. end # RPG::Enemy
  418.  
  419. #==============================================================================
  420. # ■ RPG::UsableItem
  421. #==============================================================================
  422.  
  423. class RPG::UsableItem < RPG::BaseItem
  424.  
  425.   #--------------------------------------------------------------------------
  426.   # public instance variables
  427.   #--------------------------------------------------------------------------
  428.   attr_accessor :scan_info
  429.   attr_accessor :scan_ele
  430.   attr_accessor :scan_state
  431.  
  432.   #--------------------------------------------------------------------------
  433.   # common cache: load_notetags_etin
  434.   #--------------------------------------------------------------------------
  435.   def load_notetags_etin
  436.     @scan_info = []
  437.     @scan_ele = []
  438.     @scan_state = []
  439.     #---
  440.     self.note.split(/[\r\n]+/).each { |line|
  441.       case line
  442.       #---
  443.       when YEA::REGEXP::USABLEITEM::SCAN_INFO
  444.         case $1.upcase
  445.         when "PARAM", "PARAMETER", "PARAMETERS"
  446.           @scan_info.push(:param)
  447.         when "ELE", "ELEMENT", "ELEMENTS"
  448.           @scan_info.push(:ele)
  449.         when "STATE", "STATES"
  450.           @scan_info.push(:state)
  451.         when "ALL"
  452.           @scan_info.push(:all)
  453.         end
  454.       #---
  455.       when YEA::REGEXP::USABLEITEM::SCAN_ELE
  456.         $1.scan(/\d+/).each { |num|
  457.         @scan_ele.push(num.to_i) if num.to_i > 0 }
  458.       when YEA::REGEXP::USABLEITEM::SCAN_STATE
  459.         $1.scan(/\d+/).each { |num|
  460.         @scan_state.push(num.to_i) if num.to_i > 0 }
  461.       #---
  462.       end
  463.     } # self.note.split
  464.     #---
  465.     @scan_ele.push(self.damage.element_id) if YEA::ENEMY_INFO::AUTO_SCAN_ELEMENT
  466.     if YEA::ENEMY_INFO::AUTO_SCAN_STATES
  467.       for effect in @effects
  468.         next unless effect.code == 21
  469.         next unless effect.data_id > 0
  470.         @scan_state.push(effect.data_id)
  471.       end
  472.     end
  473.   end
  474.  
  475. end # RPG::UsableItem
  476.  
  477. #==============================================================================
  478. # ■ Game_System
  479. #==============================================================================
  480.  
  481. class Game_System
  482.  
  483.   #--------------------------------------------------------------------------
  484.   # alias method: initialize
  485.   #--------------------------------------------------------------------------
  486.   alias game_system_initialize_eti initialize
  487.   def initialize
  488.     game_system_initialize_eti
  489.     initialize_enemy_info_data
  490.   end
  491.  
  492.   #--------------------------------------------------------------------------
  493.   # new method: initialize_enemy_info_data
  494.   #--------------------------------------------------------------------------
  495.   def initialize_enemy_info_data
  496.     @param_enemies = [] if @param_enemies.nil?
  497.     @ele_enemies = {} if @ele_enemies.nil?
  498.     @state_enemies = {} if @state_enemies.nil?
  499.   end
  500.  
  501.   #--------------------------------------------------------------------------
  502.   # new method: info_param_enemies
  503.   #--------------------------------------------------------------------------
  504.   def info_param_enemies
  505.     initialize_enemy_info_data if @param_enemies.nil?
  506.     return @param_enemies
  507.   end
  508.  
  509.   #--------------------------------------------------------------------------
  510.   # new method: add_info_param_enemies
  511.   #--------------------------------------------------------------------------
  512.   def add_info_param_enemies(id)
  513.     initialize_enemy_info_data if @param_enemies.nil?
  514.     @param_enemies.push(id) unless @param_enemies.include?(id)
  515.   end
  516.  
  517.   #--------------------------------------------------------------------------
  518.   # new method: info_ele_enemies
  519.   #--------------------------------------------------------------------------
  520.   def info_ele_enemies(ele_id)
  521.     initialize_enemy_info_data if @ele_enemies.nil?
  522.     @ele_enemies[ele_id] = [] if @ele_enemies[ele_id].nil?
  523.     return @ele_enemies[ele_id]
  524.   end
  525.  
  526.   #--------------------------------------------------------------------------
  527.   # new method: add_info_ele_enemies
  528.   #--------------------------------------------------------------------------
  529.   def add_info_ele_enemies(ele_id, id)
  530.     initialize_enemy_info_data if @ele_enemies.nil?
  531.     @ele_enemies[ele_id] = [] if @ele_enemies[ele_id].nil?
  532.     @ele_enemies[ele_id].push(id) unless @ele_enemies[ele_id].include?(id)
  533.   end
  534.  
  535.   #--------------------------------------------------------------------------
  536.   # new method: info_state_enemies
  537.   #--------------------------------------------------------------------------
  538.   def info_state_enemies(state_id)
  539.     initialize_enemy_info_data if @state_enemies.nil?
  540.     @state_enemies[state_id] = [] if @state_enemies[state_id].nil?
  541.     return @state_enemies[state_id]
  542.   end
  543.  
  544.   #--------------------------------------------------------------------------
  545.   # new method: add_info_state_enemies
  546.   #--------------------------------------------------------------------------
  547.   def add_info_state_enemies(state_id, id)
  548.     initialize_enemy_info_data if @state_enemies.nil?
  549.     @state_enemies[state_id] = [] if @state_enemies[state_id].nil?
  550.     @state_enemies[state_id].push(id) if !@state_enemies[state_id].include?(id)
  551.   end
  552.  
  553. end # Game_System
  554.  
  555. #==============================================================================
  556. # ■ Game_BattlerBase
  557. #==============================================================================
  558.  
  559. class Game_BattlerBase
  560.  
  561.   #--------------------------------------------------------------------------
  562.   # new method: show_info_param?
  563.   #--------------------------------------------------------------------------
  564.   def show_info_param?
  565.     return true if YEA::ENEMY_INFO::SHOW_DEBUG_ALL && ($TEST || $BTEST)
  566.     return YEA::ENEMY_INFO::DEFAULT_SHOW_PARAMS
  567.   end
  568.  
  569.   #--------------------------------------------------------------------------
  570.   # new method: show_info_element?
  571.   #--------------------------------------------------------------------------
  572.   def show_info_element?(ele_id)
  573.     return true if YEA::ENEMY_INFO::SHOW_DEBUG_ALL && ($TEST || $BTEST)
  574.     return YEA::ENEMY_INFO::DEFAULT_SHOW_ELEMENTS
  575.   end
  576.  
  577.   #--------------------------------------------------------------------------
  578.   # new method: show_info_state?
  579.   #--------------------------------------------------------------------------
  580.   def show_info_state?(state_id)
  581.     return true if YEA::ENEMY_INFO::SHOW_DEBUG_ALL && ($TEST || $BTEST)
  582.     return YEA::ENEMY_INFO::DEFAULT_SHOW_STATES
  583.   end
  584.  
  585. end # Game_BattlerBase
  586.  
  587. #==============================================================================
  588. # ■ Game_Battler
  589. #==============================================================================
  590.  
  591. class Game_Battler < Game_BattlerBase
  592.  
  593.   #--------------------------------------------------------------------------
  594.   # alias method: die
  595.   #--------------------------------------------------------------------------
  596.   alias game_battler_die_eti die
  597.   def die
  598.     game_battler_die_eti
  599.     return if actor?
  600.     $game_system.add_info_param_enemies(@enemy_id)
  601.   end
  602.  
  603.   #--------------------------------------------------------------------------
  604.   # alias method: item_user_effect
  605.   #--------------------------------------------------------------------------
  606.   alias game_battler_item_user_effect_eti item_user_effect
  607.   def item_user_effect(user, item)
  608.     game_battler_item_user_effect_eti(user, item)
  609.     scan_enemy_info_effect(user, item)
  610.   end
  611.  
  612.   #--------------------------------------------------------------------------
  613.   # new method: scan_enemy_info_effect
  614.   #--------------------------------------------------------------------------
  615.   def scan_enemy_info_effect(user, item)
  616.     return if self.actor?
  617.     return unless user.actor?
  618.     #---
  619.     for info in item.scan_info
  620.       case info
  621.       when :all
  622.         $game_system.add_info_param_enemies(@enemy_id)
  623.         for i in 0...$data_system.elements.size
  624.           $game_system.add_info_ele_enemies(i, @enemy_id)
  625.         end
  626.         for i in 0...$data_states.size
  627.           $game_system.add_info_state_enemies(i, @enemy_id)
  628.         end
  629.       when :param
  630.         $game_system.add_info_param_enemies(@enemy_id)
  631.       when :ele
  632.         for i in 0...$data_system.elements.size
  633.           $game_system.add_info_ele_enemies(i, @enemy_id)
  634.         end
  635.       when :state
  636.         for i in 0...$data_states.size
  637.           $game_system.add_info_state_enemies(i, @enemy_id)
  638.         end
  639.       end
  640.     end
  641.     #---
  642.     for ele_id in item.scan_ele
  643.       $game_system.add_info_ele_enemies(ele_id, @enemy_id)
  644.     end
  645.     for state_id in item.scan_state
  646.       $game_system.add_info_state_enemies(state_id, @enemy_id)
  647.     end
  648.   end
  649.  
  650. end # Game_Battler
  651.  
  652. #==============================================================================
  653. # ■ Game_Actor
  654. #==============================================================================
  655.  
  656. class Game_Actor < Game_Battler
  657.  
  658.   #--------------------------------------------------------------------------
  659.   # new method: show_info_param?
  660.   #--------------------------------------------------------------------------
  661.   def show_info_param?
  662.     return true
  663.   end
  664.  
  665.   #--------------------------------------------------------------------------
  666.   # new method: show_info_element?
  667.   #--------------------------------------------------------------------------
  668.   def show_info_element?(ele_id)
  669.     return true
  670.   end
  671.  
  672.   #--------------------------------------------------------------------------
  673.   # new method: show_info_state?
  674.   #--------------------------------------------------------------------------
  675.   def show_info_state?(state_id)
  676.     return true
  677.   end
  678.  
  679. end # Game_Actor
  680.  
  681. #==============================================================================
  682. # ■ Game_Enemy
  683. #==============================================================================
  684.  
  685. class Game_Enemy < Game_Battler
  686.  
  687.   #--------------------------------------------------------------------------
  688.   # new method: show_info_param?
  689.   #--------------------------------------------------------------------------
  690.   def show_info_param?
  691.     return false if enemy.hide_info.include?(:param)
  692.     return false if enemy.hide_info.include?(:all)
  693.     return true if enemy.show_info.include?(:param)
  694.     return true if enemy.show_info.include?(:all)
  695.     return true if $game_system.info_param_enemies.include?(@enemy_id)
  696.     return super
  697.   end
  698.  
  699.   #--------------------------------------------------------------------------
  700.   # new method: show_info_element?
  701.   #--------------------------------------------------------------------------
  702.   def show_info_element?(ele_id)
  703.     return false if enemy.hide_info.include?(:ele)
  704.     return false if enemy.hide_info.include?(:all)
  705.     return true if enemy.show_info.include?(:ele)
  706.     return true if enemy.show_info.include?(:all)
  707.     return true if $game_system.info_ele_enemies(ele_id).include?(@enemy_id)
  708.     return super(ele_id)
  709.   end
  710.  
  711.   #--------------------------------------------------------------------------
  712.   # new method: show_info_state?
  713.   #--------------------------------------------------------------------------
  714.   def show_info_state?(state_id)
  715.     return false if enemy.hide_info.include?(:state)
  716.     return false if enemy.hide_info.include?(:all)
  717.     return true if enemy.show_info.include?(:state)
  718.     return true if enemy.show_info.include?(:all)
  719.     return true if $game_system.info_state_enemies(state_id).include?(@enemy_id)
  720.     return super(state_id)
  721.   end
  722.  
  723. end # Game_Enemy
  724.  
  725. #==============================================================================
  726. # ■ Window_Comparison
  727. #==============================================================================
  728.  
  729. class Window_Comparison < Window_Base
  730.  
  731.   #--------------------------------------------------------------------------
  732.   # initialize
  733.   #--------------------------------------------------------------------------
  734.   def initialize(type)
  735.     dx = type == :actor ? 0 : Graphics.width / 2
  736.     dh = fitting_height(4)
  737.     super(dx, Graphics.height - dh, Graphics.width / 2, dh)
  738.     @button = YEA::ENEMY_INFO::INFO_BUTTON
  739.     @battler = nil
  740.     @type = type
  741.     @page = 0
  742.     hide
  743.   end
  744.  
  745.   #--------------------------------------------------------------------------
  746.   # update
  747.   #--------------------------------------------------------------------------
  748.   def update
  749.     super
  750.     return unless @type == :enemy
  751.     process_enemy_window_input
  752.     return unless self.visible
  753.     reveal(SceneManager.scene.enemy_window.enemy)
  754.   end
  755.  
  756.   #--------------------------------------------------------------------------
  757.   # process_enemy_window_input
  758.   #--------------------------------------------------------------------------
  759.   def process_enemy_window_input
  760.     return unless SceneManager.scene_is?(Scene_Battle)
  761.     return unless SceneManager.scene.enemy_window.active
  762.     return if SceneManager.scene.enemy_window.select_all?
  763.     SceneManager.scene.toggle_enemy_info if Input.trigger?(@button)
  764.     return unless self.visible
  765.     SceneManager.scene.enemy_info_page_up if Input.trigger?(:L)
  766.     SceneManager.scene.enemy_info_page_down if Input.trigger?(:R)
  767.   end
  768.  
  769.   #--------------------------------------------------------------------------
  770.   # reveal
  771.   #--------------------------------------------------------------------------
  772.   def reveal(battler)
  773.     return if @battler == battler
  774.     @battler = battler
  775.     refresh
  776.     show
  777.   end
  778.  
  779.   #--------------------------------------------------------------------------
  780.   # clear
  781.   #--------------------------------------------------------------------------
  782.   def clear
  783.     @battler = nil
  784.     @page = 0
  785.     hide
  786.   end
  787.  
  788.   #--------------------------------------------------------------------------
  789.   # actor
  790.   #--------------------------------------------------------------------------
  791.   def actor; return BattleManager.actor; end
  792.  
  793.   #--------------------------------------------------------------------------
  794.   # enemy
  795.   #--------------------------------------------------------------------------
  796.   def enemy; return SceneManager.scene.enemy_window.enemy; end
  797.  
  798.   #--------------------------------------------------------------------------
  799.   # page_up
  800.   #--------------------------------------------------------------------------
  801.   def page_up
  802.     @page = @page == 0 ? YEA::ENEMY_INFO::PAGE_ORDER.size - 1 : @page - 1
  803.     refresh
  804.   end
  805.  
  806.   #--------------------------------------------------------------------------
  807.   # page_down
  808.   #--------------------------------------------------------------------------
  809.   def page_down
  810.     @page = @page == YEA::ENEMY_INFO::PAGE_ORDER.size - 1 ? 0 : @page + 1
  811.     refresh
  812.   end
  813.  
  814.   #--------------------------------------------------------------------------
  815.   # refresh
  816.   #--------------------------------------------------------------------------
  817.   def refresh
  818.     contents.clear
  819.     reset_font_settings
  820.     draw_page(@page)
  821.   end
  822.  
  823.   #--------------------------------------------------------------------------
  824.   # draw_page
  825.   #--------------------------------------------------------------------------
  826.   def draw_page(page_id)
  827.     return if @battler.nil?
  828.     case YEA::ENEMY_INFO::PAGE_ORDER[page_id]
  829.     when :parameters
  830.       @battler = actor if @type == :actor
  831.       draw_parameters
  832.     when :elements
  833.       @battler = enemy if @type == :actor
  834.       draw_parameters if @type == :actor
  835.       draw_elements if @type == :enemy
  836.     when :states
  837.       @battler = enemy if @type == :actor
  838.       draw_parameters if @type == :actor
  839.       draw_states if @type == :enemy
  840.     end
  841.   end
  842.  
  843.   #--------------------------------------------------------------------------
  844.   # draw_parameters
  845.   #--------------------------------------------------------------------------
  846.   def draw_parameters
  847.     draw_text(4, 0, contents.width, line_height, @battler.name)
  848.     dx = contents.width / 2
  849.     contents.font.size = YEA::ENEMY_INFO::PARAM_FONT_SIZE
  850.     draw_param(2, 0, line_height*1); draw_param(3, dx, line_height*1)
  851.     draw_param(4, 0, line_height*2); draw_param(5, dx, line_height*2)
  852.     draw_param(6, 0, line_height*3); draw_param(7, dx, line_height*3)
  853.   end
  854.  
  855.   #--------------------------------------------------------------------------
  856.   # draw_param
  857.   #--------------------------------------------------------------------------
  858.   def draw_param(param_id, dx, dy)
  859.     dw = contents.width / 2
  860.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  861.     rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
  862.     contents.fill_rect(rect, colour)
  863.     #---
  864.     change_color(system_color)
  865.     draw_text(dx+4, dy, dw-8, line_height, Vocab::param(param_id))
  866.     change_color(normal_color)
  867.     if @battler.show_info_param?
  868.       text = @battler.param(param_id).group
  869.     else
  870.       text = YEA::ENEMY_INFO::HIDDEN_PARAM_TEXT
  871.     end
  872.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  873.   end
  874.  
  875.   #--------------------------------------------------------------------------
  876.   # draw_elements
  877.   #--------------------------------------------------------------------------
  878.   def draw_elements
  879.     dx = 0; dy = 0
  880.     contents.font.size = YEA::ENEMY_INFO::ELE_FONT_SIZE
  881.     for ele_id in YEA::ENEMY_INFO::SHOWN_ELEMENTS
  882.       draw_element_info(ele_id, dx, dy)
  883.       dx = dx == 0 ? contents.width / 2 : 0
  884.       dy += dx == 0 ? line_height : 0
  885.     end
  886.   end
  887.  
  888.   #--------------------------------------------------------------------------
  889.   # draw_element_info
  890.   #--------------------------------------------------------------------------
  891.   def draw_element_info(ele_id, dx, dy)
  892.     dw = contents.width / 2
  893.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  894.     rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
  895.     contents.fill_rect(rect, colour)
  896.     #---
  897.     draw_icon(Icon.element(ele_id), dx, dy)
  898.     change_color(system_color)
  899.     draw_text(dx+24, dy, dw-24, line_height, $data_system.elements[ele_id])
  900.     change_color(normal_color)
  901.     if @battler.show_info_element?(ele_id)
  902.       text = sprintf("%d%%", (@battler.element_rate(ele_id) * 100).to_i)
  903.     else
  904.       text = YEA::ENEMY_INFO::HIDDEN_ELE_TEXT
  905.     end
  906.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  907.   end
  908.  
  909.   #--------------------------------------------------------------------------
  910.   # draw_states
  911.   #--------------------------------------------------------------------------
  912.   def draw_states
  913.     dx = 0; dy = 0
  914.     contents.font.size = YEA::ENEMY_INFO::ELE_FONT_SIZE
  915.     for state_id in YEA::ENEMY_INFO::SHOWN_STATES
  916.       draw_state_info(state_id, dx, dy)
  917.       dx = dx == 0 ? contents.width / 2 : 0
  918.       dy += dx == 0 ? line_height : 0
  919.     end
  920.   end
  921.  
  922.   #--------------------------------------------------------------------------
  923.   # draw_state_info
  924.   #--------------------------------------------------------------------------
  925.   def draw_state_info(state_id, dx, dy)
  926.     dw = contents.width / 2
  927.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  928.     rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
  929.     contents.fill_rect(rect, colour)
  930.     #---
  931.     draw_icon($data_states[state_id].icon_index, dx, dy)
  932.     change_color(system_color)
  933.     draw_text(dx+24, dy, dw-24, line_height, $data_states[state_id].name)
  934.     change_color(normal_color)
  935.     if @battler.show_info_state?(state_id)
  936.       text = sprintf("%d%%", (@battler.state_rate(state_id) * 100).to_i)
  937.     else
  938.       text = YEA::ENEMY_INFO::HIDDEN_STATE_TEXT
  939.     end
  940.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  941.   end
  942.  
  943. end # Window_Comparison
  944.  
  945. #==============================================================================
  946. # ■ Window_ComparisonHelp
  947. #==============================================================================
  948.  
  949. class Window_ComparisonHelp < Window_Base
  950.  
  951.   #--------------------------------------------------------------------------
  952.   # initialize
  953.   #--------------------------------------------------------------------------
  954.   def initialize(info_window)
  955.     dy = YEA::ENEMY_INFO::HELP_WINDOW_Y
  956.     super(-12, dy, Graphics.width + 24, fitting_height(1))
  957.     @info_window = info_window
  958.     self.opacity = 0
  959.     self.z = 300
  960.     @text = ""
  961.     hide
  962.   end
  963.  
  964.   #--------------------------------------------------------------------------
  965.   # update
  966.   #--------------------------------------------------------------------------
  967.   def update
  968.     super
  969.     return unless YEA::ENEMY_INFO::SHOW_HELP_INFO
  970.     update_visibility
  971.     update_text
  972.   end
  973.  
  974.   #--------------------------------------------------------------------------
  975.   # update_visibility
  976.   #--------------------------------------------------------------------------
  977.   def update_visibility
  978.     return unless SceneManager.scene_is?(Scene_Battle)
  979.     return if SceneManager.scene.enemy_window.select_all?
  980.     self.visible = SceneManager.scene.enemy_window.active
  981.   end
  982.  
  983.   #--------------------------------------------------------------------------
  984.   # update_text
  985.   #--------------------------------------------------------------------------
  986.   def update_text
  987.     return unless self.visible
  988.     if @info_window.visible
  989.       text = YEA::ENEMY_INFO::HELP_INFO_SWITCH
  990.     else
  991.       text = YEA::ENEMY_INFO::HELP_INFO_SHOW
  992.     end
  993.     return if @text == text
  994.     @text = text
  995.     refresh
  996.   end
  997.  
  998.   #--------------------------------------------------------------------------
  999.   # refresh
  1000.   #--------------------------------------------------------------------------
  1001.   def refresh
  1002.     contents.clear
  1003.     reset_font_settings
  1004.     draw_background
  1005.     draw_text_ex(4, 0, @text)
  1006.   end
  1007.  
  1008.   #--------------------------------------------------------------------------
  1009.   # draw_background
  1010.   #--------------------------------------------------------------------------
  1011.   def draw_background
  1012.     temp_rect = Rect.new(0, 0, contents.width / 2, contents.height)
  1013.     colour1 = Color.new(0, 0, 0, 192)
  1014.     colour2 = Color.new(0, 0, 0, 0)
  1015.     contents.gradient_fill_rect(temp_rect, colour1, colour2)
  1016.   end
  1017.  
  1018. end # Window_ComparisonHelp
  1019.  
  1020. #==============================================================================
  1021. # ■ Scene_Battle
  1022. #==============================================================================
  1023.  
  1024. class Scene_Battle < Scene_Base
  1025.  
  1026.   #--------------------------------------------------------------------------
  1027.   # alias method: create_all_windows
  1028.   #--------------------------------------------------------------------------
  1029.   alias scene_battle_create_all_windows_eti create_all_windows
  1030.   def create_all_windows
  1031.     scene_battle_create_all_windows_eti
  1032.     create_comparison_windows
  1033.   end
  1034.  
  1035.   #--------------------------------------------------------------------------
  1036.   # alias method: create_comparison_windows
  1037.   #--------------------------------------------------------------------------
  1038.   def create_comparison_windows
  1039.     @actor_info_window = Window_Comparison.new(:actor)
  1040.     @enemy_info_window = Window_Comparison.new(:enemy)
  1041.     @info_help_window = Window_ComparisonHelp.new(@enemy_info_window)
  1042.   end
  1043.  
  1044.   #--------------------------------------------------------------------------
  1045.   # new method: toggle_enemy_info
  1046.   #--------------------------------------------------------------------------
  1047.   def toggle_enemy_info
  1048.     YEA::ENEMY_INFO::INFO_SFX.play
  1049.     if @enemy_info_window.visible
  1050.       hide_comparison_windows
  1051.     else
  1052.       show_comparison_windows
  1053.     end
  1054.   end
  1055.  
  1056.   #--------------------------------------------------------------------------
  1057.   # new method: enemy_info_page_up
  1058.   #--------------------------------------------------------------------------
  1059.   def enemy_info_page_up
  1060.     YEA::ENEMY_INFO::INFO_SFX.play
  1061.     @actor_info_window.page_up
  1062.     @enemy_info_window.page_up
  1063.   end
  1064.  
  1065.   #--------------------------------------------------------------------------
  1066.   # new method: enemy_info_page_down
  1067.   #--------------------------------------------------------------------------
  1068.   def enemy_info_page_down
  1069.     YEA::ENEMY_INFO::INFO_SFX.play
  1070.     @actor_info_window.page_down
  1071.     @enemy_info_window.page_down
  1072.   end
  1073.  
  1074.   #--------------------------------------------------------------------------
  1075.   # alias method: on_enemy_ok
  1076.   #--------------------------------------------------------------------------
  1077.   alias scene_battle_on_enemy_ok_eti on_enemy_ok
  1078.   def on_enemy_ok
  1079.     hide_comparison_windows
  1080.     scene_battle_on_enemy_ok_eti
  1081.   end
  1082.  
  1083.   #--------------------------------------------------------------------------
  1084.   # alias method: on_enemy_cancel
  1085.   #--------------------------------------------------------------------------
  1086.   alias scene_battle_on_enemy_cancel_eti on_enemy_cancel
  1087.   def on_enemy_cancel
  1088.     hide_comparison_windows
  1089.     scene_battle_on_enemy_cancel_eti
  1090.   end
  1091.  
  1092.   #--------------------------------------------------------------------------
  1093.   # new method: show_comparison_windows
  1094.   #--------------------------------------------------------------------------
  1095.   def show_comparison_windows
  1096.     @actor_info_window.reveal(BattleManager.actor)
  1097.     @enemy_info_window.reveal(@enemy_window.enemy)
  1098.     @info_viewport.visible = false
  1099.     @skill_window.y = Graphics.height * 2
  1100.     @item_window.y = Graphics.height * 2
  1101.     @status_aid_window.y = Graphics.height * 2
  1102.   end
  1103.  
  1104.   #--------------------------------------------------------------------------
  1105.   # new method: hide_comparison_windows
  1106.   #--------------------------------------------------------------------------
  1107.   def hide_comparison_windows
  1108.     @actor_info_window.clear
  1109.     @enemy_info_window.clear
  1110.     @info_viewport.visible = true
  1111.     @skill_window.y = Graphics.height - @skill_window.height
  1112.     @item_window.y = Graphics.height - @item_window.height
  1113.     @status_aid_window.y = Graphics.height - @status_aid_window.height
  1114.   end
  1115.  
  1116. end # Scene_Battle
  1117.  
  1118. end # $imported["YEA-BattleEngine"]
  1119.  
  1120. #==============================================================================
  1121. #
  1122. # ▼ End of File
  1123. #
  1124. #==============================================================================


自己修改的精英敌人脚本(格式自己画葫芦就行)
RUBY 代码复制
  1. =begin
  2. # 精英敌人,作者:66RPG的tan12345
  3. # 功能:遇敌时,敌人有一定几率(可设定)变成精英,精英怪比普通怪属性有加成(可修改),
  4. #       当然了,精英怪的经验、金钱、掉落率也同样有加成。
  5. #       也可以设定指定的敌人不会变成精英(比如BOSS)
  6. #
  7. # 使用方法:将脚本插入到main上
  8. #
  9. =end
  10.  
  11. module Tan_by_enemy_set
  12.   #精英怪出现几率,30代表30%
  13.   Tan_enemy_by = 30
  14.   Tan_king_by = 10
  15.   Tan_god_by = 5
  16.   #Tan_enemy_by_num = 2 2倍属性
  17. #~ ##~   Tan_enemy_by_egold = 3 3倍金钱
  18. #   Tan_enemy_by_eexp = 3 3倍经验
  19. #~ ##~   Tan_enemy_by_edrop = 3 3倍掉落率
  20.   Tan_enemy_by_num = 1.25
  21.   Tan_enemy_by_egold = 1.25
  22.   Tan_enemy_by_eexp = 1.25
  23.   Tan_enemy_by_edrop = 1.25
  24.   Tan_king_num = 1.5
  25.   Tan_king_gold = 1.5
  26.   Tan_king_exp = 1.5
  27.   Tan_king_drop = 1.5
  28.   Tan_god_num = 2
  29.   Tan_god_gold = 2
  30.   Tan_god_exp = 2
  31.   Tan_god_drop = 2
  32.   #不会成为精英的敌人
  33.   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
  34. end
  35. class Game_Enemy < Game_Battler
  36.  
  37.   attr_reader   :is_by  # 是否精英
  38.   attr_reader   :is_king  # 是否精英
  39.   attr_reader   :is_god  # 是否精英
  40.  
  41.   #--------------------------------------------------------------------------
  42.   # ● 精英初始化
  43.   #--------------------------------------------------------------------------
  44.   def init_by_enemy
  45.     @is_by = false
  46.     @is_king = false
  47.     @is_god = false
  48.  
  49.     @is_by = true if rand(100) <= Tan_by_enemy_set::Tan_enemy_by && !Tan_by_enemy_set::NO_BY_ENEMY.include?(enemy_id)
  50.     @original_name = @original_name + "奇才" if @is_by == true
  51.  
  52.     @is_king = true if rand(100) <= Tan_by_enemy_set::Tan_king_by && !Tan_by_enemy_set::NO_BY_ENEMY.include?(enemy_id)
  53.     @original_name = @original_name + "王者" if @is_king == true
  54.  
  55.      @is_god = true if rand(100) <= Tan_by_enemy_set::Tan_god_by && !Tan_by_enemy_set::NO_BY_ENEMY.include?(enemy_id)
  56.     @original_name = @original_name + "神" if @is_god == true
  57.     @hp = mhp
  58.     @mp = mmp
  59.   end
  60.   #--------------------------------------------------------------------------
  61.   # ● 是否精英
  62.   #--------------------------------------------------------------------------
  63.   def is_by?
  64.     return true if @is_by
  65.     return false
  66.  
  67.   end
  68.  
  69.    def is_king?
  70.     return true if @is_king
  71.     return false
  72.   end
  73.    def is_god?
  74.     return true if @is_god
  75.     return false
  76.   end
  77.   #--------------------------------------------------------------------------
  78.   # ● 初始化对象
  79.   #--------------------------------------------------------------------------
  80.   alias tan_by_enemy_initialize initialize
  81.   def initialize(index, enemy_id)
  82.     tan_by_enemy_initialize(index, enemy_id)
  83.     init_by_enemy
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # ● 获取普通能力的基础值
  87.   #--------------------------------------------------------------------------
  88.   alias tan_by_enemy_param_base param_base
  89.   def param_base(param_id)
  90.     v = tan_by_enemy_param_base(param_id)
  91.     v *= Tan_by_enemy_set::Tan_enemy_by_num if is_by?
  92.     v *= Tan_by_enemy_set::Tan_king_num if is_king?
  93.     v *= Tan_by_enemy_set::Tan_god_num if is_god?
  94.     return v.to_i
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ● 获取经验值
  98.   #--------------------------------------------------------------------------
  99.   alias tan_by_enemy_exp exp
  100.   def exp
  101.     v = tan_by_enemy_exp
  102.     v *= Tan_by_enemy_set::Tan_enemy_by_eexp if is_by?
  103.     v *= Tan_by_enemy_set::Tan_king_exp if is_king?
  104.     v *= Tan_by_enemy_set::Tan_god_exp if is_god?
  105.     return v.to_i
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ● 获取金钱
  109.   #--------------------------------------------------------------------------
  110.   alias tan_by_enemy_gold gold
  111.   def gold
  112.     v = tan_by_enemy_gold
  113.     v *= Tan_by_enemy_set::Tan_enemy_by_egold if is_by?
  114.     v *= Tan_by_enemy_set::Tan_king_gold if is_king?
  115.     v *= Tan_by_enemy_set::Tan_god_gold if is_god?
  116.     return v.to_i
  117.   end
  118.   #--------------------------------------------------------------------------
  119.   # ● 获取物品掉率的倍率
  120.   #--------------------------------------------------------------------------
  121.   alias tan_by_enemy_drop_item_rate drop_item_rate
  122.   def drop_item_rate
  123.     v = tan_by_enemy_drop_item_rate
  124.     v *= Tan_by_enemy_set::Tan_enemy_by_edrop if is_by?
  125.     v *= Tan_by_enemy_set::Tan_king_drop if is_king?
  126.     v *= Tan_by_enemy_set::Tan_god_drop if is_god?
  127.     return v
  128.   end
  129. end


物品菜单强化
RUBY 代码复制
  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.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-ItemMenu"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.05 - Compatibility Update with Equip Dynamic Stats.
  17. # 2012.01.03 - Started Script and Finished.
  18. #            - Compatibility Update with Ace Menu Engine.
  19. #
  20. #==============================================================================
  21. # ▼ Introduction
  22. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  23. # The Ace Item Menu offers more item categorization control and a better layout
  24. # that simulatenously provides information regarding the items to the player,
  25. # while keeping a good amount of the item list visible on screen at once. The
  26. # script can also be customized to rearrange commands and categories.
  27. #
  28. #==============================================================================
  29. # ▼ Instructions
  30. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  31. # To install this script, open up your script editor and copy/paste this script
  32. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  33. #
  34. # -----------------------------------------------------------------------------
  35. # Item Notetags - These notetags go in the item notebox in the database.
  36. # -----------------------------------------------------------------------------
  37. # <category: string>
  38. # Places this object into the item category for "string". Whenever the selected
  39. # category is highlighted in the Ace Item Menu command window, this object will
  40. # be included and shown in the item window.
  41. #
  42. # <image: string>
  43. # Uses a picture from Graphics\Pictures\ of your RPG Maker VX Ace Project's
  44. # directory with the filename of "string" (without the extension) as the image
  45. # picture shown in the Ace Item Menu.
  46. #
  47. # -----------------------------------------------------------------------------
  48. # Weapon Notetags - These notetags go in the weapon notebox in the database.
  49. # -----------------------------------------------------------------------------
  50. # <category: string>
  51. # Places this object into the item category for "string". Whenever the selected
  52. # category is highlighted in the Ace Item Menu command window, this object will
  53. # be included and shown in the item window.
  54. #
  55. # <image: string>
  56. # Uses a picture from Graphics\Pictures\ of your RPG Maker VX Ace Project's
  57. # directory with the filename of "string" (without the extension) as the image
  58. # picture shown in the Ace Item Menu.
  59. #
  60. # -----------------------------------------------------------------------------
  61. # Armour Notetags - These notetags go in the armour notebox in the database.
  62. # -----------------------------------------------------------------------------
  63. # <category: string>
  64. # Places this object into the item category for "string". Whenever the selected
  65. # category is highlighted in the Ace Item Menu command window, this object will
  66. # be included and shown in the item window.
  67. #
  68. # <image: string>
  69. # Uses a picture from Graphics\Pictures\ of your RPG Maker VX Ace Project's
  70. # directory with the filename of "string" (without the extension) as the image
  71. # picture shown in the Ace Item Menu.
  72. #
  73. #==============================================================================
  74. # ▼ Compatibility
  75. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  76. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  77. # it will run with RPG Maker VX without adjusting.
  78. #
  79. #==============================================================================
  80.  
  81. module YEA
  82.   module ITEM
  83.  
  84.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  85.     # - Item Command Settings -
  86.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  87.     # This array adjusts what options appear in the initial item command window
  88.     # before the items are split into separate categories. Add commands, remove
  89.     # commands, or rearrange them. Here's a list of which does what:
  90.     #
  91.     # -------------------------------------------------------------------------
  92.     # :command         Description
  93.     # -------------------------------------------------------------------------
  94.     # :item            Opens up the various item categories. Default.
  95.     # :weapon          Opens up the various weapon categories. Default.
  96.     # :armor           Opens up the various armour categories. Default.
  97.     # :key_item        Shows a list of the various key items. Default.
  98.     #
  99.     # :gogototori      Requires Kread-EX's Go Go Totori Synthesis.
  100.     #
  101.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  102.     COMMANDS =[
  103.       :item,         # Opens up the various item categories. Default.
  104.       :weapon,       # Opens up the various weapon categories. Default.
  105.       :armor,        # Opens up the various armour categories. Default.
  106.       :key_item,     # Shows a list of the various key items. Default.
  107.       :gogototori,   # Requires Kread-EX's Go Go Totori Synthesis.
  108.     # :custom1,      # Custom command 1.
  109.     # :custom2,      # Custom command 2.
  110.     ] # Do not remove this.
  111.  
  112.     #--------------------------------------------------------------------------
  113.     # - Item Custom Commands -
  114.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  115.     # For those who use scripts to that may produce unique effects for the item
  116.     # scene, use this hash to manage the custom commands for the Item Command
  117.     # Window. You can disable certain commands or prevent them from appearing
  118.     # by using switches. If you don't wish to bind them to a switch, set the
  119.     # proper switch to 0 for it to have no impact.
  120.     #--------------------------------------------------------------------------
  121.     CUSTOM_ITEM_COMMANDS ={
  122.     # :command => ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
  123.       :gogototori => ["合成",            0,         0, :command_totori],
  124.       :custom1 => [ "自定義名稱",            0,          0, :command_name1],
  125.       :custom2 => [ "自定義文本",           13,          0, :command_name2],
  126.     } # Do not remove this.
  127.  
  128.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  129.     # - Item Type Settings -
  130.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  131.     # These arrays adjusts and shows the various item types shown for Items,
  132.     # Weapons, and Armours. Note that when using :category symbols, the
  133.     # specific category shown will be equal to the text used for the Display
  134.     # and the included item must contain a category equal to the Display name.
  135.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  136.     # This array contains the order for the Item categories.
  137.     ITEM_TYPES =[
  138.     # [  :symbol,   "Display"],
  139.       [:all,       "全部"], # Shows all usable items.
  140.       [:field,     "背包内"], # Shows Menu-usable items.
  141.       [:battle,    "战斗用"], # Shows Battle-usable items.
  142.       [:category,   "材料"], # Categorized by <category: 材料>
  143.       [:category,"特别"], # Categorized by <category: 特别>
  144.       [:category,"石头"], # Categorized by <category: 石头>
  145.       [:category,"宝珠"], # Categorized by <category: 宝珠>
  146.       [:category,"药剂"], # Categorized by <category: 技能书>
  147.       [:category,"技能书"], # Categorized by <category: 药剂>
  148.       [:category,"宝物"], # Categorized by <category: 宝物>
  149.       [:category,  "进阶"], # Shows all key items.
  150.     ] # Do not remove this.
  151.  
  152.     # This array contains the order for the Weapon categories.
  153.     WEAPON_TYPES =[
  154.     # [  :symbol,   "Display"],
  155.       [   :types,  "WPNTYPES"], # Lists all of the individual weapon types.
  156.       [     :all,       "全部"], # Shows all weapons.
  157.     ] # Do not remove this.
  158.  
  159.     # This array contains the order for the Armour categories.
  160.     ARMOUR_TYPES =[
  161.     # [  :symbol,   "Display"],
  162.       [   :slots,  "ARMSLOTS"], # Lists all of the individual armour slots.
  163.       [   :types,  "ARMTYPES"], # Lists all of the individual armours types.
  164.       [     :all,       "全部"], # Shows all armours.
  165.     ] # Do not remove this.
  166.  
  167.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  168.     # - Item Status Settings -
  169.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  170.     # The item status window displays information about the item in detail.
  171.     # Adjust the settings below to change the way the status window appears.
  172.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  173.     STATUS_FONT_SIZE = 20       # Font size used for status window.
  174.     MAX_ICONS_DRAWN  = 10       # Maximum number of icons drawn for states.
  175.  
  176.     # The following adjusts the vocabulary used for the status window. Each
  177.     # of the vocabulary settings are self explanatory.
  178.     VOCAB_STATUS ={
  179.       :empty      => "---",          # Text used when nothing is shown.
  180.       :hp_recover => "回复血量",      # Text used for HP Recovery.
  181.       :mp_recover => "回复魔法",      # Text used for MP Recovery.
  182.       :tp_recover => "回复TP",      # Text used for TP Recovery.
  183.       :tp_gain    => "增加TP",      # Text used for TP Gain.
  184.       :applies    => "增加效果",      # Text used for applied states and buffs.
  185.       :removes    => "移除效果",      # Text used for removed states and buffs.
  186.     } # Do not remove this.
  187.  
  188.   end # ITEM
  189. end # YEA
  190.  
  191. #==============================================================================
  192. # ▼ Editting anything past this point may potentially result in causing
  193. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  194. # halitosis so edit at your own risk.
  195. #==============================================================================
  196.  
  197. module YEA
  198.   module REGEXP
  199.   module BASEITEM
  200.  
  201.     CATEGORY = /<(?:CATEGORIES|category):[ ](.*)>/i
  202.     IMAGE    = /<(?:IMAGE|image):[ ](.*)>/i
  203.  
  204.   end # BASEITEM
  205.   end # REGEXP
  206. end # YEA
  207.  
  208. #==============================================================================
  209. # ■ Numeric
  210. #==============================================================================
  211.  
  212. class Numeric
  213.  
  214.   #--------------------------------------------------------------------------
  215.   # new method: group_digits
  216.   #--------------------------------------------------------------------------
  217.   unless $imported["YEA-CoreEngine"]
  218.   def group; return self.to_s; end
  219.   end # $imported["YEA-CoreEngine"]
  220.  
  221. end # Numeric
  222.  
  223. #==============================================================================
  224. # ■ Vocab
  225. #==============================================================================
  226.  
  227. module Vocab
  228.  
  229.   #--------------------------------------------------------------------------
  230.   # new method: self.item_status
  231.   #--------------------------------------------------------------------------
  232.   def self.item_status(type)
  233.     return YEA::ITEM::VOCAB_STATUS[type]
  234.   end
  235.  
  236. end # Vocab
  237.  
  238. #==============================================================================
  239. # ■ DataManager
  240. #==============================================================================
  241.  
  242. module DataManager
  243.  
  244.   #--------------------------------------------------------------------------
  245.   # alias method: load_database
  246.   #--------------------------------------------------------------------------
  247.   class <<self; alias load_database_aim load_database; end
  248.   def self.load_database
  249.     load_database_aim
  250.     load_notetags_aim
  251.   end
  252.  
  253.   #--------------------------------------------------------------------------
  254.   # new method: load_notetags_aim
  255.   #--------------------------------------------------------------------------
  256.   def self.load_notetags_aim
  257.     groups = [$data_items, $data_weapons, $data_armors]
  258.     for group in groups
  259.       for obj in group
  260.         next if obj.nil?
  261.         obj.load_notetags_aim
  262.       end
  263.     end
  264.   end
  265.  
  266. end # DataManager
  267.  
  268. #==============================================================================
  269. # ■ RPG::BaseItem
  270. #==============================================================================
  271.  
  272. class RPG::BaseItem
  273.  
  274.   #--------------------------------------------------------------------------
  275.   # public instance variables
  276.   #--------------------------------------------------------------------------
  277.   attr_accessor :category
  278.   attr_accessor :image
  279.  
  280.   #--------------------------------------------------------------------------
  281.   # common cache: load_notetags_aim
  282.   #--------------------------------------------------------------------------
  283.   def load_notetags_aim
  284.     @category = []
  285.     #---
  286.     self.note.split(/[\r\n]+/).each { |line|
  287.       case line
  288.       #---
  289.       when YEA::REGEXP::BASEITEM::CATEGORY
  290.         @category.push($1.upcase.to_s)
  291.       when YEA::REGEXP::BASEITEM::IMAGE
  292.         @image = $1.to_s
  293.       end
  294.     } # self.note.split
  295.     #---
  296.   end
  297.  
  298. end # RPG::BaseItem
  299.  
  300. #==============================================================================
  301. # ■ Game_Temp
  302. #==============================================================================
  303.  
  304. class Game_Temp
  305.  
  306.   #--------------------------------------------------------------------------
  307.   # public instance variables
  308.   #--------------------------------------------------------------------------
  309.   attr_accessor :scene_item_index
  310.   attr_accessor :scene_item_oy
  311.  
  312. end # Game_Temp
  313.  
  314. #==============================================================================
  315. # ■ Window_ItemList
  316. #==============================================================================
  317.  
  318. class Window_ItemList < Window_Selectable
  319.  
  320.   #--------------------------------------------------------------------------
  321.   # overwrite method: draw_item
  322.   #--------------------------------------------------------------------------
  323.   def draw_item(index)
  324.     item = @data[index]
  325.     return if item.nil?
  326.     rect = item_rect(index)
  327.     rect.width -= 4
  328.     draw_item_name(item, rect.x, rect.y, enable?(item), rect.width - 24)
  329.     draw_item_number(rect, item)
  330.   end
  331.  
  332. end # Window_ItemList
  333.  
  334. #==============================================================================
  335. # ■ Window_ItemCommand
  336. #==============================================================================
  337.  
  338. class Window_ItemCommand < Window_Command
  339.  
  340.   #--------------------------------------------------------------------------
  341.   # public instance variables
  342.   #--------------------------------------------------------------------------
  343.   attr_reader   :item_window
  344.  
  345.   #--------------------------------------------------------------------------
  346.   # initialize
  347.   #--------------------------------------------------------------------------
  348.   def initialize(x, y)
  349.     super(x, y)
  350.   end
  351.  
  352.   #--------------------------------------------------------------------------
  353.   # window_width
  354.   #--------------------------------------------------------------------------
  355.   def window_width; return 160; end
  356.  
  357.   #--------------------------------------------------------------------------
  358.   # visible_line_number
  359.   #--------------------------------------------------------------------------
  360.   def visible_line_number; return 4; end
  361.  
  362.   #--------------------------------------------------------------------------
  363.   # process_ok
  364.   #--------------------------------------------------------------------------
  365.   def process_ok
  366.     $game_temp.scene_item_index = index
  367.     $game_temp.scene_item_oy = self.oy
  368.     super
  369.   end
  370.  
  371.   #--------------------------------------------------------------------------
  372.   # make_command_list
  373.   #--------------------------------------------------------------------------
  374.   def make_command_list
  375.     for command in YEA::ITEM::COMMANDS
  376.       case command
  377.       #--- Default Commands ---
  378.       when :item
  379.         add_command(Vocab::item, :item)
  380.       when :weapon
  381.         add_command(Vocab::weapon, :weapon)
  382.       when :armor
  383.         add_command(Vocab::armor, :armor)
  384.       when :key_item
  385.         add_command(Vocab::key_item, :key_item)
  386.       #--- Imported ---
  387.       when :gogototori
  388.         next unless $imported["KRX-AlchemicSynthesis"]
  389.         process_custom_command(command)
  390.       #--- Custom Commands ---
  391.       else
  392.         process_custom_command(command)
  393.       end
  394.     end
  395.   end
  396.  
  397.   #--------------------------------------------------------------------------
  398.   # process_custom_command
  399.   #--------------------------------------------------------------------------
  400.   def process_custom_command(command)
  401.     return unless YEA::ITEM::CUSTOM_ITEM_COMMANDS.include?(command)
  402.     show = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][2]
  403.     continue = show <= 0 ? true : $game_switches[show]
  404.     return unless continue
  405.     text = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][0]
  406.     switch = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][1]
  407.     enabled = switch <= 0 ? true : $game_switches[switch]
  408.     add_command(text, command, enabled)
  409.   end
  410.  
  411.   #--------------------------------------------------------------------------
  412.   # update
  413.   #--------------------------------------------------------------------------
  414.   def update
  415.     super
  416.     return unless self.active
  417.     @item_window.category = current_symbol if @item_window
  418.   end
  419.  
  420.   #--------------------------------------------------------------------------
  421.   # item_window=
  422.   #--------------------------------------------------------------------------
  423.   def item_window=(item_window)
  424.     @item_window = item_window
  425.     update
  426.   end
  427.  
  428. end # Window_ItemCommand
  429.  
  430. #==============================================================================
  431. # ■ Window_ItemType
  432. #==============================================================================
  433.  
  434. class Window_ItemType < Window_Command
  435.  
  436.   #--------------------------------------------------------------------------
  437.   # public instance variables
  438.   #--------------------------------------------------------------------------
  439.   attr_reader   :item_window
  440.  
  441.   #--------------------------------------------------------------------------
  442.   # initialize
  443.   #--------------------------------------------------------------------------
  444.   def initialize(x, y)
  445.     super(x, y)
  446.     deactivate
  447.     @type = nil
  448.   end
  449.  
  450.   #--------------------------------------------------------------------------
  451.   # window_width
  452.   #--------------------------------------------------------------------------
  453.   def window_width; return 160; end
  454.  
  455.   #--------------------------------------------------------------------------
  456.   # visible_line_number
  457.   #--------------------------------------------------------------------------
  458.   def visible_line_number; return 4; end
  459.  
  460.   #--------------------------------------------------------------------------
  461.   # reveal
  462.   #--------------------------------------------------------------------------
  463.   def reveal(type)
  464.     @type = type
  465.     refresh
  466.     activate
  467.     select(0)
  468.   end
  469.  
  470.   #--------------------------------------------------------------------------
  471.   # make_command_list
  472.   #--------------------------------------------------------------------------
  473.   def make_command_list
  474.     return if @type.nil?
  475.     #---
  476.     case @type
  477.     when :item
  478.       commands = YEA::ITEM::ITEM_TYPES
  479.     when :weapon
  480.       commands = YEA::ITEM::WEAPON_TYPES
  481.     else
  482.       commands = YEA::ITEM::ARMOUR_TYPES
  483.     end
  484.     #---
  485.     for command in commands
  486.       case command[0]
  487.       #---
  488.       when :types
  489.         case @type
  490.         when :weapon
  491.           for i in 1...$data_system.weapon_types.size
  492.             name = $data_system.weapon_types[i]
  493.             add_command(name, :w_type, true, i)
  494.           end
  495.         else
  496.           for i in 1...$data_system.armor_types.size
  497.             name = $data_system.armor_types[i]
  498.             add_command(name, :a_type, true, i)
  499.           end
  500.         end
  501.       #---
  502.       when :slots
  503.         if $imported["YEA-AceEquipEngine"]
  504.           maximum = 1
  505.           for key in YEA::EQUIP::TYPES
  506.             maximum = [maximum, key[0]].max
  507.           end
  508.         else
  509.           maximum = 4
  510.         end
  511.         for i in 1..maximum
  512.           name = Vocab::etype(i)
  513.           add_command(name, :e_type, true, i) if name != ""
  514.         end
  515.       #---
  516.       else
  517.         add_command(command[1], command[0], true, @type)
  518.       end
  519.     end
  520.   end
  521.  
  522.   #--------------------------------------------------------------------------
  523.   # update
  524.   #--------------------------------------------------------------------------
  525.   def update
  526.     super
  527.     return unless self.active
  528.     @item_window.category = current_symbol if @item_window
  529.   end
  530.  
  531.   #--------------------------------------------------------------------------
  532.   # item_window=
  533.   #--------------------------------------------------------------------------
  534.   def item_window=(item_window)
  535.     @item_window = item_window
  536.     update
  537.   end
  538.  
  539. end # Window_ItemType
  540.  
  541. #==============================================================================
  542. # ■ Window_ItemList
  543. #==============================================================================
  544.  
  545. class Window_ItemList < Window_Selectable
  546.  
  547.   #--------------------------------------------------------------------------
  548.   # alias method: initialize
  549.   #--------------------------------------------------------------------------
  550.   alias window_itemlist_initialize_aim initialize
  551.   def initialize(dx, dy, dw, dh)
  552.     window_itemlist_initialize_aim(dx, dy, dw, dh)
  553.     @ext = :none
  554.     @name = ""
  555.   end
  556.  
  557.   #--------------------------------------------------------------------------
  558.   # alias method: category=
  559.   #--------------------------------------------------------------------------
  560.   alias window_itemlist_category_aim category=
  561.   def category=(category)
  562.     if @types_window.nil?
  563.       window_itemlist_category_aim(category)
  564.     else
  565.       return unless update_types?(category)
  566.       @category = category
  567.       if @types_window.active
  568.         @name = @types_window.current_data[:name]
  569.         @ext = @types_window.current_ext
  570.       end
  571.       refresh
  572.       self.oy = 0
  573.     end
  574.   end
  575.  
  576.   #--------------------------------------------------------------------------
  577.   # new method: update_types?
  578.   #--------------------------------------------------------------------------
  579.   def update_types?(category)
  580.     return true if @category != category
  581.     return false unless @types_window.active
  582.     if category == :category
  583.       return @name != @types_window.current_data[:name]
  584.     end
  585.     return @ext != @types_window.current_ext
  586.   end
  587.  
  588.   #--------------------------------------------------------------------------
  589.   # new method: types_window=
  590.   #--------------------------------------------------------------------------
  591.   def types_window=(window)
  592.     @types_window = window
  593.   end
  594.  
  595.   #--------------------------------------------------------------------------
  596.   # alias method: include?
  597.   #--------------------------------------------------------------------------
  598.   alias window_itemlist_include_aim include?
  599.   def include?(item)
  600.     if @types_window.nil?
  601.       return window_itemlist_include_aim(item)
  602.     else
  603.       return ace_item_menu_include?(item)
  604.     end
  605.   end
  606.  
  607.   #--------------------------------------------------------------------------
  608.   # new method: ace_item_menu_include?
  609.   #--------------------------------------------------------------------------
  610.   def ace_item_menu_include?(item)
  611.     case @category
  612.     #---
  613.     when :field
  614.       return false unless item.is_a?(RPG::Item)
  615.       return item.menu_ok?
  616.     when :battle
  617.       return false unless item.is_a?(RPG::Item)
  618.       return item.battle_ok?
  619.     #---
  620.     when :w_type
  621.       return false unless item.is_a?(RPG::Weapon)
  622.       return item.wtype_id == @types_window.current_ext
  623.     when :a_type
  624.       return false unless item.is_a?(RPG::Armor)
  625.       return item.atype_id == @types_window.current_ext
  626.     when :e_type
  627.       return false unless item.is_a?(RPG::Armor)
  628.       return item.etype_id == @types_window.current_ext
  629.     #---
  630.     when :all
  631.       case @types_window.current_ext
  632.       when :item
  633.         return item.is_a?(RPG::Item)
  634.       when :weapon
  635.         return item.is_a?(RPG::Weapon)
  636.       else
  637.         return item.is_a?(RPG::Armor)
  638.       end
  639.     #---
  640.     when :category
  641.       case @types_window.current_ext
  642.       when :item
  643.         return false unless item.is_a?(RPG::Item)
  644.       when :weapon
  645.         return false unless item.is_a?(RPG::Weapon)
  646.       else
  647.         return false unless item.is_a?(RPG::Armor)
  648.       end
  649.       return item.category.include?(@types_window.current_data[:name].upcase)
  650.     #---
  651.     else
  652.       return window_itemlist_include_aim(item)
  653.     end
  654.   end
  655.  
  656. end # Window_ItemList
  657.  
  658. #==============================================================================
  659. # ■ Window_ItemStatus
  660. #==============================================================================
  661.  
  662. class Window_ItemStatus < Window_Base
  663.  
  664.   #--------------------------------------------------------------------------
  665.   # initialize
  666.   #--------------------------------------------------------------------------
  667.   def initialize(dx, dy, item_window)
  668.     super(dx, dy, Graphics.width - dx, fitting_height(4))
  669.     @item_window = item_window
  670.     @item = nil
  671.     refresh
  672.   end
  673.  
  674.   #--------------------------------------------------------------------------
  675.   # update
  676.   #--------------------------------------------------------------------------
  677.   def update
  678.     super
  679.     update_item(@item_window.item)
  680.   end
  681.  
  682.   #--------------------------------------------------------------------------
  683.   # update_item
  684.   #--------------------------------------------------------------------------
  685.   def update_item(item)
  686.     return if @item == item
  687.     @item = item
  688.     refresh
  689.   end
  690.  
  691.   #--------------------------------------------------------------------------
  692.   # refresh
  693.   #--------------------------------------------------------------------------
  694.   def refresh
  695.     contents.clear
  696.     reset_font_settings
  697.     return draw_empty if @item.nil?
  698.     contents.font.size = YEA::ITEM::STATUS_FONT_SIZE
  699.     draw_item_image
  700.     draw_item_stats
  701.     draw_item_effects
  702.   end
  703.  
  704.   #--------------------------------------------------------------------------
  705.   # draw_empty
  706.   #--------------------------------------------------------------------------
  707.   def draw_empty
  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.     dx = 96; dy = 0
  712.     dw = (contents.width - 96) / 2
  713.     for i in 0...8
  714.       draw_background_box(dx, dy, dw)
  715.       dx = dx >= 96 + dw ? 96 : 96 + dw
  716.       dy += line_height if dx == 96
  717.     end
  718.   end
  719.  
  720.   #--------------------------------------------------------------------------
  721.   # draw_background_box
  722.   #--------------------------------------------------------------------------
  723.   def draw_background_box(dx, dy, dw)
  724.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  725.     rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  726.     contents.fill_rect(rect, colour)
  727.   end
  728.  
  729.   #--------------------------------------------------------------------------
  730.   # draw_item_image
  731.   #--------------------------------------------------------------------------
  732.   def draw_item_image
  733.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  734.     rect = Rect.new(1, 1, 94, 94)
  735.     contents.fill_rect(rect, colour)
  736.     if @item.image.nil?
  737.       icon_index = @item.icon_index
  738.       bitmap = Cache.system("Iconset")
  739.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  740.       target = Rect.new(0, 0, 96, 96)
  741.       contents.stretch_blt(target, bitmap, rect)
  742.     else
  743.       bitmap = Cache.picture(@item.image)
  744.       contents.blt(0, 0, bitmap, bitmap.rect, 255)
  745.     end
  746.   end
  747.  
  748.   #--------------------------------------------------------------------------
  749.   # draw_item_stats
  750.   #--------------------------------------------------------------------------
  751.   def draw_item_stats
  752.     return unless @item.is_a?(RPG::Weapon) || @item.is_a?(RPG::Armor)
  753.     dx = 96; dy = 0
  754.     dw = (contents.width - 96) / 2
  755.     for i in 0...8
  756.       draw_equip_param(i, dx, dy, dw)
  757.       dx = dx >= 96 + dw ? 96 : 96 + dw
  758.       dy += line_height if dx == 96
  759.     end
  760.   end
  761.  
  762.   #--------------------------------------------------------------------------
  763.   # draw_equip_param
  764.   #--------------------------------------------------------------------------
  765.   def draw_equip_param(param_id, dx, dy, dw)
  766.     draw_background_box(dx, dy, dw)
  767.     change_color(system_color)
  768.     draw_text(dx+4, dy, dw-8, line_height, Vocab::param(param_id))
  769.     if $imported["YEA-EquipDynamicStats"]
  770.       draw_percentage_param(param_id, dx, dy, dw)
  771.     else
  772.       draw_set_param(param_id, dx, dy, dw)
  773.     end
  774.   end
  775.  
  776.   #--------------------------------------------------------------------------
  777.   # draw_percentage_param
  778.   #--------------------------------------------------------------------------
  779.   def draw_percentage_param(param_id, dx, dy, dw)
  780.     if @item.per_params[param_id] != 0 && @item.params[param_id] != 0
  781.       text = draw_set_param(param_id, dx, dy, dw)
  782.       dw -= text_size(text).width
  783.       draw_percent_param(param_id, dx, dy, dw)
  784.     elsif @item.per_params[param_id] != 0 && @item.params[param_id] == 0
  785.       draw_percent_param(param_id, dx, dy, dw)
  786.     else
  787.       draw_set_param(param_id, dx, dy, dw)
  788.     end
  789.   end
  790.  
  791.   #--------------------------------------------------------------------------
  792.   # draw_set_param
  793.   #--------------------------------------------------------------------------
  794.   def draw_set_param(param_id, dx, dy, dw)
  795.     value = @item.params[param_id]
  796.     if $imported["YEA-EquipDynamicStats"] && @item.var_params[param_id] > 0
  797.       value += $game_variables[@item.var_params[param_id]] rescue 0
  798.     end
  799.     change_color(param_change_color(value), value != 0)
  800.     text = value.group
  801.     text = "+" + text if value > 0
  802.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  803.     return text
  804.   end
  805.  
  806.   #--------------------------------------------------------------------------
  807.   # draw_percent_param
  808.   #--------------------------------------------------------------------------
  809.   def draw_percent_param(param_id, dx, dy, dw)
  810.     value = @item.per_params[param_id]
  811.     change_color(param_change_color(value))
  812.     text = (@item.per_params[param_id] * 100).to_i.group + "%"
  813.     text = "+" + text if @item.per_params[param_id] > 0
  814.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  815.     return text
  816.   end
  817.  
  818.   #--------------------------------------------------------------------------
  819.   # draw_item_effects
  820.   #--------------------------------------------------------------------------
  821.   def draw_item_effects
  822.     return unless @item.is_a?(RPG::Item)
  823.     dx = 96; dy = 0
  824.     dw = (contents.width - 96) / 2
  825.     draw_hp_recover(dx, dy + line_height * 0, dw)
  826.     draw_mp_recover(dx, dy + line_height * 1, dw)
  827.     draw_tp_recover(dx + dw, dy + line_height * 0, dw)
  828.     draw_tp_gain(dx + dw, dy + line_height * 1, dw)
  829.     dw = contents.width - 96
  830.     draw_applies(dx, dy + line_height * 2, dw)
  831.     draw_removes(dx, dy + line_height * 3, dw)
  832.   end
  833.  
  834.   #--------------------------------------------------------------------------
  835.   # draw_hp_recover
  836.   #--------------------------------------------------------------------------
  837.   def draw_hp_recover(dx, dy, dw)
  838.     draw_background_box(dx, dy, dw)
  839.     change_color(system_color)
  840.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:hp_recover))
  841.     per = 0
  842.     set = 0
  843.     for effect in @item.effects
  844.       next unless effect.code == 11
  845.       per += (effect.value1 * 100).to_i
  846.       set += effect.value2.to_i
  847.     end
  848.     if per != 0 && set != 0
  849.       change_color(param_change_color(set))
  850.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  851.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  852.       dw -= text_size(text).width
  853.       change_color(param_change_color(per))
  854.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  855.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  856.       return
  857.     elsif per != 0
  858.       change_color(param_change_color(per))
  859.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  860.     elsif set != 0
  861.       change_color(param_change_color(set))
  862.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  863.     else
  864.       change_color(normal_color, false)
  865.       text = Vocab::item_status(:empty)
  866.     end
  867.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  868.   end
  869.  
  870.   #--------------------------------------------------------------------------
  871.   # draw_mp_recover
  872.   #--------------------------------------------------------------------------
  873.   def draw_mp_recover(dx, dy, dw)
  874.     draw_background_box(dx, dy, dw)
  875.     change_color(system_color)
  876.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:mp_recover))
  877.     per = 0
  878.     set = 0
  879.     for effect in @item.effects
  880.       next unless effect.code == 12
  881.       per += (effect.value1 * 100).to_i
  882.       set += effect.value2.to_i
  883.     end
  884.     if per != 0 && set != 0
  885.       change_color(param_change_color(set))
  886.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  887.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  888.       dw -= text_size(text).width
  889.       change_color(param_change_color(per))
  890.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  891.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  892.       return
  893.     elsif per != 0
  894.       change_color(param_change_color(per))
  895.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  896.     elsif set != 0
  897.       change_color(param_change_color(set))
  898.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  899.     else
  900.       change_color(normal_color, false)
  901.       text = Vocab::item_status(:empty)
  902.     end
  903.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  904.   end
  905.  
  906.   #--------------------------------------------------------------------------
  907.   # draw_tp_recover
  908.   #--------------------------------------------------------------------------
  909.   def draw_tp_recover(dx, dy, dw)
  910.     draw_background_box(dx, dy, dw)
  911.     change_color(system_color)
  912.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:tp_recover))
  913.     set = 0
  914.     for effect in @item.effects
  915.       next unless effect.code == 13
  916.       set += effect.value1.to_i
  917.     end
  918.     if set != 0
  919.       change_color(param_change_color(set))
  920.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  921.     else
  922.       change_color(normal_color, false)
  923.       text = Vocab::item_status(:empty)
  924.     end
  925.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  926.   end
  927.  
  928.   #--------------------------------------------------------------------------
  929.   # draw_tp_gain
  930.   #--------------------------------------------------------------------------
  931.   def draw_tp_gain(dx, dy, dw)
  932.     draw_background_box(dx, dy, dw)
  933.     change_color(system_color)
  934.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:tp_gain))
  935.     set = @item.tp_gain
  936.     if set != 0
  937.       change_color(param_change_color(set))
  938.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  939.     else
  940.       change_color(normal_color, false)
  941.       text = Vocab::item_status(:empty)
  942.     end
  943.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  944.   end
  945.  
  946.   #--------------------------------------------------------------------------
  947.   # draw_applies
  948.   #--------------------------------------------------------------------------
  949.   def draw_applies(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(:applies))
  953.     icons = []
  954.     for effect in @item.effects
  955.       case effect.code
  956.       when 21
  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 31
  961.         icons.push($game_actors[1].buff_icon_index(1, effect.data_id))
  962.       when 32
  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_removes
  973.   #--------------------------------------------------------------------------
  974.   def draw_removes(dx, dy, dw)
  975.     draw_background_box(dx, dy, dw)
  976.     change_color(system_color)
  977.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:removes))
  978.     icons = []
  979.     for effect in @item.effects
  980.       case effect.code
  981.       when 22
  982.         next unless effect.value1 > 0
  983.         next if $data_states[effect.value1].nil?
  984.         icons.push($data_states[effect.data_id].icon_index)
  985.       when 33
  986.         icons.push($game_actors[1].buff_icon_index(1, effect.data_id))
  987.       when 34
  988.         icons.push($game_actors[1].buff_icon_index(-1, effect.data_id))
  989.       end
  990.       icons.delete(0)
  991.       break if icons.size >= YEA::ITEM::MAX_ICONS_DRAWN
  992.     end
  993.     draw_icons(dx, dy, dw, icons)
  994.   end
  995.  
  996.   #--------------------------------------------------------------------------
  997.   # draw_icons
  998.   #--------------------------------------------------------------------------
  999.   def draw_icons(dx, dy, dw, icons)
  1000.     dx += dw - 4
  1001.     dx -= icons.size * 24
  1002.     for icon_id in icons
  1003.       draw_icon(icon_id, dx, dy)
  1004.       dx += 24
  1005.     end
  1006.     if icons.size == 0
  1007.       change_color(normal_color, false)
  1008.       text = Vocab::item_status(:empty)
  1009.       draw_text(4, dy, contents.width-8, line_height, text, 2)
  1010.     end
  1011.   end
  1012.  
  1013. end # Window_ItemStatus
  1014.  
  1015. #==============================================================================
  1016. # ■ Scene_Item
  1017. #==============================================================================
  1018.  
  1019. class Scene_Item < Scene_ItemBase
  1020.  
  1021.   #--------------------------------------------------------------------------
  1022.   # alias method: start
  1023.   #--------------------------------------------------------------------------
  1024.   alias scene_item_start_aim start
  1025.   def start
  1026.     scene_item_start_aim
  1027.     create_types_window
  1028.     create_status_window
  1029.     relocate_windows
  1030.   end
  1031.  
  1032.   #--------------------------------------------------------------------------
  1033.   # overwrite method: return_scene
  1034.   #--------------------------------------------------------------------------
  1035.   def return_scene
  1036.     $game_temp.scene_item_index = nil
  1037.     $game_temp.scene_item_oy = nil
  1038.     super
  1039.   end
  1040.  
  1041.   #--------------------------------------------------------------------------
  1042.   # overwrite method: create_category_window
  1043.   #--------------------------------------------------------------------------
  1044.   def create_category_window
  1045.     wy = @help_window.height
  1046.     @category_window = Window_ItemCommand.new(0, wy)
  1047.     @category_window.viewport = @viewport
  1048.     @category_window.help_window = @help_window
  1049.     @category_window.y = @help_window.height
  1050.     if !$game_temp.scene_item_index.nil?
  1051.       @category_window.select($game_temp.scene_item_index)
  1052.       @category_window.oy = $game_temp.scene_item_oy
  1053.     end
  1054.     $game_temp.scene_item_index = nil
  1055.     $game_temp.scene_item_oy = nil
  1056.     @category_window.set_handler(:ok, method(:on_category_ok))
  1057.     @category_window.set_handler(:cancel, method(:return_scene))
  1058.     @category_window.set_handler(:item, method(:open_types))
  1059.     @category_window.set_handler(:weapon, method(:open_types))
  1060.     @category_window.set_handler(:armor, method(:open_types))
  1061.     process_custom_item_commands
  1062.   end
  1063.  
  1064.   #--------------------------------------------------------------------------
  1065.   # new method: process_custom_item_commands
  1066.   #--------------------------------------------------------------------------
  1067.   def process_custom_item_commands
  1068.     for command in YEA::ITEM::COMMANDS
  1069.       next unless YEA::ITEM::CUSTOM_ITEM_COMMANDS.include?(command)
  1070.       called_method = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][3]
  1071.       @category_window.set_handler(command, method(called_method))
  1072.     end
  1073.   end
  1074.  
  1075.   #--------------------------------------------------------------------------
  1076.   # new method: create_types_window
  1077.   #--------------------------------------------------------------------------
  1078.   def create_types_window
  1079.     wy = @category_window.y
  1080.     @types_window = Window_ItemType.new(Graphics.width, wy)
  1081.     @types_window.viewport = @viewport
  1082.     @types_window.help_window = @help_window
  1083.     @types_window.y = @help_window.height
  1084.     @types_window.item_window = @item_window
  1085.     @item_window.types_window = @types_window
  1086.     @types_window.set_handler(:ok, method(:on_types_ok))
  1087.     @types_window.set_handler(:cancel, method(:on_types_cancel))
  1088.   end
  1089.  
  1090.   #--------------------------------------------------------------------------
  1091.   # new method: create_status_window
  1092.   #--------------------------------------------------------------------------
  1093.   def create_status_window
  1094.     wx = @category_window.width
  1095.     wy = @category_window.y
  1096.     @status_window = Window_ItemStatus.new(wx, wy, @item_window)
  1097.     @status_window.viewport = @viewport
  1098.   end
  1099.  
  1100.   #--------------------------------------------------------------------------
  1101.   # new method: relocate_windows
  1102.   #--------------------------------------------------------------------------
  1103.   def relocate_windows
  1104.     return unless $imported["YEA-AceMenuEngine"]
  1105.     case Menu.help_window_location
  1106.     when 0 # Top
  1107.       @help_window.y = 0
  1108.       @category_window.y = @help_window.height
  1109.       @item_window.y = @category_window.y + @category_window.height
  1110.     when 1 # Middle
  1111.       @category_window.y = 0
  1112.       @help_window.y = @category_window.height
  1113.       @item_window.y = @help_window.y + @help_window.height
  1114.     else # Bottom
  1115.       @category_window.y = 0
  1116.       @item_window.y = @category_window.height
  1117.       @help_window.y = @item_window.y + @item_window.height
  1118.     end
  1119.     @types_window.y = @category_window.y
  1120.     @status_window.y = @category_window.y
  1121.   end
  1122.  
  1123.   #--------------------------------------------------------------------------
  1124.   # new method: open_categories
  1125.   #--------------------------------------------------------------------------
  1126.   def open_types
  1127.     @category_window.x = Graphics.width
  1128.     @types_window.x = 0
  1129.     @types_window.reveal(@category_window.current_symbol)
  1130.   end
  1131.  
  1132.   #--------------------------------------------------------------------------
  1133.   # new method: on_types_ok
  1134.   #--------------------------------------------------------------------------
  1135.   def on_types_ok
  1136.     @item_window.activate
  1137.     @item_window.select_last
  1138.   end
  1139.  
  1140.   #--------------------------------------------------------------------------
  1141.   # new method: on_types_cancel
  1142.   #--------------------------------------------------------------------------
  1143.   def on_types_cancel
  1144.     @category_window.x = 0
  1145.     @category_window.activate
  1146.     @types_window.unselect
  1147.     @types_window.x = Graphics.width
  1148.   end
  1149.  
  1150.   #--------------------------------------------------------------------------
  1151.   # alias method: on_item_cancel
  1152.   #--------------------------------------------------------------------------
  1153.   alias scene_item_on_item_cancel_aim on_item_cancel
  1154.   def on_item_cancel
  1155.     if @types_window.x <= 0
  1156.       @item_window.unselect
  1157.       @types_window.activate
  1158.     else
  1159.       scene_item_on_item_cancel_aim
  1160.     end
  1161.   end
  1162.  
  1163.   #--------------------------------------------------------------------------
  1164.   # new method: command_totori
  1165.   #--------------------------------------------------------------------------
  1166.   def command_totori
  1167.     SceneManager.call(Scene_Alchemy)
  1168.   end
  1169.  
  1170.   #--------------------------------------------------------------------------
  1171.   # new method: command_name1
  1172.   #--------------------------------------------------------------------------
  1173.   def command_name1
  1174.     # Do nothing.
  1175.   end
  1176.  
  1177.   #--------------------------------------------------------------------------
  1178.   # new method: command_name2
  1179.   #--------------------------------------------------------------------------
  1180.   def command_name2
  1181.     # Do nothing.
  1182.   end
  1183.  
  1184. end # Scene_Item
  1185.  
  1186. #==============================================================================
  1187. #
  1188. # ▼ End of File
  1189. #
  1190. #==============================================================================


掉落强化
RUBY 代码复制
  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.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-ExtraDrops"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2011.12.31 - Bug Fixed: Drop ratios now work properly.
  17. # 2011.12.17 - Started Script and Finished.
  18. #
  19. #==============================================================================
  20. # ▼ Introduction
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # Enemies by default only drop three items maximum in RPG Maker VX Ace. The
  23. # drop rates are also limited to rates that can only be achieved through
  24. # denominator values. A drop rate of say, 75% cannot be achieved. This script
  25. # provides the ability to add more than just three drops and more control over
  26. # the drop rates, too.
  27. #
  28. #==============================================================================
  29. # ▼ Instructions
  30. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  31. # To install this script, open up your script editor and copy/paste this script
  32. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  33. #
  34. # -----------------------------------------------------------------------------
  35. # Enemy Notetags - These notetags go in the enemies notebox in the database.
  36. # -----------------------------------------------------------------------------
  37. # <drop Ix: y%>在敌人备注添加额外的物品掉落,X为物品编号,Y为概率
  38. # <drop Wx: y%>在敌人备注添加额外的武器掉落,X为武器编号,Y为概率
  39. # <drop Ax: y%>在敌人备注添加额外的防具掉落,X为防具编号,Y为概率
  40. # Causes enemy to drop item, weapon, or armour (marked by I, W, or A) x at a
  41. # rate of y percent. Insert multiples of this tag to increase the number of
  42. # drops an enemy can possibly have.
  43. #
  44. #==============================================================================
  45. # ▼ Compatibility
  46. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  47. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  48. # it will run with RPG Maker VX without adjusting.
  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. module YEA
  57.   module REGEXP
  58.   module ENEMY
  59.  
  60.     DROP_PLUS = /<(?:DROP|drop)[ ]([IWA])(\d+):[ ](\d+)([%%])>/i
  61.  
  62.   end # ENEMY
  63.   end # REGEXP
  64. end # YEA
  65.  
  66. #==============================================================================
  67. # ■ DataManager
  68. #==============================================================================
  69.  
  70. module DataManager
  71.  
  72.   #--------------------------------------------------------------------------
  73.   # alias method: load_database
  74.   #--------------------------------------------------------------------------
  75.   class <<self; alias load_database_edr load_database; end
  76.   def self.load_database
  77.     load_database_edr
  78.     load_notetags_edr
  79.   end
  80.  
  81.   #--------------------------------------------------------------------------
  82.   # new method: load_notetags_al
  83.   #--------------------------------------------------------------------------
  84.   def self.load_notetags_edr
  85.     for enemy in $data_enemies
  86.       next if enemy.nil?
  87.       enemy.load_notetags_edr
  88.     end
  89.   end
  90.  
  91. end # DataManager
  92.  
  93. #==============================================================================
  94. # ■ RPG::Enemy
  95. #==============================================================================
  96.  
  97. class RPG::Enemy < RPG::BaseItem
  98.  
  99.   #--------------------------------------------------------------------------
  100.   # public instance variables
  101.   #--------------------------------------------------------------------------
  102.   attr_accessor :extra_drops
  103.  
  104.   #--------------------------------------------------------------------------
  105.   # common cache: load_notetags_edr
  106.   #--------------------------------------------------------------------------
  107.   def load_notetags_edr
  108.     @extra_drops = []
  109.     #---
  110.     self.note.split(/[\r\n]+/).each { |line|
  111.       case line
  112.       #---
  113.       when YEA::REGEXP::ENEMY::DROP_PLUS
  114.         case $1.upcase
  115.         when "I";  kind = 1
  116.         when "W";  kind = 2
  117.         when "A";  kind = 3
  118.         else; next
  119.         end
  120.         item = RPG::Enemy::DropItem.new
  121.         item.kind = kind
  122.         item.data_id = $2.to_i
  123.         item.drop_rate = $3.to_i * 0.01
  124.         @extra_drops.push(item)
  125.       end
  126.     } # self.note.split
  127.     #---
  128.   end
  129.  
  130. end # RPG::Enemy
  131.  
  132. #==============================================================================
  133. # ■ RPG::Enemy::DropItem
  134. #==============================================================================
  135.  
  136. class RPG::Enemy::DropItem
  137.  
  138.   #--------------------------------------------------------------------------
  139.   # public instance variables
  140.   #--------------------------------------------------------------------------
  141.   attr_accessor :drop_rate
  142.  
  143.   #--------------------------------------------------------------------------
  144.   # new method: drop_rate
  145.   #--------------------------------------------------------------------------
  146.   def drop_rate
  147.     return 0 if @drop_rate.nil?
  148.     return @drop_rate
  149.   end
  150.  
  151. end # RPG::Enemy::DropItem
  152.  
  153. #==============================================================================
  154. # ■ Game_Enemy
  155. #==============================================================================
  156.  
  157. class Game_Enemy < Game_Battler
  158.  
  159.   #--------------------------------------------------------------------------
  160.   # alias method: make_drop_items
  161.   #--------------------------------------------------------------------------
  162.   alias game_enemy_make_drop_items_edr make_drop_items
  163.   def make_drop_items
  164.     result = game_enemy_make_drop_items_edr
  165.     result += make_extra_drops
  166.     return result
  167.   end
  168.  
  169.   #--------------------------------------------------------------------------
  170.   # new method: make_extra_drops
  171.   #--------------------------------------------------------------------------
  172.   def make_extra_drops
  173.     result = []
  174.     for drop in enemy.extra_drops
  175.       next if rand > drop.drop_rate
  176.       result.push(item_object(drop.kind, drop.data_id))
  177.     end
  178.     return result
  179.   end
  180.  
  181. end # Game_Enemy
  182.  
  183. #==============================================================================
  184. #
  185. # ▼ End of File
  186. #
  187. #==============================================================================

点评

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

评分

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

查看全部评分

P1不太上了,有问题加个Q1286124843,不管是脚本还是游戏问题都可以来找我

Lv3.寻梦者

梦石
0
星屑
1314
在线时间
962 小时
注册时间
2012-4-30
帖子
1475

开拓者

2
发表于 2017-7-19 18:11:51 | 只看该作者
本帖最后由 铅笔描绘的思念 于 2017-7-20 12:55 编辑

善用




怎么可能会很长啊。。难道长了有bug?
回复 支持 反对

使用道具 举报

Lv3.寻梦者

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

点评

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

使用道具 举报

Lv2.观梦者

梦石
0
星屑
878
在线时间
576 小时
注册时间
2010-6-26
帖子
793
4
发表于 2017-7-19 23:11:13 | 只看该作者
感谢分享

点评

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

使用道具 举报

Lv3.寻梦者

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

使用道具 举报

Lv2.观梦者

梦石
0
星屑
354
在线时间
127 小时
注册时间
2016-10-8
帖子
72
6
发表于 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
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
731
在线时间
51 小时
注册时间
2021-6-14
帖子
40
7
发表于 2021-9-11 19:10:13 | 只看该作者
good,真不错
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-27 03:14

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表