LiTTleDRAgo

[RGSS] Tons of Addons Part 2 (edited)

Sep 24th, 2013
1,182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 197.78 KB | None | 0 0
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2. # Tons of Add-ons by Blizzard
  3. # Version: 7.65b
  4. # Type: Add-on Collection Control Script
  5. # Date v7.65b:  11.04.2013
  6. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  7. #
  8. #                                    PART 2
  9. #
  10. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  11. #  
  12. #  This work is protected by the following license:
  13. # #----------------------------------------------------------------------------
  14. # #  
  15. # #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
  16. # #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
  17. # #  
  18. # #  You are free:
  19. # #  
  20. # #  to Share - to copy, distribute and transmit the work
  21. # #  to Remix - to adapt the work
  22. # #  
  23. # #  Under the following conditions:
  24. # #  
  25. # #  Attribution. You must attribute the work in the manner specified by the
  26. # #  author or licensor (but not in any way that suggests that they endorse you
  27. # #  or your use of the work).
  28. # #  
  29. # #  Noncommercial. You may not use this work for commercial purposes.
  30. # #  
  31. # #  Share alike. If you alter, transform, or build upon this work, you may
  32. # #  distribute the resulting work only under the same or similar license to
  33. # #  this one.
  34. # #  
  35. # #  - For any reuse or distribution, you must make clear to others the license
  36. # #    terms of this work. The best way to do this is with a link to this web
  37. # #    page.
  38. # #  
  39. # #  - Any of the above conditions can be waived if you get permission from the
  40. # #    copyright holder.
  41. # #  
  42. # #  - Nothing in this license impairs or restricts the author's moral rights.
  43. # #  
  44. # #----------------------------------------------------------------------------
  45. #
  46. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  47. #
  48. # VERY IMPORTANT NOTE:
  49. #
  50. #   Tons of Add-ons now has to be used as 3-parts script because of a weird
  51. #   behaviour of RMXP during bug detection. Insert the 3 parts in the correct
  52. #   order and the system should work without problems. Do NOT remove any of the
  53. #   parts, the script NEEDS all 3 parts to work with other systems.
  54. #
  55. #
  56. # If you find any bugs, please report them here:
  57. # http://forum.chaos-project.com
  58. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  59.  
  60. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
  61. #                                                                             #
  62. #   ###   ###  #   # #####  #   #### #   # ####   ###  #####  #   ###  #   #  #
  63. #  #   # #   # ##  # #      #  #     #   # #   # #   #   #    #  #   # ##  #  #
  64. #  #     #   # # # # ####   #  #  ## #   # ####  #   #   #    #  #   # # # #  #
  65. #  #   # #   # #  ## #      #  #   # #   # #   # #####   #    #  #   # #  ##  #
  66. #   ###   ###  #   # #      #   ####  ###  #   # #   #   #    #   ###  #   #  #
  67. #                                                                             #
  68. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
  69.  
  70. module TONS_OF_ADDONS
  71.  
  72. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  73. # START Configuration 2-1, UTILITY add-ons
  74. #
  75. #   You can enable/disable any add-on here if you wish. Set the value to false
  76. #   to disable it. These features CANNOT be turned on/off during the game.
  77. #
  78. #     NAME_OF_THE_ADDON = true
  79. #     NAME_OF_THE_ADDON = false
  80. #
  81. #   where NAME_OF_THE_ADDON is the same variable as the one used below.
  82. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  83.   CUSTOM_CONTROLS        = false
  84.   FULLSCREEN             = false
  85.   MULTI_DROP             = false
  86.   ULTIMATE_FONT_OVERRIDE = false
  87.   EQUAP_SKILLS           = false
  88.   PICTURE_MOVIE_SCENE    = false
  89.   DIFFICULTY             = false
  90.   ITEMCALL               = false
  91.   SAVEPOINT              = false
  92. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  93. # END Configuration 2-1
  94. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  95.  
  96. end
  97.  
  98. #==============================================================================
  99. # Game_System
  100. #==============================================================================
  101.  
  102. class Game_System
  103.  
  104.   alias init_tons_of_addons2_later initialize_tons_of_addons
  105.   def initialize_tons_of_addons
  106.     init_tons_of_addons2_later
  107. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  108. # START Configuration 2-2, UTILITY add-ons
  109. #
  110. #   You can enable/disable any add-on here if you wish. Set the value to false
  111. #   to disable it initially. To turn it on/off ingame, just use the Call script
  112. #   command with one of these syntaxes:
  113. #
  114. #     $game_system.NAME_OF_THE_ADDON = true
  115. #     $game_system.NAME_OF_THE_ADDON = false
  116. #
  117. #   where NAME_OF_THE_ADDON is the same variable as the one used below.
  118. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  119.     @FPS_MODULATOR            = false
  120.     @SPEED_MODULATOR          = false
  121.     @DEATH_TOLL               = false
  122.     @WINDOW_BATTLERESULT      = false
  123.     @UNIQUE_SKILL_COMMANDS    = false
  124.     @HEAL_AT_LVLUP            = false
  125.     @HPSPPLUS                 = false
  126.     @TARGET_EM_ALL            = false
  127.     @QUICK_PASSABILITY_TEST   = false
  128.     @MINIMAP                  = false
  129.     @ENEMY_STATUS             = false
  130.     @PASSIVE_SKILLS           = false
  131.     @SKILL_SEPARATION         = false
  132.     @MULTI_HIT                = false
  133.     @EQUIPMENT_REQUIREMENT    = false
  134.     @ITEM_REQUIREMENT         = false
  135.     @HP_SP_CRUSH              = false
  136.     @ROULETTE                 = false
  137.     @CHAIN_STATUS             = false
  138.     @ACTOR_ITEMS              = false
  139.     @HP_PERCENT_STATES        = false
  140.     @MONSTER_AREAS            = false
  141.     @REALISTIC_LADDERS        = false
  142.     @EVENT_Z_INDEX_CONTROLLER = false
  143. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  144. # END Configuration 2-2
  145. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  146.   end
  147.  
  148. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  149. # I suggest you don't edit anything below this line except for the
  150. # configurations for the add-ons.
  151. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  152.  
  153.   attr_accessor :FPS_MODULATOR
  154.   attr_accessor :SPEED_MODULATOR
  155.   attr_accessor :DEATH_TOLL
  156.   attr_accessor :WINDOW_BATTLERESULT
  157.   attr_accessor :UNIQUE_SKILL_COMMANDS
  158.   attr_accessor :HEAL_AT_LVLUP
  159.   attr_accessor :HPSPPLUS
  160.   attr_accessor :TARGET_EM_ALL
  161.   attr_accessor :QUICK_PASSABILITY_TEST
  162.   attr_accessor :MINIMAP
  163.   attr_accessor :ENEMY_STATUS
  164.   attr_accessor :PASSIVE_SKILLS
  165.   attr_accessor :SKILL_SEPARATION
  166.   attr_accessor :MULTI_HIT
  167.   attr_accessor :EQUIPMENT_REQUIREMENT
  168.   attr_accessor :ITEM_REQUIREMENT
  169.   attr_accessor :HP_SP_CRUSH
  170.   attr_accessor :ROULETTE
  171.   attr_accessor :CHAIN_STATUS
  172.   attr_accessor :ACTOR_ITEMS
  173.   attr_accessor :HP_PERCENT_STATES
  174.   attr_accessor :MONSTER_AREAS
  175.   attr_accessor :REALISTIC_LADDERS
  176.   attr_accessor :EVENT_Z_INDEX_CONTROLLER
  177.  
  178. end
  179.  
  180. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
  181. #                                                                             #
  182. #                   #   # #####  #  #      #  ##### #   #                     #
  183. #                   #   #   #    #  #      #    #    # #                      #
  184. #                   #   #   #    #  #      #    #     #                       #
  185. #                   #   #   #    #  #      #    #     #                       #
  186. #                    ###    #    #  #####  #    #     #                       #
  187. #                                                                             #
  188. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#
  189.  
  190. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  191. # Custom Game Controls by Blizzard
  192. # Version: 4.1
  193. # Date: 19.4.2007
  194. # Date v1.2: 20.10.2007
  195. # Date v2.0b: 3.4.2008
  196. # Date v2.1b: 25.10.2008
  197. # Date v2.2b: 11.6.2009
  198. # Date v3.0: 20.7.2009
  199. # Date v4.0: 22.6.2012
  200. # Date v4.1: 28.7.2012
  201. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  202. #
  203. # VERY IMPORTANT NOTE:
  204. #
  205. #   DO NOT USE THIS ADD-ON IF YOU ARE USING BLIZZ-ABS!!!
  206. #
  207. #
  208. # Compatiblity:
  209. #
  210. #   99% compatible with SDK 1.x, 90% compatible with SDK 2.x.
  211. #
  212. #
  213. # Note:
  214. #
  215. #   Why is this input module better than others? I has far less code and it
  216. #   can handle keyboard language layout.
  217. #
  218. #
  219. # Explanation & Configuration:
  220. #
  221. #   This Add-on will allow you to specify your own game controls. Just below
  222. #   is a list of possible keys, below that is the configuration. The default
  223. #   configuration is RMXP's real game control configuration. You can add any
  224. #   key specification into a key array and separate them with commas. Example:
  225. #  
  226. #   RIGHT = [Key['Arrow Right'], Key[','], Key['F'], Key['Ctrl'], Key['3'],
  227. #            Key['NumberPad 6'], Key['F3'], Key['\''], Key['\\']]
  228. #  
  229. #   This example would assign for the RIGHT button the following keys:
  230. #   - directional right (right arrow key)
  231. #   - comma
  232. #   - letter key F
  233. #   - Control key (CTRL)
  234. #   - Number Key 3 (on top over the letter keys)
  235. #   - Numberpad Key 6 (number 6 on the numberpad on the right)
  236. #   - Functional Key 3 (F3)
  237. #   - apostrophe (')
  238. #   - backslash (\)
  239. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  240.  
  241. if TONS_OF_ADDONS::CUSTOM_CONTROLS
  242.  
  243. #==============================================================================
  244. # module Input
  245. #==============================================================================
  246.  
  247. module Input
  248.  
  249.   #----------------------------------------------------------------------------
  250.   # Simple ASCII table
  251.   #----------------------------------------------------------------------------
  252.   Key = {'A' => 65, 'B' => 66, 'C' => 67, 'D' => 68, 'E' => 69, 'F' => 70,
  253.          'G' => 71, 'H' => 72, 'I' => 73, 'J' => 74, 'K' => 75, 'L' => 76,
  254.          'M' => 77, 'N' => 78, 'O' => 79, 'P' => 80, 'Q' => 81, 'R' => 82,
  255.          'S' => 83, 'T' => 84, 'U' => 85, 'V' => 86, 'W' => 87, 'X' => 88,
  256.          'Y' => 89, 'Z' => 90,
  257.          '0' => 48, '1' => 49, '2' => 50, '3' => 51, '4' => 52, '5' => 53,
  258.          '6' => 54, '7' => 55, '8' => 56, '9' => 57,
  259.          'NumberPad 0' => 45, 'NumberPad 1' => 35, 'NumberPad 2' => 40,
  260.          'NumberPad 3' => 34, 'NumberPad 4' => 37, 'NumberPad 5' => 12,
  261.          'NumberPad 6' => 39, 'NumberPad 7' => 36, 'NumberPad 8' => 38,
  262.          'NumberPad 9' => 33,
  263.          'F1' => 112, 'F2' => 113, 'F3' => 114, 'F4' => 115, 'F5' => 116,
  264.          'F6' => 117, 'F7' => 118, 'F8' => 119, 'F9' => 120, 'F10' => 121,
  265.          'F11' => 122, 'F12' => 123,
  266.          ';' => 186, '=' => 187, ',' => 188, '-' => 189, '.' => 190, '/' => 220,
  267.          '\\' => 191, '\'' => 222, '[' => 219, ']' => 221, '`' => 192,
  268.          'Backspace' => 8, 'Tab' => 9, 'Enter' => 13, 'Shift' => 16,
  269.          'Left Shift' => 160, 'Right Shift' => 161, 'Left Ctrl' => 162,
  270.          'Right Ctrl' => 163, 'Left Alt' => 164, 'Right Alt' => 165,
  271.          'Ctrl' => 17, 'Alt' => 18, 'Esc' => 27, 'Space' => 32, 'Page Up' => 33,
  272.          'Page Down' => 34, 'End' => 35, 'Home' => 36, 'Insert' => 45,
  273.          'Delete' => 46, 'Arrow Left' => 37, 'Arrow Up' => 38,
  274.          'Arrow Right' => 39, 'Arrow Down' => 40,
  275.          'Mouse Left' => 1, 'Mouse Right' => 2, 'Mouse Middle' => 4,
  276.          'Mouse 4' => 5, 'Mouse 5' => 6}
  277. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  278. # START Configuration
  279. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  280.   UP = [Key['Arrow Up']]
  281.   LEFT = [Key['Arrow Left']]
  282.   DOWN = [Key['Arrow Down']]
  283.   RIGHT = [Key['Arrow Right']]
  284.   A = [Key['Shift']]
  285.   B = [Key['Esc'], Key['NumberPad 0'], Key['X']]
  286.   C = [Key['Space'], Key['Enter'], Key['C']]
  287.   X = [Key['A']]
  288.   Y = [Key['S']]
  289.   Z = [Key['D']]
  290.   L = [Key['Q'], Key['Page Down']]
  291.   R = [Key['W'], Key['Page Up']]
  292.   F5 = [Key['F5']]
  293.   F6 = [Key['F6']]
  294.   F7 = [Key['F7']]
  295.   F8 = [Key['F8']]
  296.   F9 = [Key['F9']]
  297.   SHIFT = [Key['Shift']]
  298.   CTRL = [Key['Ctrl']]
  299.   ALT = [Key['Alt']]
  300. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  301. # END Configuration
  302. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  303.   # All keys
  304.   KEY_COUNT = 256
  305.   ALL_KEYS = (0...KEY_COUNT).to_a
  306.   # Win32 API calls
  307.   GetKeyboardState = Win32API.new('user32', 'GetKeyboardState', 'P', 'I')
  308.   GetKeyboardLayout = Win32API.new('user32', 'GetKeyboardLayout', 'L', 'L')
  309.   MapVirtualKeyEx = Win32API.new('user32', 'MapVirtualKeyEx', 'IIL', 'I')
  310.   ToUnicodeEx = Win32API.new('user32', 'ToUnicodeEx', 'LLPPILL', 'L')
  311.   # some other constants
  312.   DOWN_STATE_MASK = 0x80
  313.   DEAD_KEY_MASK = 0x80000000
  314.   # data
  315.   @state = "\0" * KEY_COUNT
  316.   @triggered = Array.new(KEY_COUNT, false)
  317.   @pressed = Array.new(KEY_COUNT, false)
  318.   @released = Array.new(KEY_COUNT, false)
  319.   @repeatedKey = -1
  320.   @repeatedCount = 0
  321.   #----------------------------------------------------------------------------
  322.   # update
  323.   #  Updates input.
  324.   #----------------------------------------------------------------------------
  325.   def self.update
  326.     # prevents usage with Blizz-ABS
  327.     if $BlizzABS
  328.       # error message
  329.       raise 'Blizz-ABS was detected! Please turn off Custom Controls in Tons of Add-ons!'
  330.     end
  331.     # get current language layout
  332.     @language_layout = GetKeyboardLayout.call(0)
  333.     # get new keyboard state
  334.     GetKeyboardState.call(@state)
  335.     # this special code is used because Ruby 1.9.x does not return a char
  336.     # when using String#[] but another String
  337.     key = 0
  338.     @state.each_byte {|byte|
  339.         # if pressed state
  340.         if (byte & DOWN_STATE_MASK) == DOWN_STATE_MASK
  341.           # not released anymore
  342.           @released[key] = false
  343.           # if not pressed yet
  344.           if !@pressed[key]
  345.             # pressed and triggered
  346.             @pressed[key] = true
  347.             @triggered[key] = true
  348.             @repeatedKey = key
  349.             @repeatedCount = 0
  350.           else
  351.             # not triggered anymore
  352.             @triggered[key] = false
  353.           end
  354.           # update of repeat counter
  355.           if key == @repeatedKey
  356.             @repeatedCount < 17 ? @repeatedCount += 1 : @repeatedCount = 15
  357.           end
  358.         # not released yet
  359.         elsif !@released[key]
  360.           # if still pressed
  361.           if @pressed[key]
  362.             # not triggered, pressed or repeated, but released
  363.             @triggered[key] = false
  364.             @pressed[key] = false
  365.             @released[key] = true
  366.             if key == @repeatedKey
  367.               @repeatedKey = -1
  368.               @repeatedCount = 0
  369.             end
  370.           end
  371.         else
  372.           # not released anymore
  373.           @released[key] = false
  374.         end
  375.         key += 1}
  376.   end
  377.   #----------------------------------------------------------------------------
  378.   # dir4
  379.   #  4 direction check.
  380.   #----------------------------------------------------------------------------
  381.   def self.dir4
  382.     return 2 if self.press?(DOWN)
  383.     return 4 if self.press?(LEFT)
  384.     return 6 if self.press?(RIGHT)
  385.     return 8 if self.press?(UP)
  386.     return 0
  387.   end
  388.   #----------------------------------------------------------------------------
  389.   # dir8
  390.   #  8 direction check.
  391.   #----------------------------------------------------------------------------
  392.   def self.dir8
  393.     down = self.press?(DOWN)
  394.     left = self.press?(LEFT)
  395.     return 1 if down && left
  396.     right = self.press?(RIGHT)
  397.     return 3 if down && right
  398.     up = self.press?(UP)
  399.     return 7 if up && left
  400.     return 9 if up && right
  401.     return 2 if down
  402.     return 4 if left
  403.     return 6 if right
  404.     return 8 if up
  405.     return 0
  406.   end
  407.   #----------------------------------------------------------------------------
  408.   # trigger?
  409.   #  Test if key was triggered once.
  410.   #----------------------------------------------------------------------------
  411.   def self.trigger?(keys)
  412.     keys = [keys] unless keys.is_a?(Array)
  413.     return keys.any? {|key| @triggered[key]}
  414.   end
  415.   #----------------------------------------------------------------------------
  416.   # press?
  417.   #  Test if key is being pressed.
  418.   #----------------------------------------------------------------------------
  419.   def self.press?(keys)
  420.     keys = [keys] unless keys.is_a?(Array)
  421.     return keys.any? {|key| @pressed[key]}
  422.   end
  423.   #----------------------------------------------------------------------------
  424.   # repeat?
  425.   #  Test if key is being pressed for repeating.
  426.   #----------------------------------------------------------------------------
  427.   def self.repeat?(keys)
  428.     keys = [keys] unless keys.is_a?(Array)
  429.     return (@repeatedKey >= 0 && keys.include?(@repeatedKey) &&
  430.         (@repeatedCount == 1 || @repeatedCount == 16))
  431.   end
  432.   #----------------------------------------------------------------------------
  433.   # release?
  434.   #  Test if key was released.
  435.   #----------------------------------------------------------------------------
  436.   def self.release?(keys)
  437.     keys = [keys] unless keys.is_a?(Array)
  438.     return keys.any? {|key| @released[key]}
  439.   end
  440.   #----------------------------------------------------------------------------
  441.   # get_character
  442.   #  vk - virtual key
  443.   #  Gets the character from keyboard input using the input locale identifier
  444.   #  (formerly called keyboard layout handles).
  445.   #----------------------------------------------------------------------------
  446.   def self.get_character(vk)
  447.     # get corresponding character from virtual key
  448.     c = MapVirtualKeyEx.call(vk, 2, @language_layout)
  449.     # stop if character is non-printable and not a dead key
  450.     return '' if c < 32 && (c & DEAD_KEY_MASK != DEAD_KEY_MASK)
  451.     # get scan code
  452.     vsc = MapVirtualKeyEx.call(vk, 0, @language_layout)
  453.     # result string is never longer than 4 bytes (Unicode)
  454.     result = "\0" * 4
  455.     # get input string from Win32 API
  456.     length = ToUnicodeEx.call(vk, vsc, @state, result, 4, 0, @language_layout)
  457.     return (length == 0 ? '' : result)
  458.   end
  459.   #----------------------------------------------------------------------------
  460.   # get_input_string
  461.   #  Gets the string that was entered using the keyboard over the input locale
  462.   #  identifier (formerly called keyboard layout handles).
  463.   #----------------------------------------------------------------------------
  464.   def self.get_input_string
  465.     result = ''
  466.     # check every key
  467.     ALL_KEYS.each {|key|
  468.         # if repeated
  469.         if self.repeat?(key)
  470.           # get character from keyboard state
  471.           c = self.get_character(key)
  472.           # add character if there is a character
  473.           result += c if c != ''
  474.         end}
  475.     # empty if result is empty
  476.     return '' if result == ''
  477.     # convert string from Unicode to UTF-8
  478.     return self.unicode_to_utf8(result)
  479.   end
  480.   #----------------------------------------------------------------------------
  481.   # unicode_to_utf8
  482.   #  string - string in Unicode format
  483.   #  Converts a string from Unicode format to UTF-8 format as RGSS does not
  484.   #  support Unicode.
  485.   #----------------------------------------------------------------------------
  486.   def self.unicode_to_utf8(string)
  487.     result = ''
  488.     # L* format means a bunch of 4-byte wide-chars
  489.     string.unpack('L*').each {|c|
  490.         # characters under 0x80 are 1 byte characters
  491.         if c < 0x0080
  492.           result += c.chr
  493.         # other characters under 0x800 are 2 byte characters
  494.         elsif c < 0x0800
  495.           result += (0xC0 | (c >> 6)).chr
  496.           result += (0x80 | (c & 0x3F)).chr
  497.         # other characters under 0x10000 are 3 byte characters
  498.         elsif c < 0x10000
  499.           result += (0xE0 | (c >> 12)).chr
  500.           result += (0x80 | ((c >> 6) & 0x3F)).chr
  501.           result += (0x80 | (c & 0x3F)).chr
  502.         # other characters under 0x200000 are 4 byte characters
  503.         elsif c < 0x200000
  504.           result += (0xF0 | (c >> 18)).chr
  505.           result += (0x80 | ((c >> 12) & 0x3F)).chr
  506.           result += (0x80 | ((c >> 6) & 0x3F)).chr
  507.           result += (0x80 | (c & 0x3F)).chr
  508.         # other characters under 0x4000000 are 5 byte characters
  509.         elsif c < 0x4000000
  510.           result += (0xF8 | (c >> 24)).chr
  511.           result += (0x80 | ((c >> 18) & 0x3F)).chr
  512.           result += (0x80 | ((c >> 12) & 0x3F)).chr
  513.           result += (0x80 | ((c >> 6) & 0x3F)).chr
  514.           result += (0x80 | (c & 0x3F)).chr
  515.         # other characters under 0x80000000 are 6 byte characters
  516.         elsif c < 0x80000000
  517.           result += (0xFC | (c >> 30)).chr
  518.           result += (0x80 | ((c >> 24) & 0x3F)).chr
  519.           result += (0x80 | ((c >> 18) & 0x3F)).chr
  520.           result += (0x80 | ((c >> 12) & 0x3F)).chr
  521.           result += (0x80 | ((c >> 6) & 0x3F)).chr
  522.           result += (0x80 | (c & 0x3F)).chr
  523.         end}
  524.     return result
  525.   end
  526.  
  527. end
  528.  
  529. end
  530.  
  531. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  532. # FPS Modulator by Blizzard
  533. # Version: 1.0b
  534. # Type: Debug Utility
  535. # Date: 12.2.2006
  536. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  537. #
  538. #   Holding SHIFT and pressing Q/W will allow you to speed up the game like in
  539. #   an emulator up to 3 times (sorry, RMXP doesn't allow more). Remove the
  540. #   triple commented lines (###) to allow this feature even in the normal game,
  541. #   not only the Debug mode.
  542. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  543.  
  544. #==============================================================================
  545. # Scene_Map
  546. #==============================================================================
  547.  
  548. class Scene_Map
  549.  
  550.   alias update_fps_later update
  551.   def update
  552.     if $game_system.FPS_MODULATOR
  553.       if $DEBUG ###
  554.         if Input.press?(Input::A) && Input.press?(Input::R)
  555.           Graphics.frame_rate += 40
  556.         elsif Input.press?(Input::A) && Input.trigger?(Input::L)
  557.           Graphics.frame_rate -= 40 unless Graphics.frame_rate == 40
  558.         end
  559.       end ###
  560.     end
  561.     update_fps_later
  562.   end
  563.  
  564. end
  565.  
  566. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  567. # Speed Modulator by Blizzard
  568. # Version: 1.01b
  569. # Type: Debug Utility
  570. # Date: 12.2.2006
  571. # Date v1.01: 12.1.2007
  572. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  573. #
  574. #   Pressing Q/W will allow you to speed up the main character. Pressing SHIFT
  575. #   will reset his speed immediately. Remove the triple commented lines (###)
  576. #   to allow this feature even in the normal game, not only the Debug mode.
  577. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  578.  
  579. #==============================================================================
  580. # Game_Player
  581. #==============================================================================
  582.  
  583. class Game_Player
  584.  
  585.   alias upd_speed_later update
  586.   def update
  587.     if $game_system.SPEED_MODULATOR
  588.       if $DEBUG ###
  589.         if Input.trigger?(Input::A)
  590.           @move_speed = 4
  591.         elsif !Input.press?(Input::A) && !Input.press?(Input::X) &&
  592.             Input.trigger?(Input::R)
  593.           @move_speed += 1 unless @move_speed == 6
  594.         elsif !Input.press?(Input::A) && !Input.press?(Input::X) &&
  595.             Input.trigger?(Input::L)
  596.           @move_speed -= 1 unless @move_speed == 1
  597.         end
  598.       end ###
  599.     end
  600.     upd_speed_later
  601.   end
  602.  
  603. end
  604.  
  605. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  606. # FullScreen? by Blizzard
  607. # Version: 1.22b
  608. # Type: Game Experience Improvement
  609. # Date: 14.11.2006
  610. # Date v1.22b: 8.7.2006
  611. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  612. #
  613. # new in v1.21b:
  614. #   - better code, easier to use
  615. #
  616. # new in v1.22b:
  617. #   - fixes a conflict with SDK v2.2
  618. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  619.  
  620. #==============================================================================
  621. # Window_Command
  622. #==============================================================================
  623.  
  624. class Window_FullScreen < Window_Selectable
  625.  
  626.   def initialize(width, commands)
  627.     super(0, 0, width, commands.size * 32 + 64)
  628.     @item_max = commands.size
  629.     @commands = commands
  630.     self.contents = Bitmap.new(width - 32, @item_max * 32 + 32)
  631.     if $fontface != nil
  632.       self.contents.font.name = $fontface
  633.       self.contents.font.size = $fontsize
  634.     elsif $defaultfonttype != nil
  635.       self.contents.font.name = $defaultfonttype
  636.       self.contents.font.size = $defaultfontsize
  637.     end
  638.     refresh
  639.     self.index = 0
  640.   end
  641.  
  642.   def refresh
  643.     self.contents.clear
  644.     qu = 'Switch to fullscreen?'
  645.     self.contents.draw_text(0, 0, width - 32, 32, qu, 1)
  646.     (0...@item_max).each {|i| draw_item(i, normal_color)}
  647.   end
  648.  
  649.   def draw_item(index, color)
  650.     rect = Rect.new(4, 32+32 * index, self.contents.width - 8, 32)
  651.     rect2 = Rect.new(4+1, 32+32 * index+1, self.contents.width - 8, 32)
  652.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  653.     self.contents.font.color = color
  654.     self.contents.draw_text(rect, @commands[index], 1)
  655.   end
  656.  
  657.   def update_cursor_rect
  658.     if @index < 0
  659.       self.cursor_rect.empty
  660.       return
  661.     end
  662.     row = @index / @column_max
  663.     self.top_row = row if row < self.top_row
  664.     if row > self.top_row + (self.page_row_max - 1)
  665.       self.top_row = row - (self.page_row_max - 1)
  666.     end
  667.     cursor_width = 64
  668.     x = (self.contents.width - cursor_width) / 2
  669.     y = @index / @column_max * 32 - self.oy
  670.     self.cursor_rect.set(x, y + 32, cursor_width, 32)
  671.   end
  672.  
  673. end
  674.  
  675. #==============================================================================
  676. # Scene_Title
  677. #==============================================================================
  678.  
  679. class Scene_Title
  680.  
  681.   alias main_fullscreen? main
  682.   def main
  683.     if TONS_OF_ADDONS::FULLSCREEN && !$DEBUG
  684.       unless $game_started
  685.         Graphics.freeze
  686.         $data_system = load_data('Data/System.rxdata')
  687.         $game_system = Game_System.new
  688.         @window = Window_FullScreen.new(320, ['Yes' ,'No'])
  689.         @window.x = 320 - @window.width / 2
  690.         @window.y = 240 - @window.height / 2
  691.         @window.opacity = 0
  692.         Graphics.transition
  693.         loop do
  694.           Graphics.update
  695.           Input.update
  696.           @window.update
  697.           update_window
  698.           break if $game_started
  699.         end
  700.         Graphics.freeze
  701.         @window.dispose
  702.         @window = nil
  703.         Graphics.transition
  704.         Graphics.freeze
  705.       end
  706.     else
  707.       $game_started = true
  708.     end
  709.     main_fullscreen?
  710.   end
  711.  
  712.   def update_window
  713.     if Input.trigger?(Input::C)
  714.       if @window.index == 0
  715.         $game_system.se_play($data_system.decision_se)
  716.         keybd = Win32API.new 'user32.dll', 'keybd_event', ['i', 'i', 'l', 'l'], 'v'
  717.         keybd.call(0xA4, 0, 0, 0)
  718.         keybd.call(13, 0, 0, 0)
  719.         keybd.call(13, 0, 2, 0)
  720.         keybd.call(0xA4, 0, 2, 0)
  721.       else
  722.         $game_system.se_play($data_system.cancel_se)
  723.       end
  724.       $game_started = true
  725.     elsif Input.trigger?(Input::B)
  726.       $game_system.se_play($data_system.cancel_se)
  727.       $game_started = true
  728.     end
  729.   end
  730.  
  731. end
  732.  
  733. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  734. # Death Toll by Blizzard
  735. # Version: 1.3b
  736. # Type: Playing Statistics Addition
  737. # Date: 10.10.2006
  738. # Date v1.2b: 6.12.2006
  739. # Date v1.3b: 31.7.2007
  740. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  741. #
  742. # Instructions:
  743. #
  744. #   Set ID to the variable ID you want to use to store the number of killed
  745. #   enemies. To show the number just use in a message \v[X] where X is the same
  746. #   number as you set ID.
  747. #
  748. # new in v1.2b:
  749. #   Counts now actor deaths, too. The numbers are stored in the variables with
  750. #   the ID "DT_ID + actor's ID", so i.e. for DT_ID = 26, variable number 26
  751. #   will contain killed enemies, number 27 will contain the deaths of actor
  752. #   with ID 1, number 28 will contain the deaths of actor with ID 2, etc.
  753. #
  754. # new in v1.3b:
  755. #   Fixed a possible conflict with Chaos Rage Limit System.
  756. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  757.  
  758. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  759. # START Configuration
  760. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  761.  
  762. DT_ID = 26 # variable ID
  763.  
  764. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  765. # END Configuration
  766. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  767.  
  768. #==============================================================================
  769. # Scene_Battle
  770. #==============================================================================
  771.  
  772. class Scene_Battle
  773.  
  774.   alias main_dt_later main
  775.   def main
  776.     @td_flag = 0
  777.     main_dt_later
  778.   end
  779.  
  780.   alias upd_dt_later update
  781.   def update
  782.     @td_flag = $game_troop.enemies.size if @td_flag == 0
  783.     upd_dt_later
  784.   end
  785.  
  786.   alias battle_end_td_later battle_end
  787.   def battle_end(result)
  788.     battle_end_td_later(result)
  789.     if $game_system.DEATH_TOLL
  790.       count = 0
  791.       $game_troop.enemies.each {|enemy|
  792.           count += 1 unless enemy.exist? || enemy.hidden}
  793.       $game_variables[DT_ID] += @td_flag - count
  794.     end
  795.   end
  796.  
  797. end
  798.  
  799. #==============================================================================
  800. # Game_Battler
  801. #==============================================================================
  802.  
  803. class Game_Battler
  804.  
  805.   alias hp_is_equal_to_td_later hp=
  806.   def hp=(val)
  807.     hp_is_equal_to_td_later(val)
  808.     if $game_system.DEATH_TOLL && self.is_a?(Game_Actor) && val <= 0
  809.       $game_variables[DT_ID + self.id] += 1
  810.     end
  811.   end
  812.  
  813. end
  814.    
  815. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  816. # Multi-Drop by Blizzard
  817. # Version: 1.1b
  818. # Type: Game Alteration
  819. # Date: 13.11.2007
  820. # Date v1.0b: 3.4.2008
  821. # Date v1.1b: 5.6.2008
  822. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  823. #
  824. # Compatbility:
  825. #  
  826. #   Compatible with RTAB and Blizz-ABS 1.70 and higher. Will most probably
  827. #   cause problems with CBS-es that have the start_phase5 method modified.
  828. #
  829. #
  830. # Explanation:
  831. #  
  832. #   This add-on allows you to make enemies that drop more than one item. The
  833. #   drops are independent, so if an enemy drops one item, he can drop another
  834. #   one as well. An enemy can even have a couple of drop of the same item.
  835. #  
  836. #  
  837. # Instructions:
  838. #  
  839. #   Configure the drop database below and set up the compatibility
  840. #   configuration. The compatibility ocnfiguration is only needed if you are
  841. #   using RTAB. Blizz-ABS 1.70 and higher will be recognized automatically.
  842. #  
  843. #  
  844. # Side note:
  845. #  
  846. #   This add-on could have been written in less than 100 lines of code, but
  847. #   full RTAB compatbility takes its piece of code.
  848. #  
  849. #  
  850. # If you find any bugs, please report them here:
  851. # http://forum.chaos-project.com
  852. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  853.  
  854. if TONS_OF_ADDONS::MULTI_DROP
  855.  
  856. #==============================================================================
  857. # module BlizzCFG
  858. #==============================================================================
  859.  
  860. module BlizzCFG
  861.  
  862.   # set this to true if you are using RTAB
  863.   RTAB_USE = false
  864.   # set this to true if you are using Animated Battlers in RTAB
  865.   RTAB_ANIMA = false
  866.   # set this to true if you are using Battle Report v1.6 by Illustrationism
  867.   RTAB_REPORT = false
  868.   # limit of maximum items dropped, 0xFFFF is infinite
  869.   ITEM_LIMIT = 0xFFFF
  870.  
  871.   def self.drop_configuration(id)
  872.     case id
  873. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  874. # START Drop Database
  875. #
  876. #   Use the following template for configuration:
  877. #
  878. #     when ID then return [[TYPE1, I_ID1, CH1], [TYPE2, I_ID2, CH2], ...]
  879. #  
  880. #   ID   - enemy ID in the database
  881. #   TYPE - the drop type; 1 for items; 2 for weapons; 3 for armors
  882. #   I_ID - the drop item ID in the database
  883. #   CH   - drop chance
  884. #
  885. #   You can add as many drops as you want, separate them with commas. Keep in
  886. #   mind that if you set TYPE to 0, the drop is disabled and that you MUST NOT
  887. #   set I_ID to 0. If an enemy is not configured here, the default
  888. #   configuration from your database will be used, otherwise the default
  889. #   configuration from your database will be COMPLETELY OVERRIDEN.
  890. #  
  891. #   Example 1:
  892. #    
  893. #     when 1 then return [[1, 2, 50], [3, 15, 10], [2, 4, 5]]
  894. #  
  895. #   Monster with ID 1 can drop:
  896. #     1 Item ID 2, chance 50%
  897. #     1 Armor ID 15, chance 10%
  898. #     1 Weapon ID 4, chance 5%
  899. #    
  900. #   Example 2:
  901. #    
  902. #     when 2 then return [[1, 1, 50], [1, 1, 40]]
  903. #  
  904. #   Monster with ID 2 can drop:
  905. #     1 Item ID 1, chance 50%
  906. #     1 Item ID 1, chance 40%
  907. #   Full chances of drops because of repeating items:
  908. #     nothing, chance 30%
  909. #     1 Item ID 1, chance 50%
  910. #     2 Items ID 1, chance 20%
  911. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  912.     when 1 then return [[1, 2, 50], [3, 15, 10], [2, 4, 5]]
  913. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  914. # END Drop Database
  915. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  916.     end
  917.     # return normal item drop if exists
  918.     if $data_enemies[id].item_id > 0
  919.       return [[1, $data_enemies[id].item_id, $data_enemies[id].treasure_prob]]
  920.     elsif $data_enemies[id].weapon_id > 0
  921.       return [[2, $data_enemies[id].weapon_id, $data_enemies[id].treasure_prob]]
  922.     elsif $data_enemies[id].armor_id > 0
  923.       return [[3, $data_enemies[id].armor_id, $data_enemies[id].treasure_prob]]
  924.     end
  925.     # no drop
  926.     return [[0, 0, 0]]
  927.   end
  928.   #----------------------------------------------------------------------------
  929.   # dropped_items
  930.   #  enemy - a killed enemy
  931.   #  This method returns an array of all dropped items.
  932.   #----------------------------------------------------------------------------
  933.   def self.dropped_items(enemy)
  934.     # initialize array
  935.     items = []
  936.     # get drops and start iteration through all drops
  937.     self.drop_configuration(enemy.id).each {|i|
  938.         # if got item
  939.         if rand(100) < i[2]
  940.           # add item, weapon or armor
  941.           case i[0]
  942.           when 1 then items.push($data_items[i[1]])
  943.           when 2 then items.push($data_weapons[i[1]])
  944.           when 3 then items.push($data_armors[i[1]])
  945.           end
  946.         end}
  947.     # result
  948.     return items
  949.   end
  950.  
  951. end
  952.  
  953. #==============================================================================
  954. # Scene_Battle
  955. #==============================================================================
  956.  
  957. class Scene_Battle
  958.  
  959.   #----------------------------------------------------------------------------
  960.   # start_phase5
  961.   #  This method was completely modified to support multi-drop.
  962.   #----------------------------------------------------------------------------
  963.   def start_phase5
  964.     # if RTAB and Animated Battlers in use
  965.     if BlizzCFG::RTAB_USE && BlizzCFG::RTAB_ANIMA
  966.       # don't end battle as long as an actor is moving around
  967.       $game_party.actors.each {|actor| return if @spriteset.battler(actor).moving}
  968.       # see if an actor remains alive
  969.       $victory = true if $game_party.actors.any? {|actor| !actor.dead?}
  970.       # see if an enemy remains alive
  971.       $defeat = true if $game_troop.enemies.reverse.any? {|enemy| !enemy.dead?}
  972.     end
  973.     @phase = 5
  974.     # set audio
  975.     $game_system.me_play($game_system.battle_end_me)
  976.     $game_system.bgm_play($game_temp.map_bgm)
  977.     # initialize variables
  978.     exp, gold, treasures = 0, 0, []
  979.     # if using RTAB
  980.     if BlizzCFG::RTAB_USE && !BlizzCFG::RTAB_REPORT
  981.       # dispose and setup special things from RTAB
  982.       @active_actor.blink = false if @active_actor != nil
  983.       $game_temp.battle_main_phase = true
  984.       @party_command_window.active = @party_command_window.visible =
  985.       @actor_command_window.active = @actor_command_window.visible = false
  986.       [@skill_window, @item_window].each {|win| win.dispose if win != nil}
  987.       @skill_window = @item_window = nil
  988.       @help_window.visible = false if @help_wait == 0
  989.     end
  990.     # iterate through all enemies
  991.     $game_troop.enemies.each {|enemy|
  992.         # if enemy isn't hidden
  993.         unless enemy.hidden
  994.           # get exp and gold
  995.           exp += enemy.exp
  996.           gold += enemy.gold
  997.           # get all dropped items
  998.           treasures += BlizzCFG.dropped_items(enemy)
  999.         end}
  1000.     # limits treasures to a specific number
  1001.     treasures = treasures[0..BlizzCFG::ITEM_LIMIT]
  1002.     # if used battle RTAB battle report
  1003.     if BlizzCFG::RTAB_REPORT
  1004.       # used by battle report
  1005.       @exp, @gold, @treasures = exp, gold, treasures
  1006.     else
  1007.       # iterate through all actor indices
  1008.       $game_party.actors.each_index {|i|
  1009.           actor = $game_party.actors[i]
  1010.           # if actor can get EXP
  1011.           unless actor.cant_get_exp?
  1012.             # store last level
  1013.             last_level = actor.level
  1014.             actor.exp += exp
  1015.             # if level increased after adding EXP
  1016.             if actor.level > last_level
  1017.               @status_window.level_up(i)
  1018.               # if using RTAB
  1019.               if BlizzCFG::RTAB_USE
  1020.                 # execute special RTAB commands
  1021.                 actor.damage[[actor, -1]] = 'Level up!'
  1022.                 actor.up_level = actor.level-last_level
  1023.               end
  1024.             end
  1025.           end}
  1026.       # add to party's gold
  1027.       $game_party.gain_gold(gold)
  1028.       # create result window
  1029.       @result_window = Window_BattleResult.new(exp, gold, treasures)
  1030.     end
  1031.     # iterate through all treasures
  1032.     treasures.each {|item|
  1033.         # add gained treaures to party's inventory
  1034.         case item
  1035.         when RPG::Item then $game_party.gain_item(item.id, 1)
  1036.         when RPG::Weapon then $game_party.gain_weapon(item.id, 1)
  1037.         when RPG::Armor then $game_party.gain_armor(item.id, 1)
  1038.         end}
  1039.     @phase5_wait_count = 100
  1040.   end
  1041.  
  1042. end
  1043.  
  1044. end
  1045.  
  1046. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1047. # Window_BattleResult Add-on by Blizzard
  1048. # Version: 1.2b
  1049. # Type: Game Playability Improvement
  1050. # Date: 27.8.2006
  1051. # Date v1.1b: 11.3.2007
  1052. # Date v1.2b: 13.11.2007
  1053. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1054. #
  1055. # new in v1.1b:
  1056. #   - now fully compatible with Easy LvlUp Notifier 1.3b and higher
  1057. #
  1058. # new in v1.2b:
  1059. #   - fixed glitch where only 2 different items could be shown at the same time
  1060. #
  1061. #
  1062. # Compatibility:
  1063. #
  1064. #   99% compatible with SDK v1.x. 60% compatible with SDK v2.x. 99% chance of
  1065. #   full compatibility with everything else.
  1066. #
  1067. #
  1068. # Features:
  1069. #
  1070. #   - instead of displaying each item seperatedly, it displays now item and
  1071. #     quantity
  1072. #
  1073. #
  1074. # IMPORTANT NOTE:
  1075. #
  1076. #   Keep in mind that RMXP limits the maximum number of gained items to 6. This
  1077. #   add-on was designed to work with any number of items. If you want to
  1078. #   increase or even remove this limit, press CTRL+SHIFT+F and type
  1079. #   "treasures = treasures[0..5]" into the window (without the double quotes).
  1080. #   It will take you directly to the point where this limit is defined. Remove
  1081. #   this line to remove the limit or change the 5 (which means the limit is 6).
  1082. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1083.  
  1084. #==============================================================================
  1085. # Window_BattleResult
  1086. #==============================================================================
  1087.  
  1088. class Window_BattleResult
  1089.  
  1090.   alias init_result_addon_later initialize
  1091.   def initialize(exp, gold, treasures)
  1092.     if $game_system.WINDOW_BATTLERESULT
  1093.       @exp, @gold, @treasures = exp, gold, get_treasures(treasures)
  1094.       super(160, 0, 320, @treasures[0].size * 32 + 64)
  1095.       self.contents = Bitmap.new(width - 32, height - 32)
  1096.       if $fontface != nil
  1097.         self.contents.font.name = $fontface
  1098.       elsif $defaultfonttype != nil
  1099.         self.contents.font.name = $defaultfonttype
  1100.       end
  1101.       self.y, self.back_opacity, self.visible = 160-height/2, 160, false
  1102.       refresh
  1103.     else
  1104.       init_result_addon_later(exp, gold, treasures)
  1105.     end
  1106.   end
  1107.  
  1108.   alias refresh_result_addon_later refresh
  1109.   def refresh
  1110.     if $game_system.WINDOW_BATTLERESULT
  1111.       self.contents.clear
  1112.       x = 4
  1113.       if $easy_lvlup_notifier && !OLD_EXP_DISPLAY
  1114.         self.contents.font.color = system_color
  1115.         cx = contents.text_size('Gained').width
  1116.         self.contents.draw_text(x, 0, cx, 32, 'Gained')
  1117.         x += cx + 4
  1118.       else
  1119.         self.contents.font.color = normal_color
  1120.         cx = contents.text_size(@exp.to_s).width
  1121.         self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
  1122.         x += cx + 4
  1123.         self.contents.font.color = system_color
  1124.         cx = contents.text_size('EXP').width
  1125.         self.contents.draw_text(x, 0, 64, 32, 'EXP')
  1126.         x += cx + 16
  1127.       end
  1128.       self.contents.font.color = normal_color
  1129.       cx = contents.text_size(@gold.to_s).width
  1130.       self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
  1131.       x += cx + 4
  1132.       self.contents.font.color = system_color
  1133.       self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
  1134.       @treasures[0].each_index {|i|
  1135.           draw_item(@treasures[0][i], 4, (i+1)*32, @treasures[1][i])}
  1136.     else
  1137.       refresh_result_addon_later
  1138.     end
  1139.   end
  1140.  
  1141.   def get_treasures(treasures)
  1142.     items, weapons, armors, stuff, qua = [], [], [], [], []
  1143.     treasures.each {|i|
  1144.         case i
  1145.         when RPG::Item then items.push(i)
  1146.         when RPG::Weapon then weapons.push(i)
  1147.         when RPG::Armor then armors.push(i)
  1148.         end}
  1149.     items.each {|i|
  1150.         if stuff.include?(i)
  1151.           qua[stuff.index(i)] += 1
  1152.         else
  1153.           stuff.push(i)
  1154.           qua.push(1)
  1155.         end}
  1156.     weapons.each {|i|
  1157.         if stuff.include?(i)
  1158.           qua[stuff.index(i)] += 1
  1159.         else
  1160.           stuff.push(i)
  1161.           qua.push(1)
  1162.         end}
  1163.     armors.each {|i|
  1164.         if stuff.include?(i)
  1165.           qua[stuff.index(i)] += 1
  1166.         else
  1167.           stuff.push(i)
  1168.           qua.push(1)
  1169.         end}
  1170.     return [stuff, qua]
  1171.   end
  1172.    
  1173.   def draw_item(item, x, y, qua = 1)
  1174.     if item != nil
  1175.       w1 = self.contents.text_size('0').width
  1176.       w2 = self.contents.text_size('x ').width
  1177.       x += w1 + w2 + 4
  1178.       bitmap = RPG::Cache.icon(item.icon_name)
  1179.       self.contents.font.color = system_color
  1180.       self.contents.draw_text(w1 + 8, y, w2, 32, 'x')
  1181.       self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  1182.       self.contents.font.color = normal_color
  1183.       self.contents.draw_text(4, y, w1, 32, qua.to_s, 2)
  1184.       self.contents.draw_text(x+28, y, 212, 32, item.name)
  1185.     end
  1186.   end
  1187.  
  1188. end
  1189.  
  1190. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1191. # Unique Skill Commands by Blizzard
  1192. # Version: 1.3b
  1193. # Type: Actor Individuality Improvement
  1194. # Date: 14.11.2006
  1195. # Date v1.2b: 19.2.2007
  1196. # Date v1.3b: 20.10.2007
  1197. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1198. #
  1199. # new in v1.2b:
  1200. #   - now corresponding to the Actor ID instead of the class ID and only
  1201. #     refreshes the window if neccessary
  1202. #
  1203. # new in v1.3b:
  1204. #   - fixed a possible issue with CBS-es.
  1205. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1206.  
  1207. #==============================================================================
  1208. # Window_Command
  1209. #==============================================================================
  1210.  
  1211. class Window_Command
  1212.  
  1213.   attr_accessor :actor
  1214.  
  1215.   def setup_command_name
  1216.     if @actor != nil
  1217.       old_command = @commands[1]
  1218.       @commands[1] = case @actor.id
  1219. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1220. # START Database
  1221. #
  1222. # Just like usual in all of my scripts and add-on the template is:
  1223. # when X then 'COMMAND'
  1224. # X - class ID on the database
  1225. # COMMAND - the unique skill command for the appropriate class
  1226. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1227.       when 1 then 'Technic'
  1228.       when 2 then 'Lancetech'
  1229.       when 3 then 'Powers'
  1230.       when 4 then 'Skills'
  1231.       when 5 then 'Arrowmagic'
  1232.       when 6 then 'Ammo'
  1233.       when 7 then 'White Magic'
  1234.       when 8 then 'Magic'
  1235. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1236. # END Database
  1237. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1238.       else
  1239.         @commands[1]
  1240.       end
  1241.       refresh if old_command != @commands[1]
  1242.     end
  1243.   end
  1244.  
  1245. end
  1246.  
  1247. #==============================================================================
  1248. # Scene_Battle
  1249. #==============================================================================
  1250.  
  1251. class Scene_Battle
  1252.  
  1253.   alias phase3_setup_command_window_unique_command_later phase3_setup_command_window
  1254.   def phase3_setup_command_window
  1255.     phase3_setup_command_window_unique_command_later
  1256.     if $game_system.UNIQUE_SKILL_COMMANDS
  1257.       @actor_command_window.actor = @active_battler
  1258.       @actor_command_window.setup_command_name
  1259.     end
  1260.   end
  1261.  
  1262. end
  1263.  
  1264. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1265. # Ultimate Font Override by Blizzard
  1266. # Version: 1.02b
  1267. # Type: Project-Script Compatibility Improvement
  1268. # Date: 19.10.2006
  1269. # Date v1.01b: 30.7.2007
  1270. # Date v1.02b: 15.11.2008
  1271. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1272. #
  1273. #   You can change the font/fontsize with the "Call script" event command or
  1274. #   directly through a script by using these methods:
  1275. #
  1276. #     $game_system.fontname = "FONTNAME"
  1277. #     $game_system.fontsize = FONTSIZE
  1278. #
  1279. #   It will override the font from any RMXP version. It is also possible to
  1280. #   change the font during the game. It will be saved, too.
  1281. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1282.  
  1283. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1284. # START Configuration
  1285. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1286.  
  1287. Font.default_name = 'Arial' # default font name
  1288. Font.default_size = 24      # default font size
  1289.  
  1290. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1291. # END Configuration
  1292. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1293.  
  1294. #==============================================================================
  1295. # Game_System
  1296. #==============================================================================
  1297.  
  1298. class Game_System
  1299.  
  1300.   attr_reader :fontname
  1301.   attr_reader :fontsize
  1302.   attr_reader :tons_of_addons
  1303.  
  1304.   alias init_ultimate_font_override_later initialize_tons_of_addons
  1305.   def initialize_tons_of_addons
  1306.     init_ultimate_font_override_later
  1307.     self.fontname = Font.default_name
  1308.     self.fontsize = Font.default_size
  1309.   end
  1310.  
  1311.   alias update_tons_of_addons update
  1312.   def update
  1313.     initialize_tons_of_addons unless @tons_of_addons
  1314.     update_tons_of_addons
  1315.   end
  1316.  
  1317.   def fontname=(name)
  1318.     Font.default_name = $defaultfonttype = $fontface = @fontname = name
  1319.   end
  1320.    
  1321.   def fontsize=(size)
  1322.     Font.default_size = $defaultfontsize = $fontsize = @fontsize = size
  1323.   end
  1324.  
  1325. end
  1326.  
  1327. #==============================================================================
  1328. # Bitmap
  1329. #==============================================================================
  1330.  
  1331. class Bitmap
  1332.  
  1333.   alias init_font_override_later initialize
  1334.   def initialize(w, h = nil)
  1335.     if w.is_a?(Numeric) && h.is_a?(Numeric)
  1336.       init_font_override_later(w, h)
  1337.     else
  1338.       init_font_override_later(w)
  1339.     end
  1340.     if TONS_OF_ADDONS::ULTIMATE_FONT_OVERRIDE
  1341.       if $game_system != nil && $game_system.fontname != nil &&
  1342.           !$scene.is_a?(Scene_Title)
  1343.         self.font.name = $game_system.fontname
  1344.         self.font.size = $game_system.fontsize
  1345.       else
  1346.         self.font.name = Font.default_name
  1347.         self.font.size = Font.default_size
  1348.       end
  1349.     end
  1350.   end
  1351.  
  1352. end
  1353.  
  1354. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1355. # Heal at LvlUp by Blizzard
  1356. # Version: 1.0b
  1357. # Type: Game Alteration
  1358. # Date: 4.12.2006
  1359. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1360. #
  1361. # Compatibility:
  1362. #
  1363. #   90% compatible with SDK v1.x. 40% compatible with SDK v2.x. Might not work
  1364. #   with exotic CBS-es or exotic Status displays during battle.
  1365. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1366.  
  1367. #==============================================================================
  1368. # Window_BattleStatus
  1369. #==============================================================================
  1370.  
  1371. class Window_BattleStatus
  1372.  
  1373.   alias refesh_heal_at_lvlup_later refresh
  1374.   def refresh(number = nil)
  1375.     if $game_system.HEAL_AT_LVLUP
  1376.       $game_party.actors.each_index {|i|
  1377.           if @level_up_flags[i]
  1378.             $game_party.actors[i].hp = $game_party.actors[i].maxhp
  1379.             $game_party.actors[i].sp = $game_party.actors[i].maxsp
  1380.           end}
  1381.     end
  1382.     if number == nil
  1383.       refesh_heal_at_lvlup_later
  1384.     else
  1385.       refesh_heal_at_lvlup_later(number)
  1386.     end
  1387.   end
  1388.  
  1389. end
  1390.  
  1391. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1392. # Weapon/Armor HP/SP Plus by Blizzard
  1393. # Version: 2.1b
  1394. # Type: Weapon/Armor Attribute Alteration
  1395. # Date: 18.8.2006
  1396. # Date v1.01b: 12.3.2007
  1397. # Date v2.0: 15.5.2007
  1398. # Date v2.0b: 30.7.2007
  1399. # Date v2.1b: 11.6.2009
  1400. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1401. #
  1402. # Compatibility:
  1403. #
  1404. #   95% compatible with SDK v1.x. 50% compatible with SDK v2.x. May cause
  1405. #   slight incompatibility issues with CBS-es, but can be made compatible
  1406. #   easily. Can cause imcompatibility issues with other weapon/armor changing
  1407. #   scripts and custom equipments scripts.
  1408. #
  1409. #
  1410. # Features:
  1411. #
  1412. #   - uses static (i.e. 500 HP more) or dynamic (i.e. 30% HP more) increasements
  1413. #   - easy to set up
  1414. #   - does NOT change any rxdata files
  1415. #   - this script comes UNDER SDK SCRIPTS if you use any
  1416. #
  1417. # new in v2.0:
  1418. #   - completely overworked and changed code for better compatibility
  1419. #
  1420. # new in v2.0b:
  1421. #   - fixed a bug that appeared because of a typing mistake
  1422. #
  1423. # new in v2.1b:
  1424. #   - improve coding
  1425. #
  1426. #
  1427. # Instructions:
  1428. #
  1429. # - Explanation:
  1430. #
  1431. #   This script will add the option for Weapons/Armors to have HP/SP pluses
  1432. #   while equipped just like the usual STR, DEX, INT etc. pluses.
  1433. #
  1434. # - Configuration
  1435. #
  1436. #   Find the phrase saying "START" (CTRL+F) to find the database parts. Use the
  1437. #   following template to configure your database:
  1438. #
  1439. #     when ID then return [EXPR, VAL]
  1440. #
  1441. #   ID   - Weapon/Armor ID in the normal database
  1442. #   EXPR - set to false if you want "static" increasement or true if you want
  1443. #          "dynamic" increasement
  1444. #   VAL  - if you use static increasement, set this value to any integer you
  1445. #          want (i.e. 100, -500, 831 etc.) to increase the HP/SP, otherwise set
  1446. #          it to any decimal value of the final HP/SP (i.e. 1.2 = 20% more,
  1447. #          2.3 = 130% more, 0.7 = 30% less)
  1448. #
  1449. #   VAL can be a signed integer (static increasement) OR a decimal number
  1450. #   greater than 0 (dynamic increasement). Change MAX_HP and MAX_SP to
  1451. #   different values if you use another max HP and/or max SP limit than 9999.
  1452. #
  1453. #
  1454. # Side Note:
  1455. #
  1456. #   It took more to write the instructions than to write and test script
  1457. #   itself.
  1458. #
  1459. #
  1460. # If you find any bugs, please report them here:
  1461. # http://forum.chaos-project.com
  1462. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1463.  
  1464. MAX_HP = 9999 # change if needed, 9999 is standard
  1465. MAX_SP = 9999 # change if needed, 9999 is standard
  1466.  
  1467. #==============================================================================
  1468. # module BlizzCFG
  1469. #==============================================================================
  1470.  
  1471. module BlizzCFG
  1472.  
  1473.   def self.weapon_hp_plus(id)
  1474.     case id
  1475. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1476. # START Weapon HP plus Configuration
  1477. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1478.     when 1 then return [false, 350]
  1479.     when 5 then return [true, 1.2]
  1480. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1481. # END Weapon HP plus Configuration
  1482. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1483.     else
  1484.       return [false, 0]
  1485.     end
  1486.   end
  1487.  
  1488.   def self.weapon_sp_plus(id)
  1489.     case id
  1490. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1491. # START Weapon SP plus Configuration
  1492. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1493.     when 25 then return [false, 500]
  1494.     when 29 then return [true, 1.5]
  1495. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1496. # END Weapon SP plus Configuration
  1497. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1498.     else
  1499.       return [false, 0]
  1500.     end
  1501.   end
  1502.  
  1503.   def self.armor_hp_plus(id)
  1504.     case id
  1505. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1506. # START Armor HP plus Configuration
  1507. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1508.     when 1 then return [true, 1.1]
  1509.     when 5 then return [true, 0.5]
  1510.     when 13 then return [false, 90]
  1511.     when 17 then return [false, -450]
  1512.     when 9 then return [true, 1.3]
  1513.     when 21 then return [true, 1.3]
  1514. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1515. # END Armor HP plus Configuration
  1516. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1517.     else
  1518.       return [false, 0]
  1519.     end
  1520.   end
  1521.  
  1522.   def self.armor_sp_plus(id)
  1523.     case id
  1524. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1525. # START Armor SP plus Configuration
  1526. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1527.     when 9 then return [true, 1.3]
  1528.     when 21 then return [true, 1.3]
  1529. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1530. # END Armor SP plus Configuration
  1531. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1532.     else
  1533.       return [false, 0]
  1534.     end
  1535.   end
  1536.  
  1537. end
  1538.  
  1539. #==============================================================================
  1540. # Game_Battler
  1541. #==============================================================================
  1542.  
  1543. class Game_Battler
  1544.  
  1545.   alias maxsp_hpsp_add_on_later maxsp
  1546.   def maxsp
  1547.     val = [MAX_SP, maxsp_hpsp_add_on_later].min
  1548.     @sp = val if @sp > val
  1549.     return val
  1550.   end
  1551.  
  1552. end
  1553.  
  1554. #==============================================================================
  1555. # Game_Actor
  1556. #==============================================================================
  1557.  
  1558. class Game_Actor
  1559.  
  1560.   alias maxhp_hpsp_add_on_later maxhp
  1561.   def maxhp
  1562.     return maxhp_hpsp_add_on_later unless $game_system.HPSPPLUS
  1563.     val = [MAX_HP, maxhp_hpsp_add_on_later].min
  1564.     @hp = val if @hp > val
  1565.     return val
  1566.   end
  1567.  
  1568.   alias base_maxhp_hpsp_add_on_later base_maxhp
  1569.   def base_maxhp
  1570.     return base_maxhp_hpsp_add_on_later unless $game_system.HPSPPLUS
  1571.     plus, multi = 0, 1.0
  1572.     if @weapon_id != 0
  1573.       result = BlizzCFG.weapon_hp_plus(@weapon_id)
  1574.       result[0] ? (multi *= result[1]) : (plus += result[1])
  1575.     end
  1576.     [@armor1_id, @armor2_id, @armor3_id, @armor4_id].each {|id|
  1577.         if id != 0
  1578.           result = BlizzCFG.armor_hp_plus(id)
  1579.           result[0] ? (multi *= result[1]) : (plus += result[1])
  1580.         end}
  1581.     return (multi * (plus + base_maxhp_hpsp_add_on_later)).to_i
  1582.   end
  1583.  
  1584.   alias base_maxsp_hpsp_add_on_later base_maxsp
  1585.   def base_maxsp
  1586.     return base_maxsp_hpsp_add_on_later unless $game_system.HPSPPLUS
  1587.     plus, multi = 0, 1.0
  1588.     if @weapon_id != 0
  1589.       result = BlizzCFG.weapon_sp_plus(@weapon_id)
  1590.       result[0] ? (multi *= result[1]) : (plus += result[1])
  1591.     end
  1592.     [@armor1_id, @armor2_id, @armor3_id, @armor4_id].each {|id|
  1593.         if id != 0
  1594.           result = BlizzCFG.armor_sp_plus(id)
  1595.           result[0] ? (multi *= result[1]) : (plus += result[1])
  1596.         end}
  1597.     return (multi * (plus + base_maxsp_hpsp_add_on_later)).to_i
  1598.   end
  1599.  
  1600. end
  1601.  
  1602. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1603. # EQUAP Skills by Blizzard
  1604. # Version: 4.3b
  1605. # Type: Skill System
  1606. # Date: 28.05.2006
  1607. # Date v2.0: 13.6.2006
  1608. # Date v2.02b: 16.1.2007
  1609. # Date v3.0b: 19.2.2007
  1610. # Date v3.02b: 7.3.2007
  1611. # Date v4.0b: 13.7.2008
  1612. # Date v4.1b: 19.10.2008
  1613. # Date v4.2b: 22.10.2009
  1614. # Date v4.3b: 4.6.2009
  1615. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1616. #
  1617. # Explanation:
  1618. #
  1619. #   This add-on will allow you to bound skills to equipment. Equip it and you
  1620. #   learn the skill, unequip it and you will forget it. The AP system allows to
  1621. #   gain AP for skills and learn the permanently if the max AP for the skill
  1622. #   are gathered. (This system is a very similar one to FF9's AP Skill System.)
  1623. #
  1624. #
  1625. # v2.0:
  1626. #   - fixed bug, that appeared, when more equipment parts had the same skill
  1627. #   - new multi-skill support
  1628. #
  1629. # v2.02b:
  1630. #   - improved coding a little bit
  1631. #
  1632. # v3.0b:
  1633. #   - completely overworked and added optional AP system (similar to FF9)
  1634. #     (I want to mention here I made this especially for blazinhandle =) )
  1635. #
  1636. # v3.02b:
  1637. #   - fixed bugs
  1638. #
  1639. # v4.0b:
  1640. #   - fixed a critical bug
  1641. #   - no more EQUAP element
  1642. #   - skills that have less than 0 max AP cannot be learned
  1643. #   - compatible with Guilamme777's Multi-Slot Equipment System
  1644. #   - works more convenient
  1645. #   - better coding
  1646. #
  1647. # v4.1b:
  1648. #   - fixed problems with gaining AP
  1649. #
  1650. # v4.2b:
  1651. #   - added functionality to prevent some characters from learning certain
  1652. #     skills
  1653. #
  1654. # v4.3b:
  1655. #   - fixed a problem with the configuration
  1656. #   - now AP values are defined by enemy and not be troop anymore
  1657. #
  1658. #
  1659. # Compatibility:
  1660. #
  1661. #   99% compatible with SDK v1.x. 60% compatible with SDK v2.x. WILL cause
  1662. #   incompatibility with custom equipment scripts but there are instructions
  1663. #   how to configure the script. Compatible with Guilamme777's Multi-Slot
  1664. #   Equipment System. Please note, that this script depends on the layout of
  1665. #   your Equip Screen and needs to be put UNDER a CMS script if you are using
  1666. #   one. WILL corrupt your old savegames. Might not work with some CMS-es.
  1667. #
  1668. #
  1669. # Instructions:
  1670. #
  1671. # - Configuration:
  1672. #
  1673. #   Press CRTL+SHIFT+F and type into the window one of the following:
  1674. #
  1675. #     Start EQ Database
  1676. #     Start MAXAP Database
  1677. #     Start GAINAP Database
  1678. #
  1679. #   You can jump now to the database directly. There are more instructions.
  1680. #
  1681. # - Merge with a Custom Equipment System:
  1682. #  
  1683. #   To make this system work with any custom equipment script, you need to
  1684. #   edit the method "prepare_equap" which fetches all current weapon IDs and
  1685. #   armor IDs.
  1686. #
  1687. #
  1688. # NOTE:
  1689. #
  1690. #   DO NOT USE EQUAP SKILLS AS NORMAL SKILLS! THE SYSTEM WORKS WITH TEMPORARY
  1691. #   LEARNING AND FORGETTING THE EQUAP SKILL. IF YOU LET YOUR CHARACTER LEARN AN
  1692. #   EQUAP SKILL BY NORMAL MEANS, HE WILL FORGET IT AFTER HE UNEQUIPS THE
  1693. #   APPROPRIATE EQUIPMENT!
  1694. #
  1695. #
  1696. # If you find any bugs, please report them here:
  1697. # http://forum.chaos-project.com/
  1698. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  1699.  
  1700. if TONS_OF_ADDONS::EQUAP_SKILLS
  1701.  
  1702. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1703. # Start EQUAP General Configuration
  1704. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1705.  
  1706. DISPLAY_AP_GAIN = true # uses a modified Battle Result to display gained AP
  1707. DISPLAY_AP_REQ = true # shows CURRENT_AP/NEEDED_AP in the skill's name
  1708. DISPLAY_AP_ZERO = true # shows 0/0 if the skill can't be learned
  1709. GAIN_DEAD = false # dead actor also gain AP, no matter what
  1710.  
  1711. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1712. # End EQUAP General Configuration
  1713. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1714.  
  1715. #==============================================================================
  1716. # module BlizzCFG
  1717. #==============================================================================
  1718.  
  1719. module BlizzCFG
  1720.  
  1721.   def self.maxap(id)
  1722.     case id
  1723. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1724. # Start of MAXAP Database
  1725. #
  1726. #   Here you can define the APs needed to learn a skill. If you add no skills
  1727. #   here the AP system is automatically disabled. Configure it like this
  1728. #   template:
  1729. #
  1730. #     when SKILL_ID then return MAXAP
  1731. #
  1732. #   SKILL_ID - the ID of the skill that will be learned with AP
  1733. #   MAXAP    - how many AP are required to learn the skill
  1734. #
  1735. #   If you give a skill negative max AP, the skill will be completely bound to
  1736. #   the equipment part and will be forgotten when it is unequipped.
  1737. #
  1738. # Note:
  1739. #
  1740. #   Don't forget to assign your AP skills to equipment in the EQ Database
  1741. #   below. Every skill with 0 AP (default) is a normal skill.
  1742. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1743.     when 1 then return -1
  1744.     when 2 then return 10
  1745. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1746. # End of MAXAP Database
  1747. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1748.     end
  1749.     return 0
  1750.   end
  1751.  
  1752.   def self.gainap(id)
  1753.     case id
  1754. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1755. # Start of GAINAP Database
  1756. #
  1757. #   Here you can define how many AP you will get from enemy troops. Configure
  1758. #   it like this template:
  1759. #
  1760. #     when ENEMY_ID then return GAINAP
  1761. #
  1762. #   ENEMY_ID - the ID of the enemy
  1763. #   GAINAP   - how many AP will the player get from this enemy.
  1764. #
  1765. # Note:
  1766. #
  1767. #   This will automatically be disabled if there are no AP skills.
  1768. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1769.     when 1 then return 2
  1770. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1771. # End of MAXAP Database
  1772. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1773.     end
  1774.     return 0
  1775.   end
  1776.  
  1777.   def self.eq_database(id, weapon = true)
  1778.     skill_ids = []
  1779. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1780. # Start of EQ Database
  1781. #
  1782. #   This is your equipment database. To add one or more new EQUAP skills to a
  1783. #   weapon is very simple. Add another "when"-branch in the script snipplet
  1784. #   below (they have comments next to it). Configure it like this template:
  1785. #
  1786. #     when WEAPON_ID
  1787. #       @skill_ids.push(EQUAP_SKILL_ID1)
  1788. #       @skill_ids.push(EQUAP_SKILL_ID2)
  1789. #
  1790. #   The same works for armors:
  1791. #
  1792. #     when ARMOR_ID
  1793. #       @skill_ids.push(EQUAP_SKILL_ID1)
  1794. #       @skill_ids.push(EQUAP_SKILL_ID2)
  1795. #
  1796. #   The lines are commented below so you should have no problems with the script.
  1797. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1798.     if weapon
  1799.       case id
  1800.       when 1 # weapon ID
  1801.         skill_ids.push(10) # EQUAP skill ID
  1802.         skill_ids.push(11) # EQUAP skill ID
  1803.       when 5
  1804.         skill_ids.push(8)
  1805.         skill_ids.push(12)
  1806.       when 9
  1807.         skill_ids.push(1)
  1808.         skill_ids.push(3)
  1809.       end
  1810.     else
  1811.       case id
  1812.       when 1 # armor ID
  1813.         skill_ids.push(1) # EQUAP skill ID
  1814.         skill_ids.push(25) # EQUAP skill ID
  1815.       when 3
  1816.         skill_ids.push(7)
  1817.         skill_ids.push(4)
  1818.       when 5
  1819.         skill_ids.push(15)
  1820.       when 8
  1821.         skill_ids.push(32)
  1822.         skill_ids.push(29)
  1823.       when 13
  1824.         skill_ids.push(2)
  1825.         skill_ids.push(25)
  1826.       when 18
  1827.         skill_ids.push(27)
  1828.       when 19
  1829.         skill_ids.push(25)
  1830.       when 29
  1831.         skill_ids.push(10)
  1832.       end
  1833. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1834. # End of EQ Database
  1835. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1836.     end
  1837.     return skill_ids
  1838.   end
  1839.  
  1840.   def self.equap_nonlearnable_skills(id)
  1841.     case id
  1842. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1843. # Start of NONLEARNABLE SKILLS Database
  1844. #
  1845. #   Here you can define skills that can't be learned by certain actors at all.
  1846. #   Configure it like this template:
  1847. #
  1848. #     when ACTOR_ID then return [SKILL_ID1, SKILL_ID2, ...]
  1849. #
  1850. #   ACTOR_ID - the ID of the enemy troop
  1851. #   SKILL_ID - the ID of the skill this actor can't learn through EQUAP
  1852. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1853.     when 1 then return [59, 60]
  1854. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1855. # End of NONLEARNABLE SKILLS Database
  1856. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1857.     end
  1858.     return []
  1859.   end
  1860.  
  1861. end
  1862.  
  1863. #==============================================================================
  1864. # Game_Actor
  1865. #==============================================================================
  1866.  
  1867. class Game_Actor
  1868.  
  1869.   alias setup_equap_later setup
  1870.   def setup(id)
  1871.     @ap = {}
  1872.     setup_equap_later(id)
  1873.     test_equap
  1874.   end
  1875.  
  1876.   alias equip_equap_later equip
  1877.   def equip(equip_type, id)
  1878.     equip_equap_later(equip_type, id)
  1879.     test_equap
  1880.   end
  1881.  
  1882.   def add_ap(val)
  1883.     @ap ||= {}
  1884.     @skills.each {|id| @ap[id] = 0 if @ap[id] == nil}
  1885.     @ap.each_key {|id|
  1886.         @ap[id] = self.ap(id) + val
  1887.         @ap[id] = 0 if self.ap(id) < 0
  1888.         maxap = BlizzCFG.maxap(id)
  1889.         @ap[id] = maxap if self.ap(id) > maxap}
  1890.   end
  1891.  
  1892.   def ap(id)
  1893.     @ap ||= {}
  1894.     return (@ap[id] == nil ? 0 : @ap[id])
  1895.   end
  1896.  
  1897.   def prepare_equap ### edit this method for custom equipment support
  1898.     # Guilamme777 compatibility switch
  1899.     return self.weapon_ids, self.armor_ids if defined?(G7_MS_MOD)
  1900.     weapons = [@weapon_id]
  1901.     armors = [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
  1902.     return weapons, armors
  1903.   end
  1904.  
  1905.   def test_equap
  1906.     non_learnable = BlizzCFG.equap_nonlearnable_skills(self.id)
  1907.     (@skills - non_learnable).each {|id|
  1908.         maxap = BlizzCFG.maxap(id)
  1909.         forget_skill(id) if maxap < 0 || self.ap(id) < maxap}
  1910.     weapons, armors = prepare_equap
  1911.     skill_ids = []
  1912.     weapons.each {|id| skill_ids += BlizzCFG.eq_database(id, true)}
  1913.     armors.each {|id| skill_ids += BlizzCFG.eq_database(id, false)}
  1914.     (skill_ids - non_learnable).each {|id| learn_skill(id)}
  1915.   end
  1916.  
  1917. end
  1918.  
  1919. #==============================================================================
  1920. # Game_Troop
  1921. #==============================================================================
  1922.  
  1923. class Game_Troop
  1924.  
  1925.   attr_reader :id
  1926.  
  1927.   alias setup_equap_later setup
  1928.   def setup(troop_id)
  1929.     setup_equap_later(troop_id)
  1930.     @id = troop_id
  1931.   end
  1932.  
  1933. end
  1934.  
  1935. #==============================================================================
  1936. # Window_BattleResult
  1937. #==============================================================================
  1938.  
  1939. class Window_BattleResult
  1940.  
  1941.   def refresh_extra(aps)
  1942.     self.contents.fill_rect(0, 0, self.width, 32, Color.new(0, 0, 0, 0))
  1943.     x = 4
  1944.     self.contents.font.color = normal_color
  1945.     cx = contents.text_size(@exp.to_s).width
  1946.     self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
  1947.     x += cx + 4
  1948.     self.contents.font.color = system_color
  1949.     cx = contents.text_size('EXP').width
  1950.     self.contents.draw_text(x, 0, 64, 32, 'EXP')
  1951.     x += cx + 16
  1952.     self.contents.font.color = normal_color
  1953.     cx = contents.text_size(@gold.to_s).width
  1954.     self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
  1955.     x += cx + 4
  1956.     self.contents.font.color = system_color
  1957.     cx = contents.text_size($data_system.words.gold).width
  1958.     self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
  1959.     x += cx + 16
  1960.     self.contents.font.color = normal_color
  1961.     cx = contents.text_size(aps.to_s).width
  1962.     self.contents.draw_text(x, 0, cx, 32, aps.to_s)
  1963.     x += cx + 4
  1964.     self.contents.font.color = system_color
  1965.     self.contents.draw_text(x, 0, 128, 32, 'AP')
  1966.   end
  1967.  
  1968. end
  1969.  
  1970. #==============================================================================
  1971. # Window_Skill
  1972. #==============================================================================
  1973.  
  1974. class Window_Skill
  1975.  
  1976.   alias draw_item_equap_later draw_item
  1977.   def draw_item(index)
  1978.     skill = @data[index]
  1979.     aps = BlizzCFG.maxap(skill.id)
  1980.     if DISPLAY_AP_REQ && !$scene.is_a?(Scene_Battle) &&
  1981.         (aps > 0 || aps != 0 && DISPLAY_AP_ZERO)
  1982.       if @actor.skill_can_use?(skill.id)
  1983.         self.contents.font.color = normal_color
  1984.       else
  1985.         self.contents.font.color = disabled_color
  1986.       end
  1987.       x, y = 4+index%2*320, index/2*32
  1988.       rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  1989.       self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  1990.       bitmap = RPG::Cache.icon(skill.icon_name)
  1991.       opacity = self.contents.font.color == normal_color ? 255 : 128
  1992.       self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1993.       text = skill.name
  1994.       if aps > 0
  1995.         text += " (#{@actor.ap(skill.id)}/#{aps})"
  1996.       elsif DISPLAY_AP_ZERO
  1997.         text += ' (0/0)'
  1998.       end
  1999.       self.contents.draw_text(x + 28, y, 204, 32, text, 0)
  2000.       self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  2001.     else    
  2002.       draw_item_equap_later(index)
  2003.     end
  2004.   end
  2005.  
  2006. end
  2007.  
  2008. #==============================================================================
  2009. # Scene_Battle
  2010. #==============================================================================
  2011.  
  2012. class Scene_Battle
  2013.  
  2014.   alias start_phase5_equap_later start_phase5
  2015.   def start_phase5
  2016.     start_phase5_equap_later
  2017.     aps = 0
  2018.     $game_troop.enemies.each {|enemy| aps += BlizzCFG.gainap(enemy.id)}
  2019.     @result_window.refresh_extra(aps) if DISPLAY_AP_GAIN
  2020.     $game_party.actors.each {|a| a.add_ap(aps) if !a.dead? || GAIN_DEAD}
  2021.   end
  2022.  
  2023. end
  2024.  
  2025. end
  2026.  
  2027. if TONS_OF_ADDONS::PICTURE_MOVIE_SCENE
  2028. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2029. # Picture Movie Scene by Blizzard
  2030. # Version: 2.3b
  2031. # Type: Scene Creation Utility
  2032. # Date: 3.11.2006
  2033. # Date v2.1b: 17.2.2008
  2034. # Date v2.2b: 13.7.2008
  2035. # Date v2.3b: 15.11.2008
  2036. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2037. #
  2038. # Compatibility:
  2039. #
  2040. #   100% compatible with SDK v1.x. 99% compatible with SDK v2.x.
  2041. #
  2042. #
  2043. # Explanation:
  2044. #
  2045. #   This script will allow you to create picture scenes for different purposes.
  2046. #   You can create Credits, Intros or just picture (comic) movies.
  2047. #
  2048. #
  2049. # Instructions:
  2050. #
  2051. #   Use following syntax to call this script:
  2052. #
  2053. #     $scene = Scene_Pictures.new('NAME', DELAY, BDELAY, FDELAY, EXIT, 'BGM', 'BGS', RET)
  2054. #
  2055. #   NAME   - name of the pictures to be loaded
  2056. #   DELAY  - time of displaying pictures
  2057. #   BDELAY - time delay of displaying between the pictures
  2058. #   FDELAY - time delay of fading between the pictures and blank background
  2059. #   EXIT   - allow exiting (true by default) the scene by pressing ESC/ENTER
  2060. #   BGM    - the name of the background music file to be played (none by default)
  2061. #   BGS    - the name of the background sound file to be played (none by default)
  2062. #   RET    - to which scene to return when done (Scene_Map is default)
  2063. #
  2064. #   All your pictures must be named like STRING and put into a new folder
  2065. #   called Scene inside the Pictures folder with the order number attached.
  2066. #
  2067. # Examples:
  2068. #
  2069. # 1)
  2070. #   $scene = Scene_Pictures.new('animat', 5, 1, 10, false)
  2071. #
  2072. #   A scene will be created where the first picture is located in:
  2073. #     Graphics/Pictures/Scene/animat1.png
  2074. #   The next will be
  2075. #     Graphics/Pictures/Scene/animat2.png
  2076. #   It will display pictures as long as there are some.
  2077. #   The scene can't be interrupted.
  2078. #   Afterwards the Scene_Map will be started.
  2079. #
  2080. # 2)
  2081. #   $scene = Scene_Pictures.new('i_n_t_r_o_', 5, 1, 10, true, nil, nil, Scene_Title)
  2082. #
  2083. #   Graphics/Pictures/Scene/i_n_t_r_o_1.png will be the first.
  2084. #   Graphics/Pictures/Scene/i_n_t_r_o_2.png will be the next after that.
  2085. #   It can be interrupted and will start the title scene after finishing.
  2086. #   Afterwards the Scene_Title will be started.
  2087. #
  2088. # 3)
  2089. #   $scene = Scene_Pictures.new('credits', 5, 1, 12)
  2090. #
  2091. #   Graphics/Pictures/Scene/credits1.png will be the first.
  2092. #   Graphics/Pictures/Scene/credits2.png will be the next after that.
  2093. #   Afterwards the Scene_Map will be started.
  2094. #
  2095. #
  2096. # Hints:
  2097. #
  2098. # - if you want to use this scene an intro before the Title
  2099. #  
  2100. #   Apply the syntax mentioned above in the "Main" script. Just change the
  2101. #   "$scene = Scene_Title.new" (without the double quotes) to the desired scene
  2102. #   call and don't forget to set its returning scene to Scene_Title.
  2103. #  
  2104. # - if you want a scene to start right after the player chooses "New Game"
  2105. #  
  2106. #   Apply the syntax mentioned above in the "Scene_Title" script, in the
  2107. #   "def command_newgame" method. Just change the "$scene = Scene_Map.new"
  2108. #   (without the double quotes) to the desired scene call.
  2109. #  
  2110. #  
  2111. # Note:
  2112. #  
  2113. #   All your BGMs should be in the Audio/BGM folder.
  2114. #
  2115. #
  2116. # If you find any bugs, please report them here:
  2117. # http://forum.chaos-project.com
  2118. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2119.  
  2120. #==============================================================================
  2121. # Scene_Pictures
  2122. #==============================================================================
  2123.  
  2124. class Scene_Pictures
  2125.  
  2126.   def initialize(p, d, h, f, i = true, bgm = nil, bgs = nil, s = Scene_Map)
  2127.     $game_system = Game_System.new if $game_system == nil
  2128.     @names, @delay, @hold, @fade = p, d, h, f
  2129.     @int, @bgm, @bgs, @next_scene = i, bgm, bgs, s
  2130.   end
  2131.  
  2132.   def main
  2133.     Graphics.transition
  2134.     Graphics.freeze
  2135.     delaying(true)
  2136.     Audio.bgm_play("Audio/BGM/#{@bgm}", 100, 100) if @bgm != nil
  2137.     Audio.bgs_play("Audio/BGS/#{@bgs}", 100, 100) if @bgs != nil
  2138.     @pic = RPG::Sprite.new
  2139.     i = 1
  2140.     loop do
  2141.       begin
  2142.         @pic.bitmap = RPG::Cache.picture("Scene/#{@names}#{i}")
  2143.       rescue
  2144.         break
  2145.       end
  2146.       @pic.x, @pic.y = 320 - @pic.bitmap.width/2, 240 - @pic.bitmap.height/2
  2147.       Graphics.transition(@fade)
  2148.       break if delaying
  2149.       if @fade > 0
  2150.         Graphics.freeze
  2151.         @pic.bitmap = nil
  2152.         Graphics.transition(@fade)
  2153.       end
  2154.       break if delaying(true)
  2155.       Graphics.freeze
  2156.       i += 1
  2157.     end
  2158.     unless @pic == nil || @pic.disposed?
  2159.       @pic.dispose
  2160.       Graphics.transition(@fade)
  2161.     else
  2162.       Graphics.transition(4)
  2163.     end
  2164.     delaying(true)
  2165.     Audio.bgm_fade(800) if @bgm != nil
  2166.     Audio.bgs_fade(800) if @bgs != nil
  2167.     Graphics.freeze
  2168.     $scene = @next_scene.new
  2169.   end
  2170.  
  2171.   def delaying(just_hold = false)
  2172.     (0...(just_hold ? @hold : @delay)*40).each {|i|
  2173.         Graphics.update
  2174.         if @int
  2175.           Input.update
  2176.           return true if Input.press?(Input::C) || Input.press?(Input::B)
  2177.         end}
  2178.     return false
  2179.   end
  2180.  
  2181. end
  2182.  
  2183. end
  2184.  
  2185. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2186. # Target 'em all! by Blizzard
  2187. # Version: 1.1b
  2188. # Type: Skill Enhancement
  2189. # Date: 27.9.2006
  2190. # Date v1.1b: 10.12.2007
  2191. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2192. #
  2193. #   This add-on will allow you to create skills that can target all enemies
  2194. #   and all party members. Include all such skill IDs in the FULL_TARGET_IDS
  2195. #   array and separate them with commas. Note that you should make the skill
  2196. #   target all enemies/all party members/etc. to avoid the cursor being
  2197. #   displayed.
  2198. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2199.  
  2200. FULL_TARGET_IDS = []
  2201.  
  2202. #==============================================================================
  2203. # Scene_Battle
  2204. #==============================================================================
  2205.  
  2206. class Scene_Battle
  2207.  
  2208.   alias make_skill_action_result_target_all_later make_skill_action_result
  2209.   def make_skill_action_result(battler = nil, plus_id = nil)
  2210.     if battler == nil
  2211.       if $game_system.TARGET_EM_ALL &&
  2212.           FULL_TARGET_IDS.include?(@active_battler.current_action.skill_id)
  2213.         @target_battlers =
  2214.             ($game_troop.enemies + $game_party.actors).find_all {|b| b.exist?}
  2215.       end
  2216.       make_skill_action_result_target_all_later
  2217.     else
  2218.       if $game_system.TARGET_EM_ALL &&
  2219.           FULL_TARGET_IDS.include?(battler.current_action.skill_id)
  2220.         battler.target =
  2221.             ($game_troop.enemies + $game_party.actors).find_all {|b| b.exist?}
  2222.       end
  2223.       if plus_id == nil
  2224.         make_skill_action_result_target_all_later(battler)
  2225.       else
  2226.         make_skill_action_result_target_all_later(battler, plus_id)
  2227.       end
  2228.     end
  2229.   end
  2230.  
  2231. end
  2232.  
  2233. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2234. # Quick Passability Test by Blizzard
  2235. # Version: 2.1b
  2236. # Type: Debug Utility
  2237. # Date: 7.2.2007
  2238. # Date v2.0: 16.4.2009
  2239. # Date v2.1b: 19.4.2009
  2240. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2241. #
  2242. # Important:
  2243. #
  2244. #   This add-on ONLY works in Debug mode/Testplay mode and is mainly
  2245. #   considered for debugging maps faster.
  2246. #
  2247. #
  2248. # Instructions:
  2249. #
  2250. #   This will put a mask on your map that shows the passability. Trigger on/off
  2251. #   the mask by pressing F6. You can define the color the passable part should
  2252. #   have by changing the TILE_COLOR constant. Use this template:
  2253. #
  2254. #   TILE_COLOR = Color.new(R, G, B, A)
  2255. #
  2256. #   R - red
  2257. #   G - green
  2258. #   B - blue
  2259. #   A - alpha (opacity)
  2260. #
  2261. #   PRECACHED_MAPS will create a file with passability data to improve loading
  2262. #   time of the map during the game. This subsystem will activate each time you
  2263. #   run the game in debug mode and it will update all maps that have been
  2264. #   changed. This can take some time if the maps are relatively big. If you
  2265. #   decide not to use this feature anymore, you should delete the file
  2266. #   Map_Data.abs from the Data folder to save space.
  2267. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2268.  
  2269. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2270. # START Configuration
  2271. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2272.  
  2273. TILE_COLOR = Color.new(255, 64, 0, 96)
  2274. PRECACHED_MAPS = false
  2275.  
  2276. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2277. # END Configuration
  2278. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2279.  
  2280. $quick_pass = 2.1
  2281.  
  2282. #==============================================================================
  2283. # TONS_OF_ADDONS::Cache
  2284. #==============================================================================
  2285.  
  2286. class TONS_OF_ADDONS::Cache
  2287.  
  2288.   def initialize
  2289.     @tons_cache = {}
  2290.     @tons_cache['passable'] = _passable
  2291.     Graphics.update
  2292.   end
  2293.  
  2294.   def get_image(image)
  2295.     return @tons_cache[image]
  2296.   end
  2297.  
  2298.   def _passable
  2299.     b = Bitmap.new(96, 128)
  2300.     b.fill_rect(67, 0, 26, 32, TILE_COLOR)
  2301.     b.fill_rect(66, 1, 1, 30, TILE_COLOR)
  2302.     b.fill_rect(93, 1, 1, 30, TILE_COLOR)
  2303.     b.fill_rect(65, 2, 1, 28, TILE_COLOR)
  2304.     b.fill_rect(94, 2, 1, 28, TILE_COLOR)
  2305.     b.fill_rect(3, 3, 26, 26, TILE_COLOR)
  2306.     b.fill_rect(64, 3, 1, 26, TILE_COLOR)
  2307.     b.fill_rect(95, 3, 1, 26, TILE_COLOR)
  2308.     b.fill_rect(3, 35, 90, 90, TILE_COLOR)
  2309.     return b
  2310.   end
  2311.    
  2312.   def setup_passability(map)
  2313.     return if $BlizzABS
  2314.     @map, result = map, Table.new(map.width, map.height)
  2315.     (0...@map.height).each {|y|
  2316.         Graphics.update if @map.height * @map.width >= 19200 && y % 10 == 0
  2317.         (0...@map.width).each {|x|
  2318.             val = 0x00
  2319.             val |= 0x01 if passable?(x, y, 2) && passable?(x, y+1, 8)
  2320.             val |= 0x02 if passable?(x, y, 4) && passable?(x-1, y, 6)
  2321.             val |= 0x04 if passable?(x, y, 6) && passable?(x+1, y, 4)
  2322.             val |= 0x08 if passable?(x, y, 8) && passable?(x, y-1, 2)
  2323.             result[x, y] = val if val != 0x00}}
  2324.     @map = nil
  2325.     return result
  2326.   end
  2327.  
  2328.   def passable?(x, y, d)
  2329.     return true if x < 0 || x >= @map.width || y < 0 || y >= @map.height
  2330.     bit = (1 << (d / 2 - 1)) & 0x0f
  2331.     [2, 1, 0].each {|i|
  2332.         tile_id = @map.data[x, y, i]
  2333.         if tile_id == nil
  2334.           return false
  2335.         elsif $data_tilesets[@map.tileset_id].passages[tile_id] & bit != 0
  2336.           return false
  2337.         elsif $data_tilesets[@map.tileset_id].passages[tile_id] & 0x0F == 0x0F
  2338.           return false
  2339.         elsif $data_tilesets[@map.tileset_id].priorities[tile_id] == 0
  2340.           return true
  2341.         end}
  2342.     return true
  2343.   end
  2344.  
  2345.   def check_map_data
  2346.     return if $BlizzABS || !PRECACHED_MAPS
  2347.     $data_tilesets = load_data('Data/Tilesets.rxdata')
  2348.     new_data = load_data('Data/MapInfos.rxdata')
  2349.     if !File.exist?('Data/Map_Data.abs')
  2350.       data, dates = {}, {}
  2351.       ids = new_data.keys.sort
  2352.     else
  2353.       data, dates = load_data('Data/Map_Data.abs')
  2354.       keys = new_data.keys.sort
  2355.       keys.each_index {|i|
  2356.           if File.exist?(sprintf('Data/Map%03d.rxdata', keys[i]))
  2357.             file = File.open(sprintf('Data/Map%03d.rxdata', keys[i]), 'r')
  2358.             if dates[keys[i]] != file.mtime
  2359.               data.delete(keys[i])
  2360.               dates.delete(keys[i])
  2361.             end
  2362.             file.close
  2363.           end
  2364.           Graphics.update if i % 20 == 0}
  2365.       (data.keys - keys).each {|id|
  2366.             data.delete(keys[id])
  2367.             dates.delete(keys[id])}
  2368.       ids = keys - data.keys
  2369.     end
  2370.     ids.each {|id|
  2371.         map = load_data(sprintf('Data/Map%03d.rxdata', id))
  2372.         data[id] = setup_passability(map)
  2373.         if File.exist?(sprintf('Data/Map%03d.rxdata', id))
  2374.           f = File.open(sprintf('Data/Map%03d.rxdata', id), 'r')
  2375.           dates[id] = f.mtime
  2376.           f.close
  2377.         end
  2378.         Graphics.update}
  2379.     file = File.open('Data/Map_Data.abs', 'wb')
  2380.     Marshal.dump([data, dates], file)
  2381.     file.close
  2382.     $data_tilesets = nil
  2383.   end
  2384.  
  2385. end
  2386.  
  2387. $tons_cache = TONS_OF_ADDONS::Cache.new
  2388. $tons_cache.check_map_data
  2389.  
  2390. #==============================================================================
  2391. # Game_Map
  2392. #==============================================================================
  2393.  
  2394. class Game_Map
  2395.  
  2396.   alias setup_minimap_later setup
  2397.   def setup(map_id)
  2398.     setup_minimap_later(map_id)
  2399.     unless $DEBUG && $game_system.QUICK_PASSABILITY_TEST || $game_system.MINIMAP
  2400.       return
  2401.     end
  2402.     setup_virtual_passability
  2403.   end
  2404.  
  2405.   def setup_virtual_passability
  2406.     if PRECACHED_MAPS
  2407.       @virtual_passability = load_data('Data/Map_Data.abs')[0][map_id]
  2408.     else
  2409.       @virtual_passability = $tons_cache.setup_passability(@map)
  2410.     end
  2411.   end
  2412.  
  2413.   def virtual_passability
  2414.     setup_virtual_passability if @virtual_passability == nil
  2415.     return @virtual_passability
  2416.   end
  2417.  
  2418. end
  2419.  
  2420. #==============================================================================
  2421. # Scene_Map
  2422. #==============================================================================
  2423.  
  2424. class Scene_Map
  2425.  
  2426.   alias main_quick_passability_later main
  2427.   def main
  2428.     main_quick_passability_later
  2429.     @passable.dispose if @passable != nil
  2430.   end
  2431.  
  2432.   alias upd_quick_passability_later update
  2433.   def update
  2434.     upd_quick_passability_later
  2435.     if $DEBUG && $game_system.QUICK_PASSABILITY_TEST
  2436.       if @passable != nil
  2437.         if Input.trigger?(Input::F6)
  2438.           @passable.dispose
  2439.           @passable = nil
  2440.         else
  2441.           @passable.x = -$game_map.display_x/4
  2442.           @passable.y = -$game_map.display_y/4
  2443.         end
  2444.       elsif Input.trigger?(Input::F6)
  2445.         @passable = create_passable_help
  2446.         unless @passable == nil
  2447.           @passable.x = -$game_map.display_x/4
  2448.           @passable.y = -$game_map.display_y/4
  2449.         end
  2450.       end
  2451.     end
  2452.   end
  2453.  
  2454.   def create_passable_help
  2455.     v_map = $game_map.virtual_passability
  2456.     if $game_map.width * $game_map.height <= 19200
  2457.       sprite = Sprite.new
  2458.       sprite.bitmap = Bitmap.new($game_map.width*32, $game_map.height*32)
  2459.       autotile = $tons_cache.get_image('passable')
  2460.       v_map = $game_map.virtual_passability
  2461.       (0...v_map.xsize).each {|x| (0...v_map.ysize).each {|y|
  2462.           case v_map[x, y]
  2463.           when 0x01 #    D
  2464.             sprite.bitmap.blt(x*32, y*32+16, autotile, Rect.new(0, 0, 32, 16))
  2465.           when 0x02 #   L
  2466.             sprite.bitmap.blt(x*32, y*32, autotile, Rect.new(16, 0, 16, 32))
  2467.           when 0x03 #   LD
  2468.             sprite.bitmap.blt(x*32, y*32, autotile, Rect.new(64, 32, 32, 32))
  2469.           when 0x04 #  R
  2470.             sprite.bitmap.blt(x*32+16, y*32, autotile, Rect.new(0, 0, 16, 32))
  2471.           when 0x05 #  R D
  2472.             sprite.bitmap.blt(x*32, y*32, autotile, Rect.new(0, 32, 32, 32))
  2473.           when 0x06 #  RL
  2474.             sprite.bitmap.blt(x*32, y*32, autotile, Rect.new(32, 32, 32, 16))
  2475.             sprite.bitmap.blt(x*32, y*32+16, autotile, Rect.new(32, 112, 32, 16))
  2476.           when 0x07 #  RLD
  2477.             sprite.bitmap.blt(x*32, y*32, autotile, Rect.new(32, 32, 32, 32))
  2478.           when 0x08 # U
  2479.             sprite.bitmap.blt(x*32, y*32, autotile, Rect.new(0, 16, 32, 16))
  2480.           when 0x09 # U  D
  2481.             sprite.bitmap.blt(x*32, y*32, autotile, Rect.new(0, 64, 16, 32))
  2482.             sprite.bitmap.blt(x*32+16, y*32, autotile, Rect.new(80, 64, 16, 32))
  2483.           when 0x0A # U L
  2484.             sprite.bitmap.blt(x*32, y*32, autotile, Rect.new(64, 96, 32, 32))
  2485.           when 0x0B # U LD
  2486.             sprite.bitmap.blt(x*32, y*32, autotile, Rect.new(64, 64, 32, 32))
  2487.           when 0x0C # UR
  2488.             sprite.bitmap.blt(x*32, y*32, autotile, Rect.new(0, 96, 32, 32))
  2489.           when 0x0D # UR D
  2490.             sprite.bitmap.blt(x*32, y*32, autotile, Rect.new(0, 64, 32, 32))
  2491.           when 0x0E # URL
  2492.             sprite.bitmap.blt(x*32, y*32, autotile, Rect.new(32, 96, 32, 32))
  2493.           when 0x0F # URLD
  2494.             sprite.bitmap.blt(x*32, y*32, autotile, Rect.new(32, 64, 32, 32))
  2495.           end}}
  2496.       sprite.z = 1000
  2497.       return sprite
  2498.     end
  2499.   end
  2500.  
  2501. end
  2502.  
  2503. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2504. # Blizz-ABS Minimap by Blizzard
  2505. # Version: 2.01
  2506. # Type: Game Playability Improvement
  2507. # Date: 7.2.2007
  2508. # Date v2.0: 16.4.2009
  2509. # Date v2.01: 16.3.2013
  2510. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2511. #
  2512. # Compatibility:
  2513. #
  2514. #   95% compatible with SDK v1.x. 60% compatible with SDK v2.x. This add-on
  2515. #   NEEDS "Quick Passability Test" by Blizzard. WILL corrupt your old
  2516. #   savegames. Might not work with special map add-ons. Does NOT work with
  2517. #   pixel-movement without changing the code.
  2518. #
  2519. #
  2520. # Why this minimap script better is than any other (aka features):
  2521. #
  2522. #   - simple display to avoid lag
  2523. #   - custom size, position and opacity, changeable even during the game
  2524. #   - no bitmaps, no pictures to import, only plain script
  2525. #   - automatically makes use of Blizz-ABSEAL if installed to decrease lag even
  2526. #     further
  2527. #
  2528. #
  2529. # Explanation:
  2530. #
  2531. #   This add-on will draw a real-time minimap on the specified X and Y
  2532. #   coordinate on your screen. It will show the player, events that do NOT have
  2533. #   a comment in their code that says "\nomap", that are not parallel
  2534. #   process and that are not auto-start and that are not erased yet. Events
  2535. #   with a teleport/transfer player command will be shown in a different color.
  2536. #   Any event with and comment with "\spc" in their code will be also
  2537. #   displayed differently. Blizz-ABS disables this add-on automatically and
  2538. #   uses the built-in version of the Blizz-ABS Minimap.
  2539. #
  2540. #
  2541. # Instructions:
  2542. #
  2543. #   You can trigger the minimap visible/invisible with F5 during the game.
  2544. #   Set up the starting configuration below. The colors follow a template of:
  2545. #
  2546. #     WHAT_COLOR = Color.new(R, G, B)
  2547. #
  2548. #   R - red
  2549. #   G - green
  2550. #   B - blue
  2551. #
  2552. #   Change the colors of the dots on the map as you prefer it.
  2553. #
  2554. #   PLAYER_COLOR    - the player on the minimap
  2555. #   EVENT_COLOR     - any event on the minimap that is not erased, is not
  2556. #                     auto-start, is not parallel process and does not have a
  2557. #                     comment in its code with the word "no_minimap"
  2558. #   TELEPORT_COLOR  - any event like the one above, but that has a teleport/
  2559. #                     transfer_player command
  2560. #   SPECIAL_COLOR   - any event with a comment with the word "special"
  2561. #   MINIMAP_X       - default X of the minimap on the screen
  2562. #   MINIMAP_Y       - default Y of the minimap on the screen
  2563. #   MINIMAP_WIDTH   - default maximal allowed width of the minimap
  2564. #   MINIMAP_HEIGHT  - default maximal allowed height of the minimap
  2565. #   MINIMAP_OPACITY - default opacity of the minimap on the screen
  2566. #
  2567. #   You have the possibility to change the minimap's size, coordinates and
  2568. #   opacity during the game process. The command you need to type in into a
  2569. #   "Call Script" command window are:
  2570. #
  2571. #     $game_system.set_minimap_coordinates(X, Y)
  2572. #     $game_system.set_minimap_size(W, H)
  2573. #     $game_system.set_minimap_opacity(A)
  2574. #
  2575. #   X - new X
  2576. #   Y - new Y
  2577. #   W - new width
  2578. #   H - new height
  2579. #   A - new opacity
  2580. #
  2581. #   Any changes will be applied instantly. Note that you don't need to use ALL
  2582. #   commands.
  2583. #   The minimap mode can be changed using this code:
  2584. #
  2585. #     $game_system.minimap_mode = MODE
  2586. #
  2587. #   MODE - new mode (0 = off; 1 = on; 2 = full map)
  2588. #
  2589. #
  2590. # Note:
  2591. #
  2592. #   Changing X, Y and opacity during the game will result in just moving the
  2593. #   sprite. The minimap will not work if the maximal allowed size is smaller
  2594. #   than the map size. (i.e. if your minimap is 160x120, maps like 170x130,
  2595. #   180x15 or 20x140 will not work.)
  2596. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2597.  
  2598. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2599. # Start Configuration
  2600. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2601.  
  2602. PLAYER_COLOR = Color.new(0, 255, 0)
  2603. EVENT_COLOR = Color.new(0, 128, 255)
  2604. TELEPORT_COLOR = Color.new(255, 255, 0)
  2605. SPECIAL_COLOR = Color.new(255, 0, 0)
  2606. MINIMAP_X = 0
  2607. MINIMAP_Y = 0
  2608. MINIMAP_WIDTH = 160
  2609. MINIMAP_HEIGHT = 160
  2610. MINIMAP_OPACITY = 160
  2611. MAP_MOVE_BUTTON = Input::Z
  2612.  
  2613. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2614. # End Configuration
  2615. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2616.  
  2617. if !$quick_pass
  2618.   raise 'Attention! Minimap is missing a vital add-on! Application will now close!'
  2619. end
  2620.  
  2621. #==============================================================================
  2622. # TONS_OF_ADDONS::Cache
  2623. #==============================================================================
  2624.  
  2625. class TONS_OF_ADDONS::Cache
  2626.  
  2627.   alias init_blizzabsminimap_later initialize
  2628.   def initialize
  2629.     init_blizzabsminimap_later
  2630.     @tons_cache['minimap_autotile'] = _minimap_autotile
  2631.     Graphics.update
  2632.     @tons_cache['white_arrow'] = _white_arrow
  2633.     Graphics.update
  2634.     @tons_cache['green_arrow'] = _green_arrow
  2635.     Graphics.update
  2636.     @tons_cache['blue_arrow'] = @tons_cache['green_arrow'].clone
  2637.     @tons_cache['blue_arrow'].hue_change(120)
  2638.     @tons_cache['red_arrow'] = @tons_cache['green_arrow'].clone
  2639.     @tons_cache['red_arrow'].hue_change(-120)
  2640.     @tons_cache['yellow_arrow'] = @tons_cache['green_arrow'].clone
  2641.     @tons_cache['yellow_arrow'].hue_change(-60)
  2642.     @tons_cache['violet_arrow'] = @tons_cache['green_arrow'].clone
  2643.     @tons_cache['violet_arrow'].hue_change(150)
  2644.     Graphics.update
  2645.   end
  2646.  
  2647.   def get_image(image)
  2648.     return @tons_cache[image]
  2649.   end
  2650.  
  2651.   def _white_arrow
  2652.     b = Bitmap.new(56, 14)
  2653.     c1 = Color.new(0, 0, 0)
  2654.     c2 = Color.new(255, 255, 255)
  2655.     b.set_pixel(23, 0, c1)
  2656.     b.set_pixel(32, 0, c1)
  2657.     b.set_pixel(22, 1, c1)
  2658.     b.fill_rect(23, 1, 1, 12, c2)
  2659.     b.fill_rect(24, 1, 1, 12, c1)
  2660.     b.fill_rect(31, 1, 1, 12, c1)
  2661.     b.fill_rect(32, 1, 1, 12, c2)
  2662.     b.set_pixel(33, 1, c1)
  2663.     b.set_pixel(21, 2, c1)
  2664.     b.fill_rect(22, 2, 1, 10, c2)
  2665.     b.fill_rect(33, 2, 1, 10, c2)
  2666.     b.set_pixel(34, 2, c1)
  2667.     b.fill_rect(1, 3, 12, 1, c1)
  2668.     b.set_pixel(20, 3, c1)
  2669.     b.fill_rect(21, 3, 1, 8, c2)
  2670.     b.fill_rect(34, 3, 1, 8, c2)
  2671.     b.set_pixel(35, 3, c1)
  2672.     b.fill_rect(48, 3, 2, 1, c1)
  2673.     b.set_pixel(0, 4, c1)
  2674.     b.fill_rect(1, 4, 12, 1, c2)
  2675.     b.set_pixel(13, 4, c1)
  2676.     b.set_pixel(19, 4, c1)
  2677.     b.fill_rect(20, 4, 1, 6, c2)
  2678.     b.fill_rect(35, 4, 1, 6, c2)
  2679.     b.set_pixel(36, 4, c1)
  2680.     b.set_pixel(47, 4, c1)
  2681.     b.fill_rect(48, 4, 2, 6, c2)
  2682.     b.set_pixel(50, 4, c1)
  2683.     b.set_pixel(1, 5, c1)
  2684.     b.fill_rect(2, 5, 10, 1, c2)
  2685.     b.set_pixel(12, 5, c1)
  2686.     b.set_pixel(18, 5, c1)
  2687.     b.fill_rect(19, 5, 1, 4, c2)
  2688.     b.fill_rect(36, 5, 1, 4, c2)
  2689.     b.set_pixel(37, 5, c1)
  2690.     b.set_pixel(46, 5, c1)
  2691.     b.fill_rect(47, 5, 1, 5, c2)
  2692.     b.fill_rect(50, 5, 1, 5, c2)
  2693.     b.set_pixel(51, 5, c1)
  2694.     b.set_pixel(2, 6, c1)
  2695.     b.fill_rect(3, 6, 8, 1, c2)
  2696.     b.set_pixel(11, 6, c1)
  2697.     b.fill_rect(17, 6, 1, 2, c1)
  2698.     b.fill_rect(18, 6, 1, 2, c2)
  2699.     b.fill_rect(37, 6, 1, 2, c2)
  2700.     b.fill_rect(38, 6, 1, 2, c1)
  2701.     b.set_pixel(45, 6, c1)
  2702.     b.fill_rect(46, 6, 1, 4, c2)
  2703.     b.fill_rect(51, 6, 1, 4, c2)
  2704.     b.set_pixel(52, 6, c1)
  2705.     b.set_pixel(3, 7, c1)
  2706.     b.fill_rect(4, 7, 6, 1, c2)
  2707.     b.set_pixel(10, 7, c1)
  2708.     b.set_pixel(44, 7, c1)
  2709.     b.fill_rect(45, 7, 1, 3, c2)
  2710.     b.fill_rect(52, 7, 1, 3, c2)
  2711.     b.set_pixel(53, 7, c1)
  2712.     b.set_pixel(4, 8, c1)
  2713.     b.fill_rect(5, 8, 4, 1, c2)
  2714.     b.set_pixel(9, 8, c1)
  2715.     b.set_pixel(18, 8, c1)
  2716.     b.set_pixel(37, 8, c1)
  2717.     b.set_pixel(43, 8, c1)
  2718.     b.fill_rect(44, 8, 1, 2, c2)
  2719.     b.fill_rect(53, 8, 1, 2, c2)
  2720.     b.set_pixel(54, 8, c1)
  2721.     b.set_pixel(5, 9, c1)
  2722.     b.fill_rect(6, 9, 2, 1, c2)
  2723.     b.set_pixel(8, 9, c1)
  2724.     b.set_pixel(19, 9, c1)
  2725.     b.set_pixel(36, 9, c1)
  2726.     b.set_pixel(42, 9, c1)
  2727.     b.set_pixel(43, 9, c2)
  2728.     b.set_pixel(54, 9, c2)
  2729.     b.set_pixel(55, 9, c1)
  2730.     b.fill_rect(6, 10, 2, 1, c1)
  2731.     b.set_pixel(20, 10, c1)
  2732.     b.set_pixel(35, 10, c1)
  2733.     b.fill_rect(43, 10, 12, 1, c1)
  2734.     b.set_pixel(21, 11, c1)
  2735.     b.set_pixel(34, 11, c1)
  2736.     b.set_pixel(22, 12, c1)
  2737.     b.set_pixel(33, 12, c1)
  2738.     b.set_pixel(23, 13, c1)
  2739.     b.set_pixel(32, 13, c1)
  2740.     return b
  2741.   end
  2742.  
  2743.   def _green_arrow
  2744.     b = Bitmap.new(56, 14)
  2745.     c1 = Color.new(0, 0, 0)
  2746.     c2 = Color.new(255, 255, 255)
  2747.     c3 = Color.new(0, 255, 0)
  2748.     b.set_pixel(23, 0, c1)
  2749.     b.set_pixel(32, 0, c1)
  2750.     b.set_pixel(22, 1, c1)
  2751.     b.fill_rect(23, 1, 1, 12, c3)
  2752.     b.fill_rect(24, 1, 1, 12, c1)
  2753.     b.fill_rect(31, 1, 1, 12, c1)
  2754.     b.fill_rect(32, 1, 1, 12, c3)
  2755.     b.set_pixel(33, 1, c1)
  2756.     b.set_pixel(21, 2, c1)
  2757.     b.fill_rect(22, 2, 1, 10, c3)
  2758.     b.fill_rect(33, 2, 1, 10, c3)
  2759.     b.set_pixel(34, 2, c1)
  2760.     b.fill_rect(1, 3, 12, 1, c1)
  2761.     b.set_pixel(20, 3, c1)
  2762.     b.fill_rect(21, 3, 1, 8, c3)
  2763.     b.fill_rect(34, 3, 1, 8, c3)
  2764.     b.set_pixel(35, 3, c1)
  2765.     b.fill_rect(48, 3, 2, 1, c1)
  2766.     b.set_pixel(0, 4, c1)
  2767.     b.fill_rect(1, 4, 12, 1, c3)
  2768.     b.set_pixel(13, 4, c1)
  2769.     b.set_pixel(19, 4, c1)
  2770.     b.fill_rect(20, 4, 1, 6, c3)
  2771.     b.fill_rect(35, 4, 1, 6, c3)
  2772.     b.set_pixel(36, 4, c1)
  2773.     b.set_pixel(47, 4, c1)
  2774.     b.fill_rect(48, 4, 2, 6, c3)
  2775.     b.set_pixel(50, 4, c1)
  2776.     b.set_pixel(1, 5, c1)
  2777.     b.fill_rect(2, 5, 10, 1, c3)
  2778.     b.set_pixel(12, 5, c1)
  2779.     b.set_pixel(18, 5, c1)
  2780.     b.fill_rect(19, 5, 1, 4, c3)
  2781.     b.fill_rect(36, 5, 1, 4, c3)
  2782.     b.set_pixel(37, 5, c1)
  2783.     b.set_pixel(46, 5, c1)
  2784.     b.fill_rect(47, 5, 1, 5, c3)
  2785.     b.fill_rect(50, 5, 1, 5, c3)
  2786.     b.set_pixel(51, 5, c1)
  2787.     b.set_pixel(2, 6, c1)
  2788.     b.fill_rect(3, 6, 8, 1, c3)
  2789.     b.set_pixel(11, 6, c1)
  2790.     b.fill_rect(17, 6, 1, 2, c1)
  2791.     b.fill_rect(18, 6, 1, 2, c3)
  2792.     b.fill_rect(37, 6, 1, 2, c3)
  2793.     b.fill_rect(38, 6, 1, 2, c1)
  2794.     b.set_pixel(45, 6, c1)
  2795.     b.fill_rect(46, 6, 1, 4, c3)
  2796.     b.fill_rect(51, 6, 1, 4, c3)
  2797.     b.set_pixel(52, 6, c1)
  2798.     b.set_pixel(3, 7, c1)
  2799.     b.fill_rect(4, 7, 6, 1, c3)
  2800.     b.set_pixel(10, 7, c1)
  2801.     b.set_pixel(44, 7, c1)
  2802.     b.fill_rect(45, 7, 1, 3, c3)
  2803.     b.fill_rect(52, 7, 1, 3, c3)
  2804.     b.set_pixel(53, 7, c1)
  2805.     b.set_pixel(4, 8, c1)
  2806.     b.fill_rect(5, 8, 4, 1, c3)
  2807.     b.set_pixel(9, 8, c1)
  2808.     b.set_pixel(18, 8, c1)
  2809.     b.set_pixel(37, 8, c1)
  2810.     b.set_pixel(43, 8, c1)
  2811.     b.fill_rect(44, 8, 1, 2, c3)
  2812.     b.fill_rect(53, 8, 1, 2, c3)
  2813.     b.set_pixel(54, 8, c1)
  2814.     b.set_pixel(5, 9, c1)
  2815.     b.fill_rect(6, 9, 2, 1, c3)
  2816.     b.set_pixel(8, 9, c1)
  2817.     b.set_pixel(19, 9, c1)
  2818.     b.set_pixel(36, 9, c1)
  2819.     b.set_pixel(42, 9, c1)
  2820.     b.set_pixel(43, 9, c3)
  2821.     b.set_pixel(54, 9, c3)
  2822.     b.set_pixel(55, 9, c1)
  2823.     b.fill_rect(6, 10, 2, 1, c1)
  2824.     b.set_pixel(20, 10, c1)
  2825.     b.set_pixel(35, 10, c1)
  2826.     b.fill_rect(43, 10, 12, 1, c1)
  2827.     b.set_pixel(21, 11, c1)
  2828.     b.set_pixel(34, 11, c1)
  2829.     b.set_pixel(22, 12, c1)
  2830.     b.set_pixel(33, 12, c1)
  2831.     b.set_pixel(23, 13, c1)
  2832.     b.set_pixel(32, 13, c1)
  2833.     return b
  2834.   end
  2835.    
  2836.   def _minimap_autotile
  2837.     b = Bitmap.new(24, 32)
  2838.     c1 = Color.new(191, 191, 191)
  2839.     c2 = Color.new(255, 255, 255)
  2840.     b.fill_rect(2, 0, 4, 1, c2)
  2841.     b.set_pixel(1, 1, c2)
  2842.     b.fill_rect(2, 1, 4, 6, c1)
  2843.     b.set_pixel(6, 1, c2)
  2844.     b.fill_rect(0, 2, 1, 4, c2)
  2845.     b.fill_rect(1, 2, 1, 4, c1)
  2846.     b.fill_rect(6, 2, 1, 4, c1)
  2847.     b.fill_rect(7, 2, 1, 4, c2)
  2848.     b.set_pixel(1, 6, c2)
  2849.     b.set_pixel(6, 6, c2)
  2850.     b.fill_rect(2, 7, 4, 1, c2)
  2851.     b.fill_rect(7, 8, 10, 1, c2)
  2852.     b.set_pixel(6, 9, c2)
  2853.     b.fill_rect(7, 9, 10, 22, c1)
  2854.     b.set_pixel(17, 9, c2)
  2855.     b.set_pixel(5, 10, c2)
  2856.     b.fill_rect(6, 10, 1, 20, c1)
  2857.     b.fill_rect(17, 10, 1, 20, c1)
  2858.     b.set_pixel(18, 10, c2)
  2859.     b.set_pixel(4, 11, c2)
  2860.     b.fill_rect(5, 11, 1, 18, c1)
  2861.     b.fill_rect(18, 11, 1, 18, c1)
  2862.     b.set_pixel(19, 11, c2)
  2863.     b.set_pixel(3, 12, c2)
  2864.     b.fill_rect(4, 12, 1, 16, c1)
  2865.     b.fill_rect(19, 12, 1, 16, c1)
  2866.     b.set_pixel(20, 12, c2)
  2867.     b.set_pixel(2, 13, c2)
  2868.     b.fill_rect(3, 13, 1, 14, c1)
  2869.     b.fill_rect(20, 13, 1, 14, c1)
  2870.     b.set_pixel(21, 13, c2)
  2871.     b.set_pixel(1, 14, c2)
  2872.     b.fill_rect(2, 14, 1, 12, c1)
  2873.     b.fill_rect(21, 14, 1, 12, c1)
  2874.     b.set_pixel(22, 14, c2)
  2875.     b.fill_rect(0, 15, 1, 10, c2)
  2876.     b.fill_rect(1, 15, 1, 10, c1)
  2877.     b.fill_rect(22, 15, 1, 10, c1)
  2878.     b.fill_rect(23, 15, 1, 10, c2)
  2879.     b.set_pixel(1, 25, c2)
  2880.     b.set_pixel(22, 25, c2)
  2881.     b.set_pixel(2, 26, c2)
  2882.     b.set_pixel(21, 26, c2)
  2883.     b.set_pixel(3, 27, c2)
  2884.     b.set_pixel(20, 27, c2)
  2885.     b.set_pixel(4, 28, c2)
  2886.     b.set_pixel(19, 28, c2)
  2887.     b.set_pixel(5, 29, c2)
  2888.     b.set_pixel(18, 29, c2)
  2889.     b.set_pixel(6, 30, c2)
  2890.     b.set_pixel(17, 30, c2)
  2891.     b.fill_rect(7, 31, 10, 1, c2)
  2892.     return b
  2893.   end
  2894.  
  2895.   def load_minimap_bitmap
  2896.     autotile = self.get_image('minimap_autotile')
  2897.     w, h = $game_map.width, $game_map.height
  2898.     bitmap = Bitmap.new(8*w, 8*h)
  2899.     bitmap.fill_rect(0, 0, 8*w, 8*h, Color.new(0, 0, 0, 128))
  2900.     v_map = $game_map.virtual_passability
  2901.     (0...v_map.xsize).each {|x| (0...v_map.ysize).each {|y|
  2902.         case v_map[x, y]
  2903.         when 0x01 #    D
  2904.           bitmap.blt(x*8, y*8+4, autotile, Rect.new(0, 0, 8, 4), 128)
  2905.         when 0x02 #   L
  2906.           bitmap.blt(x*8, y*8, autotile, Rect.new(4, 0, 4, 8), 128)
  2907.         when 0x03 #   LD
  2908.           bitmap.blt(x*8, y*8, autotile, Rect.new(16, 8, 8, 8), 128)
  2909.         when 0x04 #  R
  2910.           bitmap.blt(x*8+4, y*8, autotile, Rect.new(0, 0, 4, 8), 128)
  2911.         when 0x05 #  R D
  2912.           bitmap.blt(x*8, y*8, autotile, Rect.new(0, 8, 8, 8), 128)
  2913.         when 0x06 #  RL
  2914.           bitmap.blt(x*8, y*8, autotile, Rect.new(8, 8, 8, 4), 128)
  2915.           bitmap.blt(x*8, y*8+4, autotile, Rect.new(8, 28, 8, 4), 128)
  2916.         when 0x07 #  RLD
  2917.           bitmap.blt(x*8, y*8, autotile, Rect.new(8, 8, 8, 8), 128)
  2918.         when 0x08 # U
  2919.           bitmap.blt(x*8, y*8, autotile, Rect.new(0, 4, 8, 4), 128)
  2920.         when 0x09 # U  D
  2921.           bitmap.blt(x*8, y*8, autotile, Rect.new(0, 16, 4, 8), 128)
  2922.           bitmap.blt(x*8+4, y*8, autotile, Rect.new(20, 16, 4, 8), 128)
  2923.         when 0x0A # U L
  2924.           bitmap.blt(x*8, y*8, autotile, Rect.new(16, 24, 8, 8), 128)
  2925.         when 0x0B # U LD
  2926.           bitmap.blt(x*8, y*8, autotile, Rect.new(16, 16, 8, 8), 128)
  2927.         when 0x0C # UR
  2928.           bitmap.blt(x*8, y*8, autotile, Rect.new(0, 24, 8, 8), 128)
  2929.         when 0x0D # UR D
  2930.           bitmap.blt(x*8, y*8, autotile, Rect.new(0, 16, 8, 8), 128)
  2931.         when 0x0E # URL
  2932.           bitmap.blt(x*8, y*8, autotile, Rect.new(8, 24, 8, 8), 128)
  2933.         when 0x0F # URLD
  2934.           bitmap.blt(x*8, y*8, autotile, Rect.new(8, 16, 8, 8), 128)
  2935.         end}}
  2936.     @tons_cache['minimap_bitmap'] = bitmap
  2937.   end
  2938.  
  2939. end
  2940.  
  2941. $tons_cache = TONS_OF_ADDONS::Cache.new
  2942. $tons_cache.check_map_data
  2943.  
  2944. #==============================================================================
  2945. # Game_System
  2946. #==============================================================================
  2947.  
  2948. class Game_System
  2949.  
  2950.   attr_reader   :minimap_x
  2951.   attr_reader   :minimap_y
  2952.   attr_reader   :minimap_w
  2953.   attr_reader   :minimap_h
  2954.   attr_reader   :minimap_a
  2955.   attr_accessor :minimap_mode
  2956.  
  2957.   alias init_minimap_later initialize_tons_of_addons
  2958.   def initialize_tons_of_addons
  2959.     init_minimap_later
  2960.     @minimap_mode = 0
  2961.     @minimap_x = [[MINIMAP_X, 0].max, 640].min
  2962.     @minimap_y = [[MINIMAP_Y, 0].max, 480].min
  2963.     @minimap_w = [[MINIMAP_WIDTH, 0].max, 640].min
  2964.     @minimap_h = [[MINIMAP_HEIGHT, 0].max, 480].min
  2965.     @minimap_a = [[MINIMAP_OPACITY, 0].max, 255].min
  2966.   end
  2967.  
  2968.   def set_minimap_coordinates(x, y)
  2969.     @minimap_x, @minimap_y = [[x, 0].max, 640].min, [[y, 0].max, 480].min
  2970.   end
  2971.  
  2972.   def set_minimap_size(w, h)
  2973.     @minimap_w, @minimap_h = [[w, 0].max, 640].min, [[h, 0].max, 480].min
  2974.   end
  2975.  
  2976.   def set_minimap_opacity(a)
  2977.     @minimap_a = [[a, 0].max, 255].min
  2978.   end
  2979.  
  2980. end
  2981.  
  2982. #==============================================================================
  2983. # Game_Map
  2984. #==============================================================================
  2985.  
  2986. class Game_Map
  2987.  
  2988.   alias setup_blizzabsminimap_later setup
  2989.   def setup(map_id)
  2990.     setup_blizzabsminimap_later(map_id)
  2991.     return if $BlizzABS
  2992.     $tons_cache.load_minimap_bitmap
  2993.   end
  2994.  
  2995. end
  2996.  
  2997. #==============================================================================
  2998. # Game_Character
  2999. #==============================================================================
  3000.  
  3001. class Game_Character
  3002.  
  3003.   def update? # Blizz-ABSEAL compatibility
  3004.     return true
  3005.   end
  3006.  
  3007. end
  3008.  
  3009. #==============================================================================
  3010. # Game_Player
  3011. #==============================================================================
  3012.  
  3013. class Game_Player
  3014.  
  3015.   alias passable_blizzabsminimap_later? passable?
  3016.   def passable?(x, y, d)
  3017.     if $game_system.MINIMAP && $game_system.minimap_mode == 2 &&
  3018.         Input.press?(MAP_MOVE_BUTTON)
  3019.       return false
  3020.     end
  3021.     return passable_blizzabsminimap_later?(x, y, d)
  3022.   end
  3023.  
  3024. end
  3025.  
  3026. #==============================================================================
  3027. # Game_Event
  3028. #==============================================================================
  3029.  
  3030. class Game_Event
  3031.  
  3032.   attr_reader :erased
  3033.   attr_reader :teleport
  3034.  
  3035.   def conditions
  3036.     @event.pages.reverse.each {|page|
  3037.         c = page.condition
  3038.         next if c.switch1_valid && !$game_switches[c.switch1_id]
  3039.         next if c.switch2_valid && !$game_switches[c.switch2_id]
  3040.         if c.variable_valid
  3041.           next if $game_variables[c.variable_id] < c.variable_value
  3042.         end
  3043.         if c.self_switch_valid
  3044.           key = [@map_id, @event.id, c.self_switch_ch]
  3045.           next if $game_self_switches[key] != true
  3046.         end
  3047.         return true}
  3048.     return false
  3049.   end
  3050.  
  3051.   alias refresh_blizzabsminimap_later refresh
  3052.   def refresh
  3053.     refresh_blizzabsminimap_later
  3054.     @teleport = (@list != nil && @list.any? {|i| i.code == 201})
  3055.   end
  3056.  
  3057.   def name
  3058.     return @event.name.clone
  3059.   end
  3060.  
  3061. end
  3062.  
  3063. #==============================================================================
  3064. # Minimap
  3065. #==============================================================================
  3066.  
  3067. class Minimap < Sprite
  3068.  
  3069.   attr_reader :map_id
  3070.  
  3071.   def initialize
  3072.     super(Viewport.new(476, 356, 160, 120))
  3073.     @autotile = $tons_cache.get_image('minimap_autotile')
  3074.     create_passable_floor
  3075.     self.x = self.y = 0
  3076.     viewport.z = 5000
  3077.     @events, @names = check_events
  3078.     create_sevents
  3079.     self.visible = true
  3080.     update
  3081.   end
  3082.  
  3083.   def create_passable_floor
  3084.     self.bitmap = $tons_cache.get_image('minimap_bitmap')
  3085.     @map_id = $game_map.map_id
  3086.   end
  3087.  
  3088.   def update(override = false)
  3089.     create_passable_floor if @map_id != $game_map.map_id
  3090.     ev = check_events
  3091.     if [@events, @names] != ev
  3092.       @events, @names = ev
  3093.       destroy_sevents
  3094.       create_sevents
  3095.     end
  3096.     if $game_system.minimap_mode < 2
  3097.       self.ox, self.oy = $game_map.display_x / 16, $game_map.display_y / 16
  3098.     elsif !(Input.press?(MAP_MOVE_BUTTON)) || override
  3099.       if self.bitmap.width > 640
  3100.         border = $game_player.real_x/16 - 320
  3101.         border_x = self.bitmap.width - 640
  3102.         if border < 0
  3103.           self.ox = 0
  3104.         elsif border > border_x
  3105.           self.ox = border_x
  3106.         else
  3107.           self.ox = border
  3108.         end
  3109.       else
  3110.         self.ox = self.bitmap.width/2 - 320
  3111.       end
  3112.       if self.bitmap.height > 480
  3113.         border = $game_player.real_y/16 - 240
  3114.         border_y = self.bitmap.height - 480
  3115.         if border < 0
  3116.           self.oy = 0
  3117.         elsif border > border_y
  3118.           self.oy = border_y
  3119.         else
  3120.           self.oy = border
  3121.         end
  3122.       else
  3123.         self.oy = self.bitmap.height/2 - 240
  3124.       end
  3125.     end
  3126.     @sevents.each_index {|i|
  3127.         if $game_system.minimap_mode == 2 || @events[i].update?
  3128.           @sevents[i].x = self.x + @events[i].real_x / 16
  3129.           @sevents[i].y = self.y + @events[i].real_y / 16
  3130.           @sevents[i].ox, @sevents[i].oy = self.ox, self.oy
  3131.           if @names[i] != '' && (@events[i].is_a?(Game_Player) ||
  3132.               @events[i].is_a?(Game_Member) ||
  3133.               !@events[i].name.clone.gsub!('\box') {''})
  3134.             @sevents[i].src_rect.set((@events[i].direction - 2) * 7, 0, 14, 14)
  3135.             @sevents[i].ox += 3
  3136.             @sevents[i].oy += 3
  3137.           end
  3138.         end}
  3139.   end
  3140.  
  3141.   def check_events
  3142.     events, names = [$game_player], []
  3143.     if $game_system.CATERPILLAR
  3144.       $game_player.members.each {|event|
  3145.           events.push(event) if event.character_name != ''}
  3146.     end
  3147.     $game_map.events.each_value {|event|
  3148.         next if event.name.clone.gsub!('\nomap') {''}
  3149.         if event.is_a?(Game_Event) && !event.erased && (event.teleport ||
  3150.             event.name.clone.gsub!('\spc') {''})
  3151.           events.push(event)
  3152.           names.push(event.character_name)
  3153.         end}
  3154.     return events, names
  3155.   end
  3156.  
  3157.   def create_sevents
  3158.     @sevents = []
  3159.     @events.each_index {|i|
  3160.         sprite = Sprite.new(viewport)
  3161.         rect = Rect.new(0, 0, 56, 14)
  3162.         if @events[i] == $game_player
  3163.           if @names[i] != ''
  3164.             sprite.bitmap = Bitmap.new(56, 14)
  3165.             sprite.bitmap.blt(0, 0, $tons_cache.get_image('green_arrow'), rect, 128)
  3166.           end
  3167.           sprite.z = 100
  3168.         elsif @events[i].is_a?(Game_Member)
  3169.           if @names[i] != ''
  3170.             sprite.bitmap = Bitmap.new(56, 14)
  3171.             sprite.bitmap.blt(0, 0, $tons_cache.get_image('blue_arrow'), rect, 128)
  3172.           end
  3173.           sprite.z = 80
  3174.         elsif @events[i].is_a?(Game_Event)
  3175.           if @events[i].name.clone.gsub!('\spc') {''}
  3176.             color, arrow, sprite.z = Color.new(255, 255, 0, 128), 'yellow_arrow', 60
  3177.           elsif @events[i].teleport
  3178.             color, arrow, sprite.z = Color.new(128, 0, 255, 128), 'violet_arrow', 40
  3179.           end
  3180.           if @names[i] == '' || @events[i].name.clone.gsub!('\box') {''}
  3181.             sprite.bitmap = Bitmap.new(8, 8)
  3182.             sprite.bitmap.fill_rect(0, 0, 8, 8, Color.new(0, 0, 0, 128))
  3183.             sprite.bitmap.fill_rect(1, 1, 6, 6, color)
  3184.           else
  3185.             sprite.bitmap = Bitmap.new(56, 14)
  3186.             sprite.bitmap.blt(0, 0, $tons_cache.get_image(arrow), rect, 128)
  3187.           end
  3188.         elsif @names[i] == '' || @events[i].name.clone.gsub!('\box') {''}
  3189.           sprite.bitmap = Bitmap.new(8, 8)
  3190.           sprite.bitmap.fill_rect(0, 0, 8, 8, Color.new(0, 0, 0, 128))
  3191.           sprite.bitmap.fill_rect(1, 1, 6, 6, Color.new(255, 255, 255, 128))
  3192.         else
  3193.           sprite.bitmap = Bitmap.new(56, 14)
  3194.           sprite.bitmap.blt(0, 0, $tons_cache.get_image('white_arrow'), Rect.new(0, 0, 56, 14), 128)
  3195.         end
  3196.         sprite.bitmap = Bitmap.new(1, 1) if sprite.bitmap == nil
  3197.         sprite.ox = sprite.oy = 64
  3198.         if sprite.bitmap.width != 8
  3199.           sprite.src_rect.set((@events[i].direction-2)*7, 0, 14, 14)
  3200.         end
  3201.         @sevents.push(sprite)}
  3202.   end
  3203.  
  3204.   def destroy_sevents
  3205.     if @sevents != nil
  3206.       @sevents.each {|i| i.dispose}
  3207.       @sevents = nil
  3208.     end
  3209.   end
  3210.  
  3211.   def visible=(expr)
  3212.     super
  3213.     @sevents.each {|sprite| sprite.visible = expr}
  3214.   end
  3215.  
  3216.   def dispose
  3217.     destroy_sevents
  3218.     super
  3219.   end
  3220.  
  3221. end
  3222.  
  3223. #==============================================================================
  3224. # Scene_Map
  3225. #==============================================================================
  3226.  
  3227. class Scene_Map
  3228.  
  3229.   alias main_minimap_later main
  3230.   def main
  3231.     if $BlizzABS && BlizzABS::VERSION >= 1.20
  3232.       main_minimap_later
  3233.       return
  3234.     end
  3235.     $game_system.initialize_tons_of_addons unless $game_system.tons_of_addons
  3236.     @minimap = Minimap.new if $game_system.minimap_mode > 0
  3237.     main_minimap_later
  3238.     @minimap.dispose if @minimap != nil
  3239.   end
  3240.  
  3241.   alias upd_minimap_later update
  3242.   def update
  3243.     upd_minimap_later
  3244.     return if $BlizzABS && BlizzABS::VERSION >= 1.20
  3245.     if $game_system.MINIMAP
  3246.       if Input.trigger?(Input::F5)
  3247.         $game_system.minimap_mode = ($game_system.minimap_mode + 1) % 3
  3248.         if $game_system.minimap_mode == 0
  3249.           if @minimap != nil
  3250.             @minimap.dispose
  3251.             @minimap = nil
  3252.           end
  3253.         elsif @minimap == nil
  3254.           @minimap = Minimap.new
  3255.         end
  3256.       elsif @minimap != nil
  3257.         if $game_system.minimap_mode < 2
  3258.           @minimap.update
  3259.           return
  3260.         end
  3261.         unless @minimap.viewport.rect.width == 640 &&
  3262.             @minimap.map_id == $game_map.map_id
  3263.           @minimap.viewport.rect.set(0, 0, 640, 480)
  3264.           @minimap.update(true)
  3265.         end
  3266.         if Input.press?(MAP_MOVE_BUTTON) && !$game_temp.message_window_showing &&
  3267.             !$game_system.map_interpreter.running? && !@move_route_forcing
  3268.           if @minimap.bitmap.width > 640
  3269.             if Input.repeat?(Input::RIGHT)
  3270.               if @minimap.ox + 640 < @minimap.bitmap.width
  3271.                 $game_system.se_play($data_system.cursor_se)
  3272.                 @minimap.ox += 32
  3273.               else
  3274.                 $game_system.se_play($data_system.buzzer_se)
  3275.               end
  3276.             elsif Input.repeat?(Input::LEFT)
  3277.               if @minimap.ox > 0
  3278.                 $game_system.se_play($data_system.cursor_se)
  3279.                 @minimap.ox -= 32
  3280.               else
  3281.                 $game_system.se_play($data_system.buzzer_se)
  3282.               end
  3283.             end
  3284.           end
  3285.           if @minimap.bitmap.height > 480
  3286.             if Input.repeat?(Input::DOWN)
  3287.               if @minimap.oy + 480 < @minimap.bitmap.height
  3288.                 $game_system.se_play($data_system.cursor_se)
  3289.                 @minimap.oy += 32
  3290.               else
  3291.                 $game_system.se_play($data_system.buzzer_se)
  3292.               end
  3293.             elsif Input.repeat?(Input::UP)
  3294.               if @minimap.oy > 0
  3295.                 $game_system.se_play($data_system.cursor_se)
  3296.                 @minimap.oy -= 32
  3297.               else
  3298.                 $game_system.se_play($data_system.buzzer_se)
  3299.               end
  3300.             end
  3301.           end
  3302.         end
  3303.       end
  3304.     end
  3305.   end
  3306.  
  3307.   alias transfer_player_minimap_later transfer_player
  3308.   def transfer_player
  3309.     if @minimap != nil
  3310.       @minimap.dispose
  3311.       @minimap = nil
  3312.     end
  3313.     transfer_player_minimap_later
  3314.     @minimap = Minimap.new if $game_system.minimap_mode > 0
  3315.   end
  3316.  
  3317. end
  3318.  
  3319. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  3320. # Enemy Status in Battle by Blizzard
  3321. # Version: 1.0b
  3322. # Type: Information Display Alteration
  3323. # Date: 17.2.2007
  3324. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  3325. #
  3326. # Compatibility:
  3327. #
  3328. #   99% compatible with SDK v1.x. 90% compatible with SDK v2.x. Might cause
  3329. #   incompatibility issues with exotic CBS-es, CMS-es and custom enemy status
  3330. #   displays.
  3331. #
  3332. #
  3333. # Explanation:
  3334. #
  3335. #   This add-on will not only show enemies' names, but even HP, SP and status
  3336. #   in the help window during battle.
  3337. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  3338.  
  3339. #==============================================================================
  3340. # Window_Help
  3341. #==============================================================================
  3342.  
  3343. class Window_Help
  3344.  
  3345.   alias set_enemy_status_later set_enemy
  3346.   def set_enemy(enemy)
  3347.     $game_system.ENEMY_STATUS ? set_actor(enemy) : set_enemy_status_later(enemy)
  3348.   end
  3349.  
  3350. end
  3351.  
  3352. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  3353. # Passive Skills by Blizzard
  3354. # Version: 1.2b
  3355. # Type: Game Alteration
  3356. # Date: 13.7.2008
  3357. # Date v1.0b: 21.7.2008
  3358. # Date v1.1b: 19.10.2008
  3359. # Date v1.2b: 18.4.2009
  3360. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  3361. #
  3362. #   This add-on allows that skills passively change attributes and gold/exp
  3363. #   rates. It is recommended that you make those skills be never usable.
  3364. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  3365.  
  3366. module BlizzCFG
  3367.  
  3368. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3369. # START Configuration
  3370. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3371.   # will cause skills to only be effective during battle
  3372.   BATTLE_ONLY = false
  3373. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3374. # END Configuration
  3375. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3376.  
  3377.   def self.passkl_database(id)
  3378.     case id
  3379. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3380. # START Passive Skills Database
  3381. #  
  3382. #   Use following template to configure your database below:
  3383. #    
  3384. #     when ID then return [HP, SP, STR, DEX, AGI, INT, ATK, PD, MD, EVA, G, EXP]
  3385. #  
  3386. #   ID  - ID of the skill
  3387. #   HP  - change of max HP (added)
  3388. #   SP  - change of max SP (added)
  3389. #   STR - change of STR (added)
  3390. #   DEX - change of DEX (added)
  3391. #   AGI - change of AGI (added)
  3392. #   INT - change of INT (added)
  3393. #   ATK - change of ATK (added)
  3394. #   PD  - change of PDEF (added)
  3395. #   MD  - change of MDEF (added)
  3396. #   EVA - change of EVA (added)
  3397. #   G   - change of gold (multiplied)
  3398. #   EXP - change of EXP (multiplied)
  3399. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3400.     when 1 then return [100, 100, 10, 10, 10, 10, 0, 0, 0, 0, 1.0, 1.0]
  3401.     when 2 then return [0, 0, 0, 0, 0, 0, 10, -10, -10, 10, 1.0, 1.0]
  3402.     when 3 then return [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.5, 1.0]
  3403.     when 4 then return [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.0, 1.2]
  3404. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3405. # END Passive Skills
  3406. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3407.     end
  3408.     return [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.0, 1.0]
  3409.   end
  3410.  
  3411. end
  3412.  
  3413. #==============================================================================
  3414. # Game_Actor
  3415. #==============================================================================
  3416.  
  3417. class Game_Actor
  3418.  
  3419.   alias base_maxhp_passkl_later base_maxhp
  3420.   def base_maxhp
  3421.     result = base_maxhp_passkl_later
  3422.     if $game_system.PASSIVE_SKILLS &&
  3423.         (!BlizzCFG::BATTLE_ONLY || $game_temp.in_battle)
  3424.       @skills.each {|id| result += BlizzCFG.passkl_database(id)[0]}
  3425.     end
  3426.     return result
  3427.   end
  3428.  
  3429.   alias base_maxsp_passkl_later base_maxsp
  3430.   def base_maxsp
  3431.     result = base_maxsp_passkl_later
  3432.     if $game_system.PASSIVE_SKILLS &&
  3433.         (!BlizzCFG::BATTLE_ONLY || $game_temp.in_battle)
  3434.       @skills.each {|id| result += BlizzCFG.passkl_database(id)[1]}
  3435.     end
  3436.     return result
  3437.   end
  3438.  
  3439.   alias base_str_passkl_later base_str
  3440.   def base_str
  3441.     result = base_str_passkl_later
  3442.     if $game_system.PASSIVE_SKILLS &&
  3443.         (!BlizzCFG::BATTLE_ONLY || $game_temp.in_battle)
  3444.       @skills.each {|id| result += BlizzCFG.passkl_database(id)[2]}
  3445.     end
  3446.     return result
  3447.   end
  3448.  
  3449.   alias base_dex_passkl_later base_dex
  3450.   def base_dex
  3451.     result = base_dex_passkl_later
  3452.     if $game_system.PASSIVE_SKILLS &&
  3453.         (!BlizzCFG::BATTLE_ONLY || $game_temp.in_battle)
  3454.       @skills.each {|id| result += BlizzCFG.passkl_database(id)[3]}
  3455.     end
  3456.     return result
  3457.   end
  3458.  
  3459.   alias base_agi_passkl_later base_agi
  3460.   def base_agi
  3461.     result = base_agi_passkl_later
  3462.     if $game_system.PASSIVE_SKILLS &&
  3463.         (!BlizzCFG::BATTLE_ONLY || $game_temp.in_battle)
  3464.       @skills.each {|id| result += BlizzCFG.passkl_database(id)[4]}
  3465.     end
  3466.     return result
  3467.   end
  3468.  
  3469.   alias base_int_passkl_later base_int
  3470.   def base_int
  3471.     result = base_int_passkl_later
  3472.     if $game_system.PASSIVE_SKILLS &&
  3473.         (!BlizzCFG::BATTLE_ONLY || $game_temp.in_battle)
  3474.       @skills.each {|id| result += BlizzCFG.passkl_database(id)[5]}
  3475.     end
  3476.     return result
  3477.   end
  3478.  
  3479.   alias base_atk_passkl_later base_atk
  3480.   def base_atk
  3481.     result = base_atk_passkl_later
  3482.     if $game_system.PASSIVE_SKILLS &&
  3483.         (!BlizzCFG::BATTLE_ONLY || $game_temp.in_battle)
  3484.       @skills.each {|id| result += BlizzCFG.passkl_database(id)[6]}
  3485.     end
  3486.     return result
  3487.   end
  3488.  
  3489.   alias base_pdef_passkl_later base_pdef
  3490.   def base_pdef
  3491.     result = base_pdef_passkl_later
  3492.     if $game_system.PASSIVE_SKILLS &&
  3493.         (!BlizzCFG::BATTLE_ONLY || $game_temp.in_battle)
  3494.       @skills.each {|id| result += BlizzCFG.passkl_database(id)[7]}
  3495.     end
  3496.     return result
  3497.   end
  3498.  
  3499.   alias base_mdef_passkl_later base_mdef
  3500.   def base_mdef
  3501.     result = base_mdef_passkl_later
  3502.     if $game_system.PASSIVE_SKILLS &&
  3503.         (!BlizzCFG::BATTLE_ONLY || $game_temp.in_battle)
  3504.       @skills.each {|id| result += BlizzCFG.passkl_database(id)[8]}
  3505.     end
  3506.     return result
  3507.   end
  3508.  
  3509.   alias base_eva_passkl_later base_eva
  3510.   def base_eva
  3511.     result = base_eva_passkl_later
  3512.     if $game_system.PASSIVE_SKILLS &&
  3513.         (!BlizzCFG::BATTLE_ONLY || $game_temp.in_battle)
  3514.       @skills.each {|id| result += BlizzCFG.passkl_database(id)[9]}
  3515.     end
  3516.     return result
  3517.   end
  3518.  
  3519.   def gold_rate
  3520.     return 1 if BlizzCFG::BATTLE_ONLY && !$game_temp.in_battle
  3521.     result = 1.0
  3522.     @skills.each {|id| result *= BlizzCFG.passkl_database(id)[10]}
  3523.     return result
  3524.   end
  3525.  
  3526.   def exp_rate
  3527.     return 1 if BlizzCFG::BATTLE_ONLY && !$game_temp.in_battle
  3528.     result = 1.0
  3529.     @skills.each {|id| result *= BlizzCFG.passkl_database(id)[11]}
  3530.     return result
  3531.   end
  3532.  
  3533. end
  3534.  
  3535. #==============================================================================
  3536. # Window_BattleResult
  3537. #==============================================================================
  3538.  
  3539. class Window_BattleResult
  3540.  
  3541.   attr_accessor :gold
  3542.   attr_accessor :exp
  3543.  
  3544. end
  3545.  
  3546. #==============================================================================
  3547. # Window_BattleStatus
  3548. #==============================================================================
  3549.  
  3550. class Window_BattleStatus
  3551.  
  3552.   attr_accessor :level_up_flags
  3553.  
  3554. end
  3555.  
  3556. #==============================================================================
  3557. # Scene_Battle
  3558. #==============================================================================
  3559.  
  3560. class Scene_Battle
  3561.  
  3562.   alias start_phase5_passkl_later start_phase5
  3563.   def start_phase5
  3564.     unless $game_system.PASSIVE_SKILLS
  3565.       start_phase5_passkl_later
  3566.       return
  3567.     end
  3568.     old_gold, old_exp, old_levels = $game_party.gold, [], []
  3569.     $game_party.actors.each {|actor|
  3570.         old_exp.push(actor.exp)
  3571.         old_levels.push(actor.level)}
  3572.     start_phase5_passkl_later
  3573.     new_gold = $game_party.gold - old_gold
  3574.     $game_party.lose_gold(new_gold)
  3575.     gold_rate = 100
  3576.     $game_party.actors.each {|actor| gold_rate *= actor.gold_rate}
  3577.     @result_window.gold = (new_gold * gold_rate / 100).to_i
  3578.     $game_party.gain_gold(@result_window.gold)
  3579.     new_exp = 0
  3580.     $game_party.actors.each_index {|i|
  3581.         if $game_party.actors[i].exp - old_exp[i] > 0
  3582.           new_exp = $game_party.actors[i].exp - old_exp[i]
  3583.         end
  3584.         $game_party.actors[i].exp = old_exp[i]}
  3585.     exp_rate = 100
  3586.     $game_party.actors.each {|actor| exp_rate *= actor.exp_rate}
  3587.     @result_window.exp = (new_exp * exp_rate / 100).to_i
  3588.     @result_window.refresh
  3589.     $game_party.actors.each_index {|i|
  3590.         @status_window.level_up_flags[i] = false
  3591.         unless $game_party.actors[i].cant_get_exp?
  3592.           $game_party.actors[i].exp += @result_window.exp
  3593.           @status_window.level_up(i) if $game_party.actors[i].level > old_levels[i]
  3594.         end}
  3595.   end
  3596.  
  3597. end
  3598.  
  3599. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  3600. # Different Difficulties by Blizzard
  3601. # Version: 1.3b
  3602. # Date: 24.3.2007
  3603. # Date v1.1b: 27.3.2008
  3604. # Date v1.2b: 18.4.2008
  3605. # Date v1.3b: 22.4.2008
  3606. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  3607. #
  3608. # Instructions:
  3609. #
  3610. #   You can always check the current difficulty of the game by using
  3611. #  
  3612. #     $game_system.difficulty_name == 'NAME'
  3613. #  
  3614. #   in your conditional branch. The NAMEs are the same as you specify in the
  3615. #   configuration below.
  3616. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  3617.  
  3618. if TONS_OF_ADDONS::DIFFICULTY
  3619.  
  3620. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3621. # START Congfiguration
  3622. #
  3623. # Use the following template to create difficulties in your game
  3624. # ['NAME', EXP_RATE, GOLD_RATE, ACTOR_DAMAGE_RATE, ENEMY_DAMAGE_RATE]
  3625. # Note that all the "rates" are in %. Values over 100 will increase, values
  3626. # under 100 will decrease the given attribute. Of course you can add/remove
  3627. # any difficulties you want, be sure to separate them with commas.
  3628. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3629.  
  3630. DIFFICULTIES = [['n00b', 200, 200, 200, 50],
  3631.                 ['Novice', 150, 150, 150, 75],
  3632.                 ['Average', 100, 100, 100, 100],
  3633.                 ['Extreme', 75, 75, 75, 150],
  3634.                 ['Annihilating', 50, 50, 50, 200]]
  3635.  
  3636. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3637. # END Congfiguration
  3638. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3639.  
  3640. #==============================================================================
  3641. # Game_System
  3642. #==============================================================================
  3643.  
  3644. class Game_System
  3645.  
  3646.   attr_reader :difficulty_name
  3647.   attr_reader :exp_rate
  3648.   attr_reader :gold_rate
  3649.   attr_reader :actor_rate
  3650.   attr_reader :enemy_rate
  3651.  
  3652.   alias init_tons_of_addons_difficulty initialize
  3653.   def initialize
  3654.     init_tons_of_addons_difficulty
  3655.     initialize_tons_of_addons unless @tons_of_addons
  3656.   end
  3657.  
  3658.   def init_difficulty(index)
  3659.     @difficulty_name, @exp_rate, @gold_rate, @actor_rate, @enemy_rate =
  3660.         DIFFICULTIES[index]
  3661.   end
  3662.  
  3663. end
  3664.  
  3665. #==============================================================================
  3666. # Window_BattleResult
  3667. #==============================================================================
  3668.  
  3669. class Window_BattleResult
  3670.  
  3671.   attr_accessor :gold
  3672.   attr_accessor :exp
  3673.  
  3674. end
  3675.  
  3676. #==============================================================================
  3677. # Window_BattleStatus
  3678. #==============================================================================
  3679.  
  3680. class Window_BattleStatus
  3681.  
  3682.   attr_accessor :level_up_flags
  3683.  
  3684. end
  3685.  
  3686. #==============================================================================
  3687. # Game_Battler
  3688. #==============================================================================
  3689.  
  3690. class Game_Battler
  3691.  
  3692.   alias attack_effect_difficulty_later attack_effect
  3693.   def attack_effect(attacker)
  3694.     last_sr = self.sr if $crls && self.is_a?(Game_Actor)
  3695.     last_hp = self.hp
  3696.     result = attack_effect_difficulty_later(attacker)
  3697.     if result && self.damage.is_a?(Numeric)
  3698.       self.hp = last_hp
  3699.       self.hp = self.hp
  3700.       if attacker.is_a?(Game_Actor)
  3701.         self.sr = last_sr if $crls && self.is_a?(Game_Actor)
  3702.         self.damage = self.damage * $game_system.actor_rate / 100
  3703.       elsif attacker.is_a?(Game_Enemy)
  3704.         self.damage = self.damage * $game_system.enemy_rate / 100
  3705.       end
  3706.       self.hp -= self.damage
  3707.     end
  3708.     return result
  3709.   end
  3710.  
  3711.   alias skill_effect_difficulty_later skill_effect
  3712.   def skill_effect(user, skill)
  3713.     last_sr = self.sr if $crls && self.is_a?(Game_Actor)
  3714.     last_hp = self.hp
  3715.     result = skill_effect_difficulty_later(user, skill)
  3716.     if result && self.damage.is_a?(Numeric)
  3717.       self.hp = last_hp
  3718.       self.hp = self.hp
  3719.       if user.is_a?(Game_Actor)
  3720.         self.damage = self.damage * $game_system.actor_rate / 100
  3721.         self.sr = last_sr if $crls
  3722.       elsif user.is_a?(Game_Enemy)
  3723.         self.damage = self.damage * $game_system.enemy_rate / 100
  3724.       end
  3725.       self.hp -= self.damage
  3726.     end
  3727.     return result
  3728.   end
  3729.  
  3730. end
  3731.  
  3732. #==============================================================================
  3733. # Scene_Title
  3734. #==============================================================================
  3735.  
  3736. class Scene_Title
  3737.  
  3738.   alias main_difficulties_later main
  3739.   def main
  3740.     main_difficulties_later
  3741.     @difficulty_window.dispose if @difficulty_window != nil
  3742.   end
  3743.  
  3744.   alias command_new_game_difficulties_later command_new_game
  3745.   def command_new_game
  3746.     $game_system.se_play($data_system.decision_se)
  3747.     d = []
  3748.     DIFFICULTIES.each {|diff| d.push(diff[0])}
  3749.     @difficulty_window = Window_Command.new(@command_window.width, d)
  3750.     @difficulty_window.x = @command_window.x
  3751.     @difficulty_window.y = @command_window.y -
  3752.         (@difficulty_window.height - @command_window.height) / 2
  3753.     @difficulty_window.back_opacity = @command_window.back_opacity
  3754.     @command_window.active = @command_window.visible = false
  3755.   end
  3756.  
  3757.   alias upd_difficulties_later update
  3758.   def update
  3759.     if @difficulty_window == nil
  3760.       upd_difficulties_later
  3761.       return
  3762.     end
  3763.     @difficulty_window.update unless defined?(SDK)
  3764.     if Input.trigger?(Input::B)
  3765.       $game_system.se_play($data_system.cancel_se)
  3766.       @command_window.active = @command_window.visible = true
  3767.       @difficulty_window.dispose
  3768.       @difficulty_window = nil
  3769.     elsif Input.trigger?(Input::C)
  3770.       command_new_game_difficulties_later
  3771.       $game_system.init_difficulty(@difficulty_window.index)
  3772.     end
  3773.   end
  3774.  
  3775. end
  3776.  
  3777. #==============================================================================
  3778. # Scene_Battle
  3779. #==============================================================================
  3780.  
  3781. class Scene_Battle
  3782.  
  3783.   alias start_phase5_difficulty_later start_phase5
  3784.   def start_phase5
  3785.     old_gold, old_exp, old_levels = $game_party.gold, [], []
  3786.     $game_party.actors.each {|actor|
  3787.         old_exp.push(actor.exp)
  3788.         old_levels.push(actor.level)}
  3789.     start_phase5_difficulty_later
  3790.     new_gold = $game_party.gold - old_gold
  3791.     $game_party.lose_gold(new_gold)
  3792.     @result_window.gold = new_gold * $game_system.gold_rate / 100
  3793.     $game_party.gain_gold(@result_window.gold)
  3794.     new_exp = 0
  3795.     $game_party.actors.each_index {|i|
  3796.         if $game_party.actors[i].exp - old_exp[i] > 0
  3797.           new_exp = $game_party.actors[i].exp - old_exp[i]
  3798.         end
  3799.         $game_party.actors[i].exp = old_exp[i]}
  3800.     @result_window.exp = new_exp * $game_system.exp_rate / 100
  3801.     @result_window.refresh
  3802.     $game_party.actors.each_index {|i|
  3803.         @status_window.level_up_flags[i] = false
  3804.         unless $game_party.actors[i].cant_get_exp?
  3805.           $game_party.actors[i].exp += @result_window.exp
  3806.           @status_window.level_up(i) if $game_party.actors[i].level > old_levels[i]
  3807.         end}
  3808.   end
  3809.  
  3810. end
  3811.  
  3812. end
  3813.  
  3814. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  3815. # Skill Separation System (SSS) by Blizzard
  3816. # Version: 1.4
  3817. # Type: Game Playability Improvement
  3818. # Date: 22.3.2007
  3819. # Date v1.2b: 20.3.2008
  3820. # Data v1.3b: 23.7.2008
  3821. # Data v1.31b: 28.7.2009
  3822. # Data v1.32b: 3.10.2009
  3823. # Data v1.33b: 5.10.2009
  3824. # Data v1.4: 11.4.2013
  3825. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  3826. #
  3827. # new in v1.0b:
  3828. #   - beta release, it should work without bugs now
  3829. #
  3830. # new in v1.1b:
  3831. #   - now displays only categories that the actor has learned skills in
  3832. #
  3833. # new in v1.2b:
  3834. #   - now displays AP requirement as well if using EQUAP Skills
  3835. #
  3836. # new in v1.3b:
  3837. #   - improved compatibility
  3838. #   - improved coding
  3839. #
  3840. # new in v1.31b:
  3841. #   - fixed leftover bug from EQUAP
  3842. #
  3843. # new in v1.32b:
  3844. #   - fixed bug with dummy elements when not using this add-on
  3845. #
  3846. # new in v1.33b:
  3847. #   - fixed another small bug
  3848. #
  3849. # new in v1.4:
  3850. #   - fixed code so it works properly with Easy Overdrive System
  3851. #   - fixed code so it works better with other systems using Window_Skill
  3852. #   - updated code
  3853. #
  3854. #
  3855. # Explanation:
  3856. #
  3857. #   Every of your skills will be categorized. You can put the same skill in
  3858. #   more categories. You can define category names and element dummies below.
  3859. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  3860.  
  3861. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3862. # START Configuration
  3863. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3864.  
  3865. # your skill set dummy elements
  3866. SKILL_SETS = [9, 10, 11, 12, 13, 14, 15, 16]
  3867. # names of skill sets
  3868. SKILL_SET_NAMES = ['White Magic', 'Black Magic', 'Blue Magic', 'Technic',
  3869.                     'Special Attack', 'Psy', 'Magitech', 'Overlution']
  3870. # the X offset of the drawing (try changing it to see what it does and adjust
  3871. # it how you want it to be, of course you can use negative numbers)
  3872. $x_off = 50
  3873.  
  3874. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3875. # END Configuration
  3876. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3877.  
  3878. if $DUMMY_ELEMENTS != nil
  3879.   $DUMMY_ELEMENTS |= SKILL_SETS
  3880. else
  3881.   $DUMMY_ELEMENTS = SKILL_SETS.clone
  3882. end
  3883.  
  3884. #==============================================================================
  3885. # Game_Battler
  3886. #==============================================================================
  3887.  
  3888. class Game_Battler
  3889.  
  3890.   alias elements_correct_sss_later elements_correct
  3891.   def elements_correct(elements)
  3892.     return elements_correct_sss_later(elements) if !$game_system.SKILL_SEPARATION
  3893.     multiplier = size = 0
  3894.     elements.each {|i|
  3895.         unless $DUMMY_ELEMENTS.include?(i)
  3896.           multiplier += self.element_rate(i)
  3897.           size += 1
  3898.         end}
  3899.     return (size == 0 ? 100 : multiplier / size)
  3900.   end
  3901.  
  3902. end
  3903.  
  3904. #==============================================================================
  3905. # Window_Skill
  3906. #==============================================================================
  3907.  
  3908. class Window_Skill
  3909.  
  3910.   alias init_sss_later initialize
  3911.   def initialize(actor)
  3912.     if $game_system.SKILL_SEPARATION
  3913.       super(0, 128, 640, 384)
  3914.       @column_max, @index, @actor, @alt_index, @skill_ids = 1, 0, actor, [], []
  3915.       refresh
  3916.       if $game_temp.in_battle
  3917.         self.y, self.height, self.back_opacity = 64, 256, 160
  3918.       end
  3919.     else
  3920.       init_sss_later(actor)
  3921.     end
  3922.   end
  3923.  
  3924.   alias refresh_sss_later refresh
  3925.   def refresh
  3926.     unless $game_system.SKILL_SEPARATION
  3927.       refresh_sss_later
  3928.       return
  3929.     end
  3930.     if self.contents != nil
  3931.       self.contents.dispose
  3932.       self.contents = nil
  3933.     end
  3934.     if @actor != nil
  3935.       @sets = []
  3936.       SKILL_SETS.each_index {|i|
  3937.           skills = @actor.skills.find_all {|id|
  3938.               $data_skills[id].element_set.include?(SKILL_SETS[i])}
  3939.           if skills != []
  3940.             @skill_ids.push(skills)
  3941.             @alt_index.push(0)
  3942.             @sets.push(i)
  3943.           end}
  3944.       @item_max = @sets.size
  3945.       if @item_max > 0
  3946.         self.contents = Bitmap.new(width - 32, row_max * 32)
  3947.         if $fontface != nil
  3948.           self.contents.font.name = $fontface
  3949.         elsif $defaultfonttype != nil
  3950.           self.contents.font.name = $defaultfonttype
  3951.         end
  3952.         self.contents.font.size = 24
  3953.         @sets.each_index {|i| draw_item(i)}
  3954.       else
  3955.         @skill_ids.push([0])
  3956.         @alt_index.push(0)
  3957.       end
  3958.     end
  3959.   end
  3960.  
  3961.   alias draw_item_sss_later draw_item
  3962.   def draw_item(index)
  3963.     unless $game_system.SKILL_SEPARATION
  3964.       draw_item_sss_later(index)
  3965.       return
  3966.     end
  3967.     y = index * 32
  3968.     rect = Rect.new(0, y, self.width / @column_max - 32, 32)
  3969.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  3970.     id = @skill_ids[index][@alt_index[index]]
  3971.     skill = $data_skills[id] if id != 0
  3972.     if skill != nil
  3973.       if @actor.skill_can_use?(skill.id)
  3974.         self.contents.font.color = normal_color
  3975.       else
  3976.         self.contents.font.color = disabled_color
  3977.       end
  3978.       bitmap = RPG::Cache.icon(skill.icon_name)
  3979.       opacity = self.contents.font.color == normal_color ? 255 : 128
  3980.       self.contents.blt(200+$x_off, y+4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  3981.       text = skill.name
  3982.       if TONS_OF_ADDONS::EQUAP_SKILLS && DISPLAY_AP_REQ
  3983.         aps = BlizzCFG.maxap(skill.id)
  3984.         if aps > 0
  3985.           text += " (#{@actor.ap(skill.id)}/#{aps})"
  3986.         elsif DISPLAY_AP_ZERO
  3987.           text += ' (0/0)'
  3988.         end
  3989.       else
  3990.       end
  3991.       self.contents.draw_text(228+$x_off, y, 204, 32, text, 0)
  3992.       sp_cost = skill.sp_cost
  3993.       if $game_system.SP_COST_MOD
  3994.         sp_cost = BlizzCFG.get_cost_mod(@actor.states, sp_cost)
  3995.       end
  3996.       self.contents.draw_text(516, y, 64, 32, sp_cost.to_s, 2)
  3997.       if @skill_ids[index].size > 1
  3998.         self.contents.draw_text(184+$x_off, y, 32, 32, '«')
  3999.         self.contents.draw_text(564, y, 32, 32, '»', 2)
  4000.       end
  4001.     else
  4002.       self.contents.font.color = disabled_color
  4003.       self.contents.draw_text(228+$x_off, y, 204, 32, 'not available')
  4004.     end
  4005.     if id == 0
  4006.       color = disabled_color
  4007.     elsif @actor.skill_can_use?(id)
  4008.       color = normal_color
  4009.     else
  4010.       color = disabled_color
  4011.     end
  4012.     if SKILL_SET_NAMES[@sets[index]] == nil
  4013.       self.contents.draw_text(4, y, 288, 32, "Undefined name #{index}")
  4014.     else
  4015.       self.contents.draw_text(4, y, 288, 32, SKILL_SET_NAMES[@sets[index]])
  4016.     end
  4017.   end
  4018.  
  4019.   alias upd_sss_later update
  4020.   def update
  4021.     upd_sss_later
  4022.     return unless $game_system.SKILL_SEPARATION
  4023.     return if @skill_ids == nil || @alt_index == nil
  4024.     return if @skill_ids[@index] == nil
  4025.     size, old_index = @skill_ids[@index].size, @alt_index[@index]
  4026.     if Input.repeat?(Input::RIGHT)
  4027.       @alt_index[@index] = (@alt_index[@index] + 1) % size
  4028.       if old_index != @alt_index[@index]
  4029.         $game_system.se_play($data_system.cursor_se)
  4030.         draw_item(@index)
  4031.       else
  4032.         $game_system.se_play($data_system.buzzer_se)
  4033.       end
  4034.     elsif Input.repeat?(Input::LEFT)
  4035.       @alt_index[@index] = (@alt_index[@index] + size - 1) % size
  4036.       if old_index != @alt_index[@index]
  4037.         $game_system.se_play($data_system.cursor_se)
  4038.         draw_item(@index)
  4039.       else
  4040.         $game_system.se_play($data_system.buzzer_se)
  4041.       end
  4042.     end
  4043.   end
  4044.  
  4045.   alias skill_sss_later skill
  4046.   def skill
  4047.     return skill_sss_later unless $game_system.SKILL_SEPARATION
  4048.     return skill_sss_later if @skill_ids == nil || @alt_index == nil
  4049.     return nil if @item_max == 0
  4050.     return skill_sss_later if @skill_ids[@index] == nil
  4051.     id = @skill_ids[@index][@alt_index[@index]]
  4052.     return $data_skills[id] if id != 0
  4053.   end
  4054.  
  4055. end
  4056.  
  4057. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4058. # Multi-Hit by Blizzard
  4059. # Version: 1.51b
  4060. # Type: Weapon/Skill/Enemy Enhancement
  4061. # Date: 12.8.2007
  4062. # Date 1.3b: 23.2.2008
  4063. # Date 1.4b: 23.7.2008
  4064. # Date 1.5b: 19.10.2008
  4065. # Date 1.51b: 6.10.2009
  4066. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4067. #
  4068. # Compatibility:
  4069. #
  4070. #   95% compatible with SDK 1.x. 70% compatible with SDK 2.x. Might be
  4071. #   incompatible with exotic skills and/or CBS-es. Compatible with CRLS 5.1b or
  4072. #   higher.
  4073. #
  4074. #
  4075. # Explanation:
  4076. #
  4077. #   This add-on will allow that skills, weapons and enemies attack more than
  4078. #   once.
  4079. #
  4080. # new in v1.3b:
  4081. #   - now you can define weapons/skills/enemies which's other attacks will
  4082. #     target a random target instead of the originally chosen target
  4083. #   - now beta
  4084. #
  4085. # new in v1.4b:
  4086. #   - better compatibility with SP Cost Mod
  4087. #   - improved coding
  4088. #  
  4089. # new in v1.5b:
  4090. #   - added Multi-Hit items
  4091. #  
  4092. #  
  4093. # Configuration:
  4094. #  
  4095. #   Set up the following constants to configure the script:
  4096. #  
  4097. #   WEAPON_RANDOM - add any weapon IDs here and separate them with commas to
  4098. #                   make those specific weapons attack another random target
  4099. #                   for each other hit than the first
  4100. #   SKILL_RANDOM  - add any skill IDs here and separate them with commas to
  4101. #                   make those specific skills attack another random target
  4102. #                   for each other hit than the first
  4103. #   ITEM_RANDOM   - add any item IDs here and separate them with commas to
  4104. #                   make those specific items attack another random target
  4105. #                   for each other hit than the first
  4106. #   ENEMY_RANDOM  - add any enemy IDs here and separate them with commas to
  4107. #                   make those specific enemies attack another random target
  4108. #                   for each other hit than the first
  4109. #  
  4110. #   Further there are 4 configurations. Configuration 1 is for weapons,
  4111. #   Configuration 2 is for skills, Configuration 3 is for items and
  4112. #   Configuration 3 is for normal enemy attacks. Use following template to set
  4113. #   up how many hits should be done:
  4114. #
  4115. #     when ID then return HITS
  4116. #
  4117. #   ID   - ID of weapon, skill, item or enemy, depending on the configuration
  4118. #          number
  4119. #   HITS - number of hits
  4120. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4121.  
  4122. #==============================================================================
  4123. # module BlizzCFG
  4124. #==============================================================================
  4125.  
  4126. module BlizzCFG
  4127.  
  4128. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4129. # START Basic Configuration
  4130. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4131.   WEAPON_RANDOM = [1, 2]
  4132.   SKILL_RANDOM = [57]
  4133.   ITEM_RANDOM = [12]
  4134.   ENEMY_RANDOM = []
  4135. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4136. # END Basic Configuration
  4137. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4138.  
  4139.   def self.weapon_hits(id)
  4140.     case id
  4141. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4142. # START Configuration 1
  4143. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4144.     when 1 then return 3
  4145.     when 2 then return 4
  4146.     when 3 then return 2
  4147. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4148. # END Configuration 1
  4149. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4150.     end
  4151.     return 1
  4152.   end
  4153.  
  4154.   def self.skill_hits(id)
  4155.     case id
  4156. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4157. # START Configuration 2
  4158. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4159.     when 57 then return 3
  4160.     when 58 then return 2
  4161. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4162. # END Configuration 2
  4163. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4164.     end
  4165.     return 1
  4166.   end
  4167.  
  4168.   def self.item_hits(id)
  4169.     case id
  4170. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4171. # START Configuration 3
  4172. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4173.     when 12 then return 3
  4174.     when 13 then return 2
  4175. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4176. # END Configuration 3
  4177. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4178.     end
  4179.     return 1
  4180.   end
  4181.  
  4182.   def self.enemy_hits(id)
  4183.     case id
  4184. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4185. # START Configuration 4
  4186. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4187.     when 1 then return 2
  4188. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4189. # END Configuration 4
  4190. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4191.     end
  4192.     return 1
  4193.   end
  4194.  
  4195. end
  4196.  
  4197. #==============================================================================
  4198. # Scene_Battle
  4199. #==============================================================================
  4200.  
  4201. class Scene_Battle
  4202.  
  4203.   alias update_phase4_step1_multi_hit_later update_phase4_step1
  4204.   def update_phase4_step1(battler = nil)
  4205.     if battler != nil
  4206.       update_phase4_step1_multi_hit_later(battler)
  4207.       return
  4208.     end
  4209.     update_phase4_step1_multi_hit_later
  4210.     @repeat = [1, 1, 0]
  4211.     return unless @active_battler != nil && $game_system.MULTI_HIT
  4212.     if @active_battler.current_action.kind == 0
  4213.       if @active_battler.current_action.basic == 0
  4214.         if @active_battler.is_a?(Game_Actor)
  4215.           hits = BlizzCFG.weapon_hits(@active_battler.weapon_id)
  4216.         elsif @active_battler.is_a?(Game_Enemy)
  4217.           hits = BlizzCFG.enemy_hits(@active_battler.id)
  4218.         end
  4219.         @repeat = [hits, hits, 2]
  4220.       end
  4221.     elsif @active_battler.current_action.kind == 1
  4222.       @repeat[2] = 3
  4223.     elsif @active_battler.current_action.kind == 2
  4224.       @repeat[2] = 4
  4225.     end
  4226.   end
  4227.  
  4228.   alias update_phase4_step2_multi_hit_later update_phase4_step2
  4229.   def update_phase4_step2(battler = nil)
  4230.     if battler != nil
  4231.       update_phase4_step2_multi_hit_later(battler)
  4232.       return
  4233.     end
  4234.     update_phase4_step2_multi_hit_later
  4235.     if $game_system.MULTI_HIT && @phase4_step != 1
  4236.       if @repeat[2] == 3
  4237.         hits = BlizzCFG.skill_hits(@skill.id)
  4238.         @repeat = [hits, hits+1, 4]
  4239.       elsif @repeat[2] == 4
  4240.         hits = BlizzCFG.item_hits(@item.id)
  4241.         @repeat = [hits, hits+1, 4]
  4242.       end
  4243.     end
  4244.   end
  4245.  
  4246.   alias update_phase4_step5_multi_hit_later update_phase4_step5
  4247.   def update_phase4_step5(battler = nil)
  4248.     if battler != nil
  4249.       update_phase4_step5_multi_hit_later(battler)
  4250.       return
  4251.     end
  4252.     update_phase4_step5_multi_hit_later
  4253.     if $game_system.MULTI_HIT
  4254.       if @active_battler.current_action.kind == 1
  4255.         if BlizzCFG::SKILL_RANDOM.include?(@skill.id)
  4256.           if @active_battler.is_a?(Game_Actor)
  4257.             @active_battler.current_action.decide_random_target_for_actor
  4258.           elsif @active_battler.is_a?(Game_Enemy)
  4259.             @active_battler.current_action.decide_random_target_for_enemy
  4260.           end
  4261.         end
  4262.       elsif @active_battler.current_action.kind == 2
  4263.         if BlizzCFG::ITEM_RANDOM.include?(@item.id)
  4264.           if @active_battler.is_a?(Game_Actor)
  4265.             @active_battler.current_action.decide_random_target_for_actor
  4266.           elsif @active_battler.is_a?(Game_Enemy)
  4267.             @active_battler.current_action.decide_random_target_for_enemy
  4268.           end
  4269.         end
  4270.       elsif @active_battler.is_a?(Game_Actor)
  4271.         if BlizzCFG::WEAPON_RANDOM.include?(@active_battler.weapon_id)
  4272.           @active_battler.current_action.decide_random_target_for_actor
  4273.         end
  4274.       elsif @active_battler.is_a?(Game_Enemy)
  4275.         if BlizzCFG::ENEMY_RANDOM.include?(@active_battler.id)
  4276.           @active_battler.current_action.decide_random_target_for_enemy
  4277.         end
  4278.       end
  4279.       @phase4_step = 2 if @repeat[0] > 1 && @repeat[2] > 0
  4280.       @repeat[0] -= 1
  4281.     end
  4282.   end
  4283.  
  4284.   alias make_skill_action_result_multi_hit_later make_skill_action_result
  4285.   def make_skill_action_result(battler = nil, plus_id = nil)
  4286.     if battler != nil
  4287.       if plus_id != nil
  4288.         make_skill_action_result_multi_hit_later(battler, plus_id)
  4289.       else
  4290.         make_skill_action_result_multi_hit_later(battler)
  4291.       end
  4292.       return
  4293.     end
  4294.     make_skill_action_result_multi_hit_later
  4295.     if @repeat[2] > 3
  4296.       sp_cost = @skill.sp_cost
  4297.       if $game_system.SP_COST_MOD
  4298.         sp_cost = BlizzCFG.get_cost_mod(@active_battler.states, sp_cost)
  4299.       end
  4300.       @active_battler.sp += sp_cost
  4301.       @status_window.refresh
  4302.     end
  4303.   end
  4304.  
  4305. end
  4306.  
  4307. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4308. # Scene_Item calling Items by Blizzard
  4309. # Version: 1.0
  4310. # Date: 27.9.2007
  4311. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4312. #
  4313. # Compatibility:
  4314. #
  4315. #   98% compatible with SDK v1.x. 80% compatible with SDK v2.x. Can cause
  4316. #   incompatiblity issues with CMS-es.
  4317. #
  4318. #
  4319. # Explanation:
  4320. #
  4321. #   This script will allow you to use an item to call another Scene_Item. i.e.
  4322. #   you open a juke box and a list of all "songs" will be displayed which are
  4323. #   actually items. Upon return, the Scene_Menu will be called.
  4324. #  
  4325. #  
  4326. # Instructions:
  4327. #
  4328. #   Simply configure the database below. The database starts at the comment
  4329. #   START Itemcall Database. The items MUST be in your possesion, otherwise
  4330. #   you won't be able to use those items. The items are also never displayed
  4331. #   in the normal Scene_Item. Note that using such an item will consume it if
  4332. #   the item is "consumable".
  4333. #
  4334. #
  4335. # If you find any bugs, please report them here:
  4336. # http://forum.chaos-project.com/
  4337. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4338.  
  4339. if TONS_OF_ADDONS::ITEMCALL
  4340.  
  4341. #==============================================================================
  4342. # Game_System
  4343. #==============================================================================
  4344.  
  4345. class Game_System
  4346.  
  4347.   def item_calls(id)
  4348.     case id
  4349. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4350. # START Itemcall Database
  4351. #
  4352. #   Here you can define which item calls you want to use. Configure it like
  4353. #   this template:
  4354. #
  4355. #     when ITEM_ID then return ID_ARRAY
  4356. #
  4357. #   ITEM_ID  - the ID of the item that calls the item scene
  4358. #   ID_ARRAY - array of item IDs that are displayed in the menu that was called
  4359. #              by the item ITEM_ID
  4360. #
  4361. # Example:
  4362. #
  4363. #   Let's say that ITEM_ID is 26 and ID_ARRAY is [1, 4, 7]. If you use the Item
  4364. #   with ID 26 in the normal menu, a Scene_Item will be called that has only
  4365. #   the items with IDs 1, 4 and 7. Note that such items can also call a scene.
  4366. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4367.     when 26 then return [1, 4, 7]
  4368. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4369. # END Itemcall Database
  4370. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4371.     end
  4372.     return []
  4373.   end
  4374.  
  4375. end
  4376.  
  4377. #==============================================================================
  4378. # Game_Temp
  4379. #==============================================================================
  4380.  
  4381. class Game_Temp
  4382.  
  4383.   attr_accessor :item_call
  4384.  
  4385. end
  4386.  
  4387. #==============================================================================
  4388. # Window_Item
  4389. #==============================================================================
  4390.  
  4391. class Window_Item
  4392.  
  4393.   def refresh
  4394.     if self.contents != nil
  4395.       self.contents.dispose
  4396.       self.contents = nil
  4397.     end
  4398.     if $game_temp.item_call != nil
  4399.       @data = []
  4400.       (1...$data_items.size).each {|i|
  4401.           if $game_party.item_number(i) > 0 && $game_temp.item_call.include?(i)
  4402.             @data.push($data_items[i])
  4403.           end}
  4404.     else
  4405.       @data, ids = [], (1...$data_items.size).to_a
  4406.       ids.clone.each {|id| ids -= $game_system.item_calls(id)}
  4407.       ids.each {|i| @data.push($data_items[i]) if $game_party.item_number(i) > 0}
  4408.       unless $game_temp.in_battle
  4409.         (1...$data_weapons.size).each {|i|
  4410.             @data.push($data_weapons[i]) if $game_party.weapon_number(i) > 0}
  4411.         (1...$data_armors.size).each {|i|
  4412.             @data.push($data_armors[i]) if $game_party.armor_number(i) > 0}
  4413.       end
  4414.     end
  4415.     @item_max = @data.size
  4416.     if @item_max > 0
  4417.       self.contents = Bitmap.new(width - 32, row_max * 32)
  4418.       @data.each_index {|i| draw_item(i)}
  4419.     end
  4420.   end
  4421.  
  4422. end
  4423.  
  4424. #==============================================================================
  4425. # Scene_Item
  4426. #==============================================================================
  4427.  
  4428. class Scene_Item
  4429.  
  4430.   alias main_itemcall_later main
  4431.   def main
  4432.     main_itemcall_later
  4433.     $game_temp.item_call = nil unless $scene.is_a?(Scene_Item)
  4434.   end
  4435.  
  4436.   alias update_item_itemcall_later update_item
  4437.   def update_item
  4438.     @item = @item_window.item
  4439.     ids = $game_system.item_calls(@item.id)
  4440.     if ids != [] && [0, 2].include?(@item.occasion) && Input.trigger?(Input::C)
  4441.       $game_system.se_play($data_system.decision_se)
  4442.       $game_party.lose_item(@item.id, 1) if @item.consumable
  4443.       $game_temp.item_call, $scene = ids, Scene_Item.new
  4444.     else
  4445.       update_item_itemcall_later
  4446.     end
  4447.   end
  4448.  
  4449. end
  4450.  
  4451. end
  4452.  
  4453. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4454. # Plug-in Save Point by Blizzard
  4455. # Version: 2.1b
  4456. # Type: Development Tool for Non-Scripters
  4457. # Date: 26.5.2006
  4458. # Date v2.0: 20.10.2007
  4459. # Date v2.0b: 20.2.2008
  4460. # Date v2.1b: 3.4.2008
  4461. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4462. #
  4463. # Compatibility:
  4464. #
  4465. #   99% compatible with SDK v1.x. 90% compatible with SDK v2.x. Could cause
  4466. #   problems with CMS-es, but very unlikely. Could cause problems with callable
  4467. #   scenes.
  4468. #
  4469. #
  4470. # Explanation:
  4471. #
  4472. #   This add-on allows you to create a save point like menu where the player
  4473. #   can change to any scene you specify. You are not limited to savepoints.
  4474. #
  4475. #
  4476. # Features:
  4477. #
  4478. #   - create a menu that calls scenes within minutes
  4479. #   - use any script you have; this add-on allows you to call any scene
  4480. #   - returns to the calling scene after finishing processing the other scene
  4481. #
  4482. #
  4483. # new in v2.0:
  4484. #   - first REAL public release
  4485. #   - completely overworked
  4486. #   - now supports any scene
  4487. #
  4488. # new in v2.0b:
  4489. #   - fixed a bug caused by a typing mistake
  4490. #   - now beta
  4491. #
  4492. # new in v2.1b:
  4493. #   - fixed a bug in the configuration setup
  4494. #
  4495. #
  4496. # Instructions:
  4497. #  
  4498. # - Configuration:
  4499. #
  4500. #   SCENE_CALLS - add any scene class declarations from other scripts like
  4501. #                 Scene_PartySwitcher, Scene_Bestiary, etc., you can also add
  4502. #                 any default scene like Scene_Save, Scene_Load, Scene_End etc.
  4503. #   SCENE_NAMES - add here the corresponding names for the scenes (in other
  4504. #                 words: you can call your scenes however you like)
  4505. #   WIN_WIDTH   - if your text gets squeezed together, increase this value
  4506. #   EXIT_SAVE   - word displayed to exit the Scene_SavePoint
  4507. #   MAP_BACK    - set to false if you don't want a map background or set to
  4508. #                 filename of picture file located in your "Pictures" folder
  4509. #                 that should be displayed as background
  4510. #   HOW_TO_BACK - if you are using a picture as background, set this value to 1
  4511. #                 if you want a centered background, to 2 if you want a
  4512. #                 stretched background and to 0 if you want it simply to stay
  4513. #                 in the upper left corner
  4514. #
  4515. # - Additional Funtions:
  4516. #  
  4517. #   You can call the Save Point by using the "Call Script" Event Command. Type
  4518. #   in the window following syntax:
  4519. #  
  4520. #     $scene = Scene_SavePoint.new
  4521. #  
  4522. #   When calling the scene, you can also specify disabled items by using an
  4523. #   array of indices.
  4524. #  
  4525. #     $scene = Scene_SavePoint.new([0, 2, 3])
  4526. #  
  4527. #   This example would disable the 1st, the 3rd and the 4th option.
  4528. #
  4529. #
  4530. # If you find any bugs, please report them here:
  4531. # http://forum.chaos-project.com/
  4532. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4533.  
  4534. if TONS_OF_ADDONS::SAVEPOINT
  4535.  
  4536. #==============================================================================
  4537. # module BlizzCFG
  4538. #==============================================================================
  4539.  
  4540. module BlizzCFG
  4541.  
  4542. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4543. # START Configuration
  4544. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4545.   SCENE_CALLS = ['Scene_Save', 'Scene_Load', 'Scene_End']
  4546.   SCENE_NAMES = ['Save Game', 'Load Game', 'End Game']
  4547.   WIN_WIDTH = 192
  4548.   EXIT_SAVE = 'Exit'
  4549.   MAP_BACK = true
  4550.   HOW_TO_BACK = 2
  4551. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4552. # END Configuration
  4553. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4554.  
  4555. end
  4556.  
  4557. #==============================================================================
  4558. # Scene_SavePoint
  4559. #==============================================================================
  4560.  
  4561. class Scene_SavePoint
  4562.  
  4563.   def initialize(disabled = [])
  4564.     @disabled, @scene = disabled, $scene.class
  4565.   end
  4566.    
  4567.   def main
  4568.     if BlizzCFG::MAP_BACK == true
  4569.       @spriteset = Spriteset_Map.new
  4570.     elsif BlizzCFG::MAP_BACK != false
  4571.       @spriteset = Sprite.new
  4572.       @spriteset.bitmap = RPG::Cache.picture(BlizzCFG::MAP_BACK)
  4573.       case BlizzCFG::HOW_TO_BACK
  4574.       when 1
  4575.         @spriteset.x = 320 - @spriteset.bitmap.width/2
  4576.         @spriteset.y = 240 - @spriteset.bitmap.height/2
  4577.       when 2
  4578.         @spriteset.zoom_x = 640.0 / @spriteset.bitmap.width
  4579.         @spriteset.zoom_y = 480.0 / @spriteset.bitmap.height
  4580.       end
  4581.     end
  4582.     @command_window = Window_Command.new(BlizzCFG::WIN_WIDTH,
  4583.         BlizzCFG::SCENE_NAMES + [BlizzCFG::EXIT_SAVE])
  4584.     @disabled.each {|i| @command_window.disable_item(i)}
  4585.     @command_window.x, @command_window.y, @command_window.opacity = 16, 16, 160
  4586.     Graphics.transition
  4587.     loop do
  4588.       Graphics.update
  4589.       Input.update
  4590.       update
  4591.       break if $scene != self
  4592.     end
  4593.     Graphics.freeze
  4594.     @spriteset.dispose if BlizzCFG::MAP_BACK != false
  4595.     @command_window.dispose
  4596.     if @scene != nil
  4597.       $scene.main
  4598.       $scene = self
  4599.     end
  4600.   end
  4601.  
  4602.   def update
  4603.     @command_window.update
  4604.     if Input.trigger?(Input::B)
  4605.       $game_system.se_play($data_system.cancel_se)
  4606.       $scene, @scene = @scene.new, nil
  4607.     elsif Input.trigger?(Input::C)
  4608.       if @command_window.index == BlizzCFG::SCENE_NAMES.size
  4609.         $game_system.se_play($data_system.decision_se)
  4610.         $scene, @scene = @scene.new, nil
  4611.       elsif @disabled.include?(@command_window.index)
  4612.         $game_system.se_play($data_system.buzzer_se)
  4613.       else
  4614.         $game_system.se_play($data_system.decision_se)
  4615.         eval("$scene = #{BlizzCFG::SCENE_CALLS[@command_window.index]}.new")
  4616.       end
  4617.     end
  4618.   end
  4619.    
  4620. end
  4621.  
  4622. end
  4623.  
  4624. #==============================================================================
  4625. #   Equipment Requirement System v2.10
  4626. #------------------------------------------------------------------------------
  4627. #   Created By: NAMKCOR
  4628. #   Created for the Websites: Chaos Project, RPG Maker Resource Kit
  4629. #                                        (www.chaosproject.co.nr; www.rmrk.net)
  4630. #   If this script is hosted on any other website, then it is stolen,
  4631. #   please contact me at the address given below
  4632. #   Requested by: SirMagus (RMRK)
  4633. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4634. # - code reviewed, optimized and integrated into Tons of Add-ons by Blizzard
  4635. # - this add-on is part of Tons of Add-ons with full permission of the original
  4636. #   author(s)
  4637. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4638. #   If you find any Bugs/Incompatability issues with this script, please
  4639. #   contact me at the following e-mail address: Rockman922@aol.com, and
  4640. #   please be descriptive with your e-mail subject, as I delete spam on sight.
  4641. #------------------------------------------------------------------------------
  4642. #   Function:
  4643. #    sets prerequisites for armor and weapons, based on level and statistics
  4644. #    i.e. they are unequippable until the requirements are met
  4645. #    like in Diablo II
  4646. #  
  4647. #   Compatability:
  4648. #    most likely compatible with SDK (untested)
  4649. #    no known issues at the moment
  4650. #  
  4651. #   Instructions to modify:
  4652. #    Comments and instructions for the individual customizations will be given
  4653. #    right where they are located.  Only real skills needed are reading, typing,
  4654. #    and copy&paste
  4655. #  
  4656. #   Instructions for use:
  4657. #    simply fill in the case sets instructed and the script will do the rest
  4658. #  
  4659. #------------------------------------------------------------------------------
  4660. #   Version History:
  4661. #   1.0 - completed system
  4662. #   2.0 - Major overhaul of the code, easier to configure, more efficient
  4663. #   2.1 - more efficient code (thanks for the help Blizz)
  4664. #==============================================================================
  4665.  
  4666. module NAMKCOR
  4667.  
  4668.   #============================================================================
  4669.   # to configure weapons' requirements you simply need to add a "when"
  4670.   # to the case of either weapons or armors, and then fill in the array
  4671.   # of requirements in the proper order
  4672.   #----------------------------------------------------------------------------
  4673.   # template:
  4674.   #   when (id) return [(level), (str), (dex), (agi), (int)]
  4675.   #============================================================================
  4676.   def self.ers_config(item)
  4677.     # weapon configuration
  4678.     if item.is_a?(RPG::Weapon)
  4679.       case item.id
  4680.       # START Weapon Configuration
  4681.       when 2 then return [2,0,0,0,0]
  4682.       when 3 then return [5,90,0,0,0]
  4683.       # END Weapon Configuration
  4684.       end
  4685.     elsif item.is_a?(RPG::Armor)
  4686.       case item.id
  4687.       # START Armor Configuration
  4688.       when 2 then return [2,0,0,0,0]
  4689.       when 4 then return [3,0,0,0,0]
  4690.       when 5 then return [3,0,0,0,0]
  4691.       # END Armor Configuration
  4692.       end
  4693.     end
  4694.     return [1,0,0,0,0]
  4695.   end
  4696.  
  4697. end
  4698.  
  4699. #==============================================================================
  4700. # DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
  4701. #==============================================================================
  4702.  
  4703. class Scene_Equip
  4704.  
  4705.   alias update_item_ers_later update_item
  4706.   def update_item
  4707.     if $game_system.EQUIPMENT_REQUIREMENT
  4708.       itemstats = NAMKCOR.ers_config(@item_window.item)
  4709.       if Input.trigger?(Input::C) && (@actor.level < itemstats[0] ||
  4710.           @actor.str < itemstats[1] || @actor.dex < itemstats[2] ||
  4711.           @actor.agi < itemstats[3] || @actor.int < itemstats[4])
  4712.         $game_system.se_play($data_system.buzzer_se)
  4713.         return
  4714.       end
  4715.     end
  4716.     update_item_ers_later
  4717.   end
  4718.  
  4719. end
  4720.  
  4721. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4722. # Item Requirement for Skills by Blizzard
  4723. # Version: 1.0
  4724. # Type: Game Alteration
  4725. # Date: 7.12.2007
  4726. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4727. #
  4728. #   This add-on can make skills require items to be used. Those skills cannot
  4729. #   be used if the appropriate number of items is not in the inventory. Items
  4730. #   will be consumed ONLY IF THEY ARE CONSUMABLE! Enemies do not consume items
  4731. #   when they use the same skills.
  4732. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4733.  
  4734. module BlizzCFG
  4735.  
  4736.   def self.item_reqs(id)
  4737.     case id
  4738. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4739. # START Item Requirement Database
  4740. #  
  4741. #   Use following template to configure your database below:
  4742. #    
  4743. #     when SKILL_ID then return [ITEM_ID, QUANTITY]
  4744. #  
  4745. #   SKILL_ID - ID of the skill
  4746. #   ITEM_ID  - ID of the required item
  4747. #   QUANTITY - how many items the skill requires
  4748. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4749.     when 1 then return [1, 1]
  4750. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4751. # END Item Requirement Database
  4752. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4753.     end
  4754.     return [0, 0]
  4755.   end
  4756.  
  4757. end
  4758.  
  4759. #==============================================================================
  4760. # Game_Battler
  4761. #==============================================================================
  4762.  
  4763. class Game_Battler
  4764.  
  4765.   alias skill_effect_item_reqs_later skill_effect
  4766.   def skill_effect(user, skill)
  4767.     result = skill_effect_item_reqs_later(user, skill)
  4768.     if $game_system.ITEM_REQUIREMENT
  4769.       data = BlizzCFG.item_reqs(skill.id)
  4770.       if user.is_a?(Game_Actor) && data.all? {|i| i > 0}
  4771.         $game_party.lose_item(data[0], data[1])
  4772.       end
  4773.     end
  4774.     return result
  4775.   end
  4776.  
  4777.   alias skill_can_use_item_reqs_later? skill_can_use?
  4778.   def skill_can_use?(skill_id)
  4779.     if $game_system.ITEM_REQUIREMENT
  4780.       data = BlizzCFG.item_reqs(skill_id)
  4781.       if self.is_a?(Game_Actor) && $game_party.item_number(data[0]) < data[1]
  4782.         return false
  4783.       end
  4784.     end
  4785.     return skill_can_use_item_reqs_later?(skill_id)
  4786.   end
  4787.  
  4788. end
  4789.  
  4790. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4791. # HP/SP Crush by Blizzard
  4792. # Version: 1.0
  4793. # Type: Game Alteration
  4794. # Date: 3.4.2008
  4795. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4796. #
  4797. #   This add-on allows you to make weapons consume HP/SP for each attack. The
  4798. #   attack will not be executed if there are not enough HP or SP. The actor can
  4799. #   use up all SP and/or all HP (except 1) for an attack to succeed. If you use
  4800. #   negative values in the configuration, the stats will be restored instead of
  4801. #   consumed.
  4802. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4803.  
  4804. module BlizzCFG
  4805.  
  4806.   def self.hpsp_crush(id)
  4807.     case id
  4808. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4809. # START HP/SP Crush Database
  4810. #  
  4811. #   Use following template to configure your database below:
  4812. #    
  4813. #     when WEAPON_ID then return [HP_CONSUME, SP_CONSUME]
  4814. #  
  4815. #   WEAPON_ID  - ID of the weapon
  4816. #   HP_CONSUME - how many HP are consumed when attacking
  4817. #   SP_CONSUME - how many SP are consumed when attacking
  4818. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4819.     when 1 then return [100, 0]
  4820.     when 2 then return [0, 50]
  4821. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4822. # END HP/SP Crush Database
  4823. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4824.     end
  4825.     return [0, 0]
  4826.   end
  4827.  
  4828. end
  4829.  
  4830. #==============================================================================
  4831. # Game_Battler
  4832. #==============================================================================
  4833.  
  4834. class Game_Battler
  4835.  
  4836.   def attack_can_use?
  4837.     reqs = BlizzCFG.hpsp_crush(@weapon_id)
  4838.     return (reqs[0] < self.hp && reqs[1] <= self.sp)
  4839.   end
  4840.  
  4841. end
  4842.  
  4843. #==============================================================================
  4844. # Scene_Battle
  4845. #==============================================================================
  4846.  
  4847. class Scene_Battle
  4848.  
  4849.   alias make_basic_action_result_hpsp_crush_later make_basic_action_result
  4850.   def make_basic_action_result(battler = nil)
  4851.     if battler != nil
  4852.       current_battler = battler
  4853.     else
  4854.       current_battler = @active_battler
  4855.     end
  4856.     if $game_system.HP_SP_CRUSH && current_battler.is_a?(Game_Actor)
  4857.       return unless current_battler.attack_can_use?
  4858.       reqs = BlizzCFG.hpsp_crush(current_battler.weapon_id)
  4859.       current_battler.hp -= reqs[0]
  4860.       current_battler.sp -= reqs[1]
  4861.       @status_window.refresh
  4862.     end
  4863.     if battler == nil
  4864.       make_basic_action_result_hpsp_crush_later
  4865.     else
  4866.       make_basic_action_result_hpsp_crush_later(battler)
  4867.     end
  4868.   end
  4869.  
  4870. end
  4871.  
  4872. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4873. # Roulette by Blizzard
  4874. # Version: 1.0b
  4875. # Type: Skill Add-on
  4876. # Date: 19.10.2008
  4877. # Date v1.0b: 6.10.2009
  4878. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4879. #
  4880. #   This add-on allows you to create skills that target a random actor, random
  4881. #   enemy or random battler from both groups with a nice animation. The normal
  4882. #   target scope in the database should be set to "None".
  4883. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  4884.  
  4885. #==============================================================================
  4886. # module BlizzCFG
  4887. #==============================================================================
  4888.  
  4889. module BlizzCFG
  4890. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4891. # START Configuration
  4892. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4893.   # targets random ally
  4894.   TARGET_ALLY = [57]
  4895.   # targets random dead ally
  4896.   TARGET_DEAD_ALLY = [58]
  4897.   # targets random enemy
  4898.   TARGET_ENEMY = [59]
  4899.   # targets random battler from both groups
  4900.   TARGET_RANDOM = [60]
  4901.   # show roulette animation
  4902.   ROULETTE_ANIMATE = true
  4903.   # sound effect when switching the battler during animation
  4904.   ROULETTE_SOUND = RPG::AudioFile.new('001-System01', 80, 100)
  4905.   # time the arrow stays on one battler during animation (4 is recommended)
  4906.   ROULETTE_STOP_FRAME = 4
  4907. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4908. # END Configuration
  4909. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4910.   # compatibility constants
  4911.   SCOPE_RANDOM_ALLY = 101
  4912.   SCOPE_RANDOM_DEAD_ALLY = 102
  4913.   SCOPE_RANDOM_ENEMY = 103
  4914.   SCOPE_RANDOM = 104
  4915.  
  4916.   def self.get_next_target(count, max_count, target, battlers)
  4917.     next_target = nil
  4918.     if count > max_count / 2
  4919.       if count % ROULETTE_STOP_FRAME == 0
  4920.         $game_system.se_play(ROULETTE_SOUND)
  4921.         next_target = battlers.shift
  4922.         battlers.push(next_target)
  4923.       end
  4924.     elsif count > max_count / 4
  4925.       if count % (ROULETTE_STOP_FRAME * 2) == 0
  4926.         $game_system.se_play(ROULETTE_SOUND)
  4927.         next_target = battlers.shift
  4928.         battlers.push(next_target)
  4929.       end
  4930.     elsif count > max_count / 8
  4931.       next_target = target if count % (ROULETTE_STOP_FRAME * 4) == 0
  4932.     else
  4933.       next_target = target
  4934.     end
  4935.     return next_target
  4936.   end
  4937.  
  4938. end
  4939.  
  4940. #==============================================================================
  4941. # RPG::Skill
  4942. #==============================================================================
  4943.  
  4944. class RPG::Skill
  4945.  
  4946.   alias scope_roulette_later scope
  4947.   def scope
  4948.     if $game_system.ROULETTE
  4949.       if BlizzCFG::TARGET_ALLY.include?(@id)
  4950.         return BlizzCFG::SCOPE_RANDOM_ALLY
  4951.       elsif BlizzCFG::TARGET_DEAD_ALLY.include?(@id)
  4952.         return BlizzCFG::SCOPE_RANDOM_DEAD_ALLY
  4953.       elsif BlizzCFG::TARGET_ENEMY.include?(@id)
  4954.         return BlizzCFG::SCOPE_RANDOM_ENEMY
  4955.       elsif BlizzCFG::TARGET_RANDOM.include?(@id)
  4956.         return BlizzCFG::SCOPE_RANDOM
  4957.       end
  4958.     end
  4959.     return scope_roulette_later
  4960.   end
  4961.  
  4962. end
  4963.  
  4964. #==============================================================================
  4965. # Arrow_Roulette
  4966. #==============================================================================
  4967.  
  4968. class Arrow_Roulette < Arrow_Base
  4969.  
  4970.   attr_reader :count
  4971.  
  4972.   def initialize(target, battlers, viewport = nil)
  4973.     @target, @battlers = target, battlers
  4974.     @count = @max_count = BlizzCFG::ROULETTE_STOP_FRAME * 40
  4975.     super(viewport)
  4976.     self.visible = false
  4977.   end
  4978.  
  4979.   def update(override = false)
  4980.     return unless override
  4981.     self.visible = true
  4982.     super()
  4983.     next_target =
  4984.         BlizzCFG.get_next_target(@count, @max_count, @target, @battlers)
  4985.     @count -= 1
  4986.     if next_target != nil
  4987.       if @current_target != next_target
  4988.         $game_system.se_play(BlizzCFG::ROULETTE_SOUND)
  4989.       end
  4990.       @current_target = next_target
  4991.       self.x = @current_target.screen_x
  4992.       self.y = @current_target.screen_y
  4993.     end
  4994.   end
  4995.  
  4996. end
  4997.  
  4998. #==============================================================================
  4999. # Scene_Battle
  5000. #==============================================================================
  5001.  
  5002. class Scene_Battle
  5003.  
  5004.   alias set_target_battlers_roulette_later set_target_battlers
  5005.   def set_target_battlers(scope, battler = nil)
  5006.     if $game_system.ROULETTE
  5007.       b = battler == nil ? @active_battler : battler
  5008.       battlers = []
  5009.       if scope == BlizzCFG::SCOPE_RANDOM_ALLY && b.is_a?(Game_Actor) ||
  5010.           scope == BlizzCFG::SCOPE_RANDOM_ENEMY && b.is_a?(Game_Enemy)
  5011.         battlers = $game_party.actors.find_all {|a| a.exist?}
  5012.       elsif scope == BlizzCFG::SCOPE_RANDOM_DEAD_ALLY && b.is_a?(Game_Actor)
  5013.         battlers = $game_party.actors.find_all {|a| a.dead?}
  5014.       elsif scope == BlizzCFG::SCOPE_RANDOM_ALLY && b.is_a?(Game_Enemy) ||
  5015.           scope == BlizzCFG::SCOPE_RANDOM_ENEMY && b.is_a?(Game_Actor)
  5016.         battlers = $game_troop.enemies.find_all {|a| a.exist?}
  5017.       elsif scope == BlizzCFG::SCOPE_RANDOM
  5018.         battlers = ($game_party.actors + $game_troop.enemies).find_all {|a|
  5019.             a.exist?}
  5020.       else
  5021.         battlers = nil
  5022.       end
  5023.       if battlers != nil
  5024.         target = battlers[rand(battlers.size)]
  5025.         if BlizzCFG::ROULETTE_ANIMATE
  5026.           while 25 % battlers.size != battlers.index(target)
  5027.             battlers.push(battlers.shift)
  5028.           end
  5029.           @roulette_arrow = Arrow_Roulette.new(target, battlers)
  5030.         end
  5031.         (battler == nil ? @target_battlers : battler.target).push(target)
  5032.         return
  5033.       end
  5034.     end
  5035.     if battler != nil
  5036.       set_target_battlers_roulette_later(scope, battler)
  5037.     else
  5038.       set_target_battlers_roulette_later(scope)
  5039.     end
  5040.   end
  5041.  
  5042.   alias update_phase4_step4_roulette_later update_phase4_step4
  5043.   def update_phase4_step4(battler = nil)
  5044.     if @roulette_arrow != nil
  5045.       if @roulette_arrow.count > 0
  5046.         @roulette_arrow.update(true)
  5047.       else
  5048.         @roulette_arrow.dispose
  5049.         @roulette_arrow = nil
  5050.       end
  5051.     elsif battler != nil
  5052.       update_phase4_step4_roulette_later(battler)
  5053.     else
  5054.       update_phase4_step4_roulette_later
  5055.     end
  5056.   end
  5057.  
  5058. end
  5059.  
  5060. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  5061. # Chain Status Effects by Blizzard
  5062. # Version: 1.0b
  5063. # Type: Status Add-on
  5064. # Date: 29.10.2008
  5065. # Date v1.0b: 5.10.2009
  5066. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  5067. #
  5068. #   This add-on allows you to create status effects that need to be part of
  5069. #   a status effect chain reaction. i.e. Status B has status A as precondition,
  5070. #   then status B cannot be inflicted as long as status A has not been
  5071. #   inflicted first. Keep in mind that your skills/weapons/items/etc. have to
  5072. #   be able to inflict the next status effect in the chain!
  5073. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  5074.  
  5075. #==============================================================================
  5076. # module BlizzCFG
  5077. #==============================================================================
  5078.  
  5079. module BlizzCFG
  5080.  
  5081.   def self.chain_state_database(id)
  5082.     case id
  5083. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5084. # START Chain Status Effect Database
  5085. #
  5086. #   Use following template to create gold loot for enemies:
  5087. #
  5088. #     when ID then return [[REMOVE, S_ID1, S_ID2, ...], [REMOVE, S_ID3, ...], ...]
  5089. #
  5090. #   ID     - status effect ID
  5091. #   S_ID   - status effect ID precondition
  5092. #   REMOVE - flag if previous states should be removed
  5093. #
  5094. #   Example:
  5095. #
  5096. #     when 3 then return [[false, 1, 2, 5], [true, 7, 8], [false, 1, 8]]
  5097. #  
  5098. #   Status Effect with ID 3 can be triggered with one of the following status
  5099. #   effect combinations:
  5100. #  
  5101. #     a) Status effects 1, 2 and 5
  5102. #     b) Status effects 7 and 8
  5103. #     c) Status effects 1 and 8
  5104. #  
  5105. #   If ANY of these combination applies, the new status effect will be applied.
  5106. #   In the b) case the old states (7 and 8) will be removed when 3 is
  5107. #   inflicted. If both condition a) and c) apply, then a) will be executed as
  5108. #   is comes first so it has higher priority.
  5109. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5110.     when 3 then return [[false, 1, 2, 5], [true, 7, 8], [false, 1, 8]]
  5111.     when 4 then return [[true, 5]]
  5112. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5113. # END Chain Status Effect Database
  5114. #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5115.     end
  5116.     return []
  5117.   end
  5118.  
  5119. end
  5120.  
  5121. #==============================================================================
  5122. # Game_Battler
  5123. #==============================================================================
  5124.  
  5125. class Game_Battler
  5126.  
  5127.   alias states_plus_chain_status_later states_plus
  5128.   def states_plus(plus_state_set, battler = nil)
  5129.     plus_state_set, battler = battler, plus_state_set if battler != nil
  5130.     if $game_system.CHAIN_STATUS
  5131.       state_set, chain_states, chain_conditions = plus_state_set.clone, [], []
  5132.       plus_state_set.each {|state_id|
  5133.           data = BlizzCFG.chain_state_database(state_id)
  5134.           if data.size > 0
  5135.             data.each {|condition|
  5136.                 if condition[1, condition.size-1].all? {|id| @states.include?(id)}
  5137.                   chain_states.push(state_id)
  5138.                   chain_conditions.push(condition)
  5139.                   break
  5140.                 end}
  5141.             state_set.delete(state_id) unless chain_states.include?(state_id)
  5142.           end}
  5143.       current_chain_states = chain_states & @states
  5144.       result = states_plus_chain_status_later(state_set)
  5145.       chain_states.each_index {|i|
  5146.           if !current_chain_states.include?(chain_states[i]) &&
  5147.               @states.include?(chain_states[i]) && chain_conditions[i][0]
  5148.             chain_conditions[i][1, chain_conditions[i].size-1].each {|id|
  5149.                 remove_state(id)}
  5150.           end}
  5151.       return result
  5152.     elsif battler != nil
  5153.       return states_plus_chain_status_later(battler, plus_state_set)
  5154.     else
  5155.       return states_plus_chain_status_later(plus_state_set)
  5156.     end
  5157.   end
  5158.  
  5159. end
  5160.  
  5161. #==============================================================================
  5162. # ** Actor-specific Item Usability
  5163. #------------------------------------------------------------------------------
  5164. # by Fantasist
  5165. # Version 1.01
  5166. # 21-Nov-2008
  5167. #------------------------------------------------------------------------------
  5168. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  5169. # - code reviewed, optimized, integrated into Tons of Add-ons, freed from
  5170. #   potential bugs and beta tested by Blizzard
  5171. # - this add-on is part of Tons of Add-ons with full permission of the original
  5172. #   author(s)
  5173. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  5174. #------------------------------------------------------------------------------
  5175. # Version History:
  5176. #
  5177. #   v1.0 - First release
  5178. #------------------------------------------------------------------------------
  5179. # Description:
  5180. #
  5181. #     This scriptlet enables you to define which items can't be consumed by
  5182. #   each actor. For example, actor ID 4 (who maybe a robot) cannot use
  5183. #   "Potion". Similarly, actor ID 1 (Arshes) cannot consume "Recharge Cell".
  5184. #------------------------------------------------------------------------------
  5185. # Compatibility:
  5186. #
  5187. #    - Should be compatible with most scripts.
  5188. #------------------------------------------------------------------------------
  5189. # Instructions:
  5190. #
  5191. #   Place this below "Scene_Debug" and above "Main"
  5192. #------------------------------------------------------------------------------
  5193. # Configuration:
  5194. #
  5195. #     Scroll down and you'll find the configuration.
  5196. #
  5197. #   The main syntax is:
  5198. #
  5199. #     when ACTOR_ID then [IDs of all items which this actor CAN'T use]
  5200. #
  5201. #   Examples:
  5202. #
  5203. #     when 1 then [1, 2] # Arshes can't use "Potion" and "High Potion".
  5204. #
  5205. #     when 7 then [10, 11, 12] # Gloria can't use "Full Tonic", "Antidote" and
  5206. #                              # "Dispell Herb".
  5207. #
  5208. #   NOTE: For all actors without a configuration, items are usable by default.
  5209. #         So if Basil can use all items, then you don't need to configure for
  5210. #         ID 2.
  5211. #------------------------------------------------------------------------------
  5212. # Issues:
  5213. #
  5214. #     None that I know of.
  5215. #------------------------------------------------------------------------------
  5216. # Credits and Thanks:
  5217. #
  5218. #   Credits: Fantasist, for making this
  5219. #   Thanks: Spoofus, for requesting this
  5220. #------------------------------------------------------------------------------
  5221. # Notes:
  5222. #
  5223. #   If you have any problems or suggestions, you can find me at:
  5224. #
  5225. #    - www.chaos-project.com
  5226. #    - www.quantumcore.forumotion.com
  5227. #
  5228. #   Enjoy ^_^
  5229. #============================================================================
  5230.  
  5231. #==============================================================================
  5232. # * module FTSConfigs
  5233. #==============================================================================
  5234.  
  5235. module FTSConfigs
  5236.  
  5237.   def self.item_can_consume?(actor_id, item_id)
  5238.     nonusable_item_ids = case actor_id
  5239.     #==========================================================================
  5240.     # * CONFIG BEGIN
  5241.     #==========================================================================
  5242.     when 1 then [1]
  5243.     when 2 then [2]
  5244.     # when ACTOR_ID then [IDs of all items which this actor CAN'T use]
  5245.     #==========================================================================
  5246.     # * CONFIG END
  5247.     #==========================================================================
  5248.     else
  5249.       []
  5250.     end
  5251.     return !nonusable_item_ids.include?(item_id)
  5252.   end
  5253.  
  5254. end
  5255.  
  5256. #==============================================================================
  5257. # * Game_Battler
  5258. #==============================================================================
  5259.  
  5260. class Game_Battler
  5261.  
  5262.   alias item_effect_actoritem_override item_effect
  5263.   def item_effect(item, battler = nil)
  5264.     if $game_system.ACTOR_ITEMS && self.is_a?(Game_Actor)
  5265.       return false if !FTSConfigs.item_can_consume?(self.id, item.id)
  5266.     end
  5267.     return item_effect_actoritem_override(item) if battler == nil
  5268.     return item_effect_actoritem_override(item, battler)
  5269.   end
  5270.  
  5271. end
  5272.  
  5273. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=#
  5274. # Percentage Health States by TerreAqua
  5275. # Version: 1.5
  5276. # Type: Battle States Add-on
  5277. # Key Term: Battle Add-on
  5278. # Date: 6/17/09
  5279. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  5280. # - code reviewed, optimized, integrated into Tons of Add-ons, freed from
  5281. #   potential bugs and beta tested by Blizzard
  5282. # - this add-on is part of Tons of Add-ons with full permission of the original
  5283. #   author(s)
  5284. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=#
  5285.  
  5286. #===============================================================================
  5287. # Information
  5288. #-------------------------------------------------------------------------------
  5289. #
  5290. #   This script makes it so that battlers will gain states when they are below a
  5291. #   certain percentage of health.  The states would be automatically lost when
  5292. #   the battler's health is above the configured percentage.
  5293. #   Note:  this affects all actors and enemies.
  5294. #
  5295. #   If you need to contact me about this script, please go to:
  5296. #   http://forum.chaos-project.com
  5297. #===============================================================================
  5298. module Aqua
  5299.   module HealthStates
  5300. #:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
  5301. #:~:~:~:~:~:~:~:~:~:~::~:~:~: Instructions :~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
  5302. #:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
  5303. #===============================================================================
  5304. # Configure the below modules in the following format:
  5305. #
  5306. # MODULE = [[X, Y]]
  5307. #
  5308. # MODULE is the below modules.  You don't change these, and they all follow the
  5309. #    same format.
  5310. # X is the percent of health for the state to activate (can be a decimal).
  5311. # Y is the state id.
  5312. #
  5313. #===============================================================================
  5314.  
  5315. # HP States that affect all battlers
  5316. HP_STATES_ALL = [[25, 18]]
  5317.  
  5318. # HP States that only affect actors
  5319. HP_STATES_ACTORS = []
  5320.  
  5321. # Actor specific HP States
  5322. # Format is:  when ACTOR_ID then return [[X, Y]]
  5323. def self.actor(id)
  5324.   case id
  5325.   when 1 then return [[95, 5], [70, 4]]
  5326.   when 2 then return [[98, 4]]
  5327.   end
  5328.   return []
  5329. end
  5330.  
  5331. # HP States that only affect enemies
  5332. HP_STATES_ENEMIES = []
  5333.  
  5334. # Enemy specific HP States
  5335. # Format is:  when ENEMY_ID then return [[X, Y]]
  5336. def self.enemy(id)
  5337.   case id
  5338.   when 1 then return [[99, 5]]
  5339.   end
  5340.   return []
  5341. end
  5342.  
  5343. #:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
  5344. #:~:~:~:~:~:~:~:~:~:~:~:~  End Configure Area  :~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
  5345. #:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
  5346.  
  5347. end
  5348. end
  5349.  
  5350. #===============================================================================
  5351. # Credits:
  5352. # Aqua (aka TerreAqua) for making this.
  5353. # Subsonic_Noise for requesting that I release it.
  5354. # Starrodkirby86 for letting me rant to him.
  5355. #===============================================================================
  5356.  
  5357. class Game_Battler
  5358.  
  5359.   alias hp_is_hp_percent_states hp=
  5360.   def hp=(value)
  5361.     hp_is_hp_percent_states(value)
  5362.     check_hp_percent_states if $game_system.HP_PERCENT_STATES
  5363.   end
  5364.  
  5365.   def check_hp_percent_states
  5366.     states = Aqua::HealthStates::HP_STATES_ALL.clone
  5367.     if self.is_a?(Game_Actor)
  5368.       states |= Aqua::HealthStates.actor(self.id)
  5369.       states |= Aqua::HealthStates::HP_STATES_ACTORS
  5370.     elsif self.is_a?(Game_Enemy)
  5371.       states |= Aqua::HealthStates.enemy(self.id)
  5372.       states |= Aqua::HealthStates::HP_STATES_ENEMIES
  5373.     end
  5374.     states.each {|state| check_hp_percent_state(state[0], state[1])}
  5375.   end
  5376.  
  5377.   def check_hp_percent_state(hp_percent, state_id)
  5378.     if self.hp * 100 / self.maxhp <= hp_percent
  5379.       add_state(state_id)
  5380.     else
  5381.       remove_state(state_id)
  5382.     end
  5383.   end
  5384.  
  5385. end
  5386.  
  5387. #===============================================================================
  5388. # Monster Areas
  5389. # Author game_guy (Ronnie Mooney)
  5390. # Version 1.0
  5391. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  5392. # - code reviewed, optimized, integrated into Tons of Add-ons, freed from
  5393. #   potential bugs and beta tested by Blizzard
  5394. # - this add-on is part of Tons of Add-ons with full permission of the original
  5395. #   author(s)
  5396. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=#
  5397. # Intro
  5398. # Remeber back in the good o' RPG 2000 and 2003 days? You could have areas in
  5399. # your maps. Perfect for world maps or different parts of caves. Basically each
  5400. # map has a set of areas. Each area has a certain size and certain troops.
  5401. # While in a certain area, you'll only run into the assigned troops to that
  5402. # area.
  5403. #
  5404. # Features
  5405. # Easy to configure (Lengthy though)
  5406. # Unlimited areas for each map
  5407. # Only configure maps you need it for
  5408. #
  5409. # Instructions
  5410. # All configuration instructions are below.
  5411. #
  5412. # (No not literally directly below. Further down idiot.)
  5413. #
  5414. # Credits
  5415. # game_guy ~ for making it
  5416. # Enterbrain ~ adding this feature in the old makers
  5417. #
  5418. # People who are being uncredited because of reason explained
  5419. # Enterbrain ~ for removing this feature in the new makers
  5420. #
  5421. # Notes
  5422. # Alright, in the demo and script itself is a little sarcasm and joking.
  5423. # Just trying to spice this boring info up. Whats wrong with that eh?
  5424. # Anyways if you tried the demo, be sure to read the names of the enemies
  5425. # would ya? He he.. Also I would like to point out that the other Area scripts
  5426. # I've seen had a bigger complicated configuration plus their code was
  5427. # complicated and uneeded. Taking out my config, look at how many lines of
  5428. # code there actually are. So ha other people. I win =D
  5429. #
  5430. # Special Thanks
  5431. # Blizzard
  5432. # Winkio
  5433. # Fantasist
  5434. # Zeriab
  5435. # These guys had the most impact on me and helped me the most when it came to
  5436. # scripting. Without them and their knowledge I would have made this script
  5437. # alot more complicated. Hell I'd probably still be an eventer if it wasn't for
  5438. # them inspiring me to try and be a scripter. I learned most of the tricks I
  5439. # know from them. Thanks guys =D
  5440. #
  5441. # (Still being an idiot? Further down stupid.)
  5442. #===============================================================================
  5443.  
  5444. #==============================================================================
  5445. # module GG_Areas
  5446. #==============================================================================
  5447.  
  5448. module GG_Areas
  5449.  
  5450.   Maps = []
  5451.   # (Yes, right here sir(s)/madam(s).) (bout time)
  5452.   #========================================================
  5453.   # Maps
  5454.   # First you'll need to add a new line under
  5455.   # 'Add new lines under this' then type this
  5456.   # Map[map_id] = []
  5457.   # map_id is the id of the map you want to give some areas
  5458.   # (read below for area setup)
  5459.   #========================================================
  5460.   Maps[1] = []
  5461.   #========================================================
  5462.   # Under your new line and assigned map you have to add
  5463.   # more lines. So go ahead and type the following
  5464.   # Maps[map_id][area_id] = [x_start, y_start, width, height, [troops]]
  5465.   # -map_id = id of the map in the editor
  5466.   # -area_id = area number (has to be different for each area in the maps)
  5467.   # -x_start = the x coordinate where the area begins on the map
  5468.   # -y_start = the y coordinate where the area begins on the map
  5469.   # -width = width of the area (in tiles)
  5470.   # -height = height of the area (in tiles)
  5471.   # (Look at examples below)
  5472.   #========================================================
  5473.   # Below map is this in 'Non coder' terms
  5474.   # Map number 1, area number 1 starts in the coordinates
  5475.   # of x 0, y 0. The width is 7 tiles wide, and height is
  5476.   # 7 tiles tall. It has the troop numbers 1 2 and 3.
  5477.   # (If this isn't clear enough. Then GTFO >:U (:V?)
  5478.   #========================================================
  5479.   Maps[1][1] = [0, 0, 7, 7, [1, 2, 3]]
  5480.   Maps[1][2] = [7, 0, 7, 7, [4, 5, 6]]
  5481.   Maps[1][3] = [14, 0, 6, 7, [7, 8, 9]]
  5482.   Maps[1][4] = [0, 8, 7, 7, [10, 11, 12]]
  5483.   Maps[1][5] = [7, 8, 7, 7, [13, 14, 15]]
  5484.   Maps[1][6] = [14, 8, 6, 7, [16, 17, 18]]
  5485.   # 'Add new lines under this'
  5486.  
  5487. end
  5488.  
  5489. # In case you didn't realize, the config is above. You scrolled too far down
  5490. # Idiot...
  5491. # Seriously?!?!?! Look at how simple it is =O And nobody came up with this?
  5492.  
  5493. #==============================================================================
  5494. # Game_Map
  5495. #==============================================================================
  5496.  
  5497. class Game_Map
  5498.  
  5499.   attr_accessor :map
  5500.  
  5501. end
  5502.  
  5503. #==============================================================================
  5504. # Game_Player
  5505. #==============================================================================
  5506.  
  5507. class Game_Player
  5508.  
  5509.   alias gg_upd_areas_player_lat update
  5510.   def update
  5511.     gg_upd_areas_player_lat
  5512.     return if !$game_system.MONSTER_AREAS
  5513.     areas = GG_Areas::Maps[$game_map.map_id]
  5514.     return if areas == nil
  5515.     areas.each {|a|
  5516.         if a != nil && @x >= a[0] && @x <= a[0] + a[2] - 1
  5517.           if @y >= a[1] && @y <= a[3] + a[1] - 1
  5518.             $game_map.map.encounter_list = a[4]
  5519.           end
  5520.         end}
  5521.   end
  5522.  
  5523. end
  5524.  
  5525. #===============================================================================
  5526. # Realistic Ladders
  5527. # Version 1.0
  5528. # Author game_guy
  5529. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  5530. # - code reviewed, optimized, integrated into Tons of Add-ons, freed from
  5531. #   potential bugs and beta tested by Blizzard
  5532. # - this add-on is part of Tons of Add-ons with full permission of the original
  5533. #   author(s)
  5534. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=#
  5535. # Intro:
  5536. # Make ladders more realistic with this small script. Now when you go up and
  5537. # down ladders, your character will always be facing up.
  5538. #
  5539. # Features:
  5540. # Use Multiple Terrains
  5541. # Make Ladders more Realistic
  5542. #
  5543. # Instructions:
  5544. # Hop on down to the Config below and enter in the terrain tags you would like
  5545. # to use as Ladder tags. When a player is over a ladder tag, the character will
  5546. # always be facing up until it steps off of the lader.
  5547. #
  5548. # Credits:
  5549. # game_guy ~ For creating it.
  5550. # Ummm, anyone else?
  5551. #
  5552. # More comments than code
  5553. # Can be easily evented
  5554. # Made for the lazy
  5555. #===============================================================================
  5556.  
  5557. #==============================================================================
  5558. # GG_Ladders
  5559. #==============================================================================
  5560.  
  5561. module GG_Ladders
  5562.  
  5563.   #=========================================
  5564.   # Terrains
  5565.   # An array containing all terrain tags
  5566.   # you would like to use as Ladder Tags
  5567.   #=========================================
  5568.   Terrains = [5, 6, 7]
  5569.  
  5570. end
  5571.  
  5572. #==============================================================================
  5573. # Game_Player
  5574. #==============================================================================
  5575.  
  5576. class Game_Player
  5577.  
  5578.   alias gg_upd_ladder_tag_lat update
  5579.   def update
  5580.     gg_upd_ladder_tag_lat
  5581.     return if !$game_system.REALISTIC_LADDERS
  5582.     flag = GG_Ladders::Terrains.include?(terrain_tag)
  5583.     @direction = 8 if flag
  5584.     @direction_fix = flag
  5585.   end
  5586.  
  5587. end
  5588.  
  5589. # ----------------------------------------------------------------------------
  5590. #          Event Z-Index Controller by Heretic
  5591. #          Version: 1.2
  5592. #          Date: 23.4.2012
  5593. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  5594. # - code reviewed, optimized, integrated into Tons of Add-ons, freed from
  5595. #   potential bugs and beta tested by Blizzard
  5596. # - this add-on is part of Tons of Add-ons with full permission of the original
  5597. #   author(s)
  5598. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  5599. # This script allows you to make large sprites look like they are laying flat
  5600. # on the ground. All EVENTS cover flat sprites. Non priority tiles will appear
  5601. # beneath a Flat Sprite Event.
  5602. #
  5603. # Added controls added to allow mappers more control over the event Z-Index
  5604. # which is useful for stacking events or event layering. Event ID's used to
  5605. # determine which event would render on top of another. The Z-Index controls
  5606. # allow a mapper to determine which event will be on top of another without
  5607. # needing to bother with Event ID's.
  5608. #
  5609. # NOTE: Each tile in RMXP is 32 pixels tall. If you need to adjust an event's
  5610. # Z-Index, I recommend trying increments of 32 at first to get you closer to
  5611. # the value you want. Regardless, you can use any integer value.
  5612. #
  5613. # --- EVENT NAME RELATED---
  5614. #
  5615. # EV001\z_flat
  5616. # EV001\z_flat[32]
  5617. # EV001\z_add[32]
  5618. #
  5619. # To make an event always render as flat, add to its nane "\z_flat".
  5620. #
  5621. # To make an event always have an adjusted Z-Index, add to its name
  5622. # "\z_add[Int]".
  5623. #
  5624. # To make an event always render as flat, but with an altered Z-Index,
  5625. # add to its name "\z_flat[Int]" (this is an equivalent to using \z_flat and
  5626. # \z_add[Int] together). Imagine having one graphic that has flat parts and
  5627. # other parts that should be standing.
  5628. #
  5629. # --- SCRIPTED EVENT RELATED ---
  5630. #
  5631. # To turn on/off flat rendering, use a Move Route Script for that event
  5632. # "set_z_flat(Bool)". This is useful for when changing graphics of events.
  5633. #
  5634. # To specify a higher or lower Z-Index, use the optional parameter:
  5635. # such as "set_z_flat(Bool, Int)".
  5636. #
  5637. # To reset everything in a sprite, use a Move Route Script "reset_z_index".
  5638. # "reset_z_index" will reset everything to the initial values of the map.
  5639. #
  5640. # To make a manual adjustment to a sprite's Z-Index, use set_z_add(Int)
  5641. # and I recommend incrementing/decrementing the Int by 32.
  5642. #
  5643. # To clear any special Z-Index Related properties, run a script "clear_z_index".
  5644. # This will be reset when the map is left and re-entered.
  5645. #
  5646. # NOTE: \z_add[0] will NOT be treated as a request for a FLAT SPRITE.
  5647. #
  5648. # NOTE: Special properties like "\foo" in an event's name appear
  5649. # to NOT COPY AND PASTE CORRECTLY at all times in RMXP Editor
  5650. # if you COPY AND PASTE an event. This bug is difficult to reproduce.
  5651. # One project this bug occurs all the time but other projects it never occurs.
  5652. # Just be aware of this when moving events.
  5653. # ----------------------------------------------------------------------------
  5654.  
  5655. #==============================================================================
  5656. #  Game_Event
  5657. #==============================================================================
  5658.  
  5659. class Game_Event
  5660.  
  5661.   #----------------------------------------------------------------------------
  5662.   # * Redefine initialize for new variables.
  5663.   #----------------------------------------------------------------------------
  5664.  
  5665.   unless self.method_defined?(:flat_sprite_initialize)
  5666.     alias :flat_sprite_initialize :initialize    
  5667.   end
  5668.  
  5669.   def initialize(map_id, event, *args)
  5670.     @z_flat = false
  5671.     @z_add = 0
  5672.     check_flat_sprites(event)
  5673.     flat_sprite_initialize(map_id, event, *args)    
  5674.   end
  5675.  
  5676.   #----------------------------------------------------------------------------
  5677.   # * Checks each event for a \z_flat and \z_add flag.
  5678.   #----------------------------------------------------------------------------
  5679.  
  5680.   def check_flat_sprites(event)
  5681.     # Initialize
  5682.     @z_flag = false
  5683.     @z_add = 0
  5684.     # Check z_flat and use z_add if necessary
  5685.     @z_flat = (event.name.clone.sub!(/\\z_flat\[[-]{0,1}(\d+)\]/i) {@z_add = $1.to_i} != nil)
  5686.     # If z_flat was not defined with optional z
  5687.     if !@z_flat
  5688.       # Check default z_flat
  5689.       @z_flat = (event.name.match(/\\z_flat/i) != nil)
  5690.       # Check default z_add
  5691.       event.name.sub(/\\z_add\[[-]{0,1}(\d+)\]/i) {@z_add = $1.to_i}
  5692.     end
  5693.   end
  5694.  
  5695.   #----------------------------------------------------------------------------
  5696.   # * Sets a sprite's flat render attribute and optionally the z_add value.
  5697.   #----------------------------------------------------------------------------
  5698.  
  5699.   def set_z_flat(new_z_flat, new_z_add = nil)
  5700.     # Always Render as Flat regardless of size
  5701.     @z_flat = new_z_flat
  5702.     # Set optional Z-Index override
  5703.     @z_add = new_z_add if new_z_add != nil
  5704.   end
  5705.  
  5706.   #----------------------------------------------------------------------------
  5707.   # * Sets the Z-Index of an event via a script instead of a name.
  5708.   #----------------------------------------------------------------------------
  5709.  
  5710.   def set_z_add(new_z_add)
  5711.     @z_add = new_z_add
  5712.   end
  5713.  
  5714.   #----------------------------------------------------------------------------
  5715.   # * Resets the Z-Index of an event via a script to the map's default.
  5716.   #----------------------------------------------------------------------------
  5717.  
  5718.   def reset_z_index
  5719.     check_flat_sprites(@event)
  5720.   end
  5721.  
  5722.   #----------------------------------------------------------------------------
  5723.   # * Clears all Z-Index related properties. Resets when the map is reloaded.
  5724.   #----------------------------------------------------------------------------
  5725.  
  5726.   def clear_z_index
  5727.     @z_flat = false
  5728.     @z_add = 0
  5729.   end
  5730.  
  5731.   #----------------------------------------------------------------------------
  5732.   # * Redefines screen_z for altered Z-Index
  5733.   #----------------------------------------------------------------------------
  5734.  
  5735.   unless self.method_defined?(:flat_sprite_screen_z)
  5736.     alias :flat_sprite_screen_z :screen_z
  5737.   end
  5738.  
  5739.   def screen_z(height = 0)
  5740.     # Skip if disabled
  5741.     return flat_sprite_screen_z(height) if !$game_system.EVENT_Z_INDEX_CONTROLLER
  5742.     # Just skip the whole thing if always-on-top is on
  5743.     return flat_sprite_screen_z(height) if @always_on_top
  5744.     # If using z_flag or z_add
  5745.     if @z_flat || @z_add != 0
  5746.       # Consider the Sprites Size and Adjust for it, check nil for no graphic
  5747.       height = (height != 0 && height != nil) ? height : 0
  5748.     end
  5749.     # If using z_flag or z_add
  5750.     z = flat_sprite_screen_z(height)
  5751.     # Add flat correction value if using z_flat
  5752.     z -= 32 + height if @z_flat
  5753.     # Add Z-Index adjustment
  5754.     z += @z_add
  5755.     # Make sure those Characters stay Visible, < 0 they Disappear!
  5756.     return (z >= 0 ? z : 0)
  5757.   end
  5758.  
  5759. end
  5760.  
  5761. #==============================================================================
  5762. #  Interpreter
  5763. #==============================================================================
  5764. # I use this section to let the developer know if they are using the script
  5765. # incorrectly, usually by calling a command from the wrong Script Window
  5766. # since there are two of them.
  5767. #
  5768. # Edit Event -> Scripts
  5769. # Edit Event -> Set Move Route -> Scripts
  5770. # are DIFFERENT!  Edit Event -> Scirpts doesnt specify the Event.
  5771. #==============================================================================
  5772.  
  5773. class Interpreter
  5774.  
  5775.   # DEBUG Msg here indicates Mapper needs to call from the right window.
  5776.   def set_z_flat(new_z_flat, new_z_add = nil)
  5777.     return if !$game_system.EVENT_Z_INDEX_CONTROLLER
  5778.     p "Please call \"set_z_flat(#{new_z_flat}, #{new_z_add})\" from\n",
  5779.       "\"Edit Event\" -> \"Set Move Route\" -> Scripts Window\n",
  5780.       "instead of \n\"Edit Event\" -> Scripts Window"
  5781.   end
  5782.  
  5783.   # DEBUG Msg here indicates Mapper needs to call from the right window
  5784.   def set_z_add(new_z_add)
  5785.     return if !$game_system.EVENT_Z_INDEX_CONTROLLER
  5786.     p "Please call \"set_z_add(#{new_z_add})\" from\n",
  5787.       "\"Edit Event\" -> \"Set Move Route\" -> Scripts Window\n",
  5788.       "instead of \n\"Edit Event\" -> Scripts Window"
  5789.   end
  5790.  
  5791.   # DEBUG Msg here indicates Mapper needs to call from the right window.
  5792.   def reset_z_index
  5793.     return if !$game_system.EVENT_Z_INDEX_CONTROLLER
  5794.     p "Please call \"reset_z_index\" from\n",
  5795.       "\"Edit Event\" -> \"Set Move Route\" -> Scripts Window\n",
  5796.       "instead of \n\"Edit Event\" -> Scripts Window"
  5797.   end
  5798.  
  5799.   # DEBUG Msg here indicates Mapper needs to call from the right window
  5800.   def clear_z_index
  5801.     return if !$game_system.EVENT_Z_INDEX_CONTROLLER
  5802.     p "Please call \"clear_z_index\" from\n",
  5803.       "\"Edit Event\" -> \"Set Move Route\" -> Scripts Window\n",
  5804.       "instead of \n\"Edit Event\" -> Scripts Window"
  5805.   end
  5806.  
  5807. end
Add Comment
Please, Sign In to add comment