Advertisement
blackmorning

Blackmorning - Ace Base

Nov 4th, 2015
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 52.73 KB | None | 0 0
  1. #==============================================================================
  2. # ** Blackmorning -> Basic Module
  3. #------------------------------------------------------------------------------
  4. #  Blackmorning
  5. #  Version 1.23
  6. #  updated 10/30/2015
  7. # - added vertical fix for easier scripting
  8. #==============================================================================
  9. # ? Introduction
  10. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  11. # - Yami's fix -> revival & item animations in YEA - Ace Battle Engine.
  12. # - adds parameter and experience gauges
  13. # - shows transparent faces for non-battle members in menu
  14. # - new vocab information including for sparam and xparam
  15. # - changes help window to include item type, icon, name
  16. #   (also durability and weight if using Xail system)
  17. # - rotating actor instead of moving.
  18. # - adds codes for other BM scripts
  19. # - added horizontal fix coding for menus(version 1.18)
  20. #==============================================================================
  21. # ? Instructions
  22. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  23. # To install this script, open up your script editor and copy/paste this script
  24. # to an open slot below ? Materials but above ? Main.
  25. # Remember to save.
  26. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  27. # Script Calls.
  28. # -----------------------------------------------------------------------------
  29. # setSelfSwitch(map, id, A-D, true/false)
  30. #   ie.   setSelfSwitch(@map_id, 1, "A", true)
  31. # isSelfSwitch?(map, id, A-D)
  32. #   ie.   isSelfSwitch?(2, 1, "A")
  33. # setAllSelf(map, id, true/false)
  34. #   ie.   setAllSelf(2, 1, true)
  35. #===============================================================================
  36. module BM
  37.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  38.   # - Non Member Options -
  39.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  40.   # if member not in battle party, makes character/face transparent
  41.   NON_PARTY_MEMBER_TRANSPARENCY = true
  42.   STANDBY_COLOR = Color.new(0, 0, 0, 128) #  Standby Members Background Color  
  43.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  44.   # - Status Icons on Face (Skills Status Window) -
  45.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  46.   # for the Skill Status window, states/buffs appear at bottom of actor's face
  47.   MOVE_STATE_OVER_FACE = true
  48.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  49.   # - Bust Image Options -
  50.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  51.   PORTRAIT_FOLDER = "Graphics/Portraits/"
  52.   # default "Graphics/Portraits/"
  53.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  54.   # - Text Options -
  55.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  56.   # for drawing actor class and name in menus
  57.   TEXT={
  58.   :bold =>{
  59.     :actor_name => true,
  60.     :actor_class => false,
  61.     }, # DO NOT REMOVE
  62.   :italic =>{
  63.     :actor_name => false,
  64.     :actor_class => true,
  65.     }, # DO NOT REMOVE
  66.   } # DO NOT REMOVE
  67.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  68.   # - Sound Options -
  69.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  70.   # for sound effects, a random pitch can be given to give some variation
  71.   RAND_PITCH = false
  72.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  73.   # - Parameters Settings -
  74.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  75.   # EXP Gauge Options
  76.   EXP_VOCAB = "EXP"
  77.   EXP_GAUGE1   = 12            # "Window" skin text colour for gauge.
  78.   EXP_GAUGE2   = 4             # "Window" skin text colour for gauge.
  79.   SHOW_EXP_GAUGE = true        # show exp gauge in menu
  80.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  81.   # show parameters gauge in status
  82.   SHOW_PARAM_GAUGE = false
  83.   # set param ratio max to :set, :max or :current
  84.   # if a stat is higher than param max, then will be based on that stat
  85.   # :set (max param is set number)
  86.   # :max (uses default max param)
  87.   # :current (max param is based on highest current param)
  88.   PARAM_RATIO_MAX = :set
  89.   PARAM_MAX = 100 # if PARAM_RATIO_MAX = :set
  90.   # Each of the stats have a non-window colour. Adjust them as you see fit.
  91.   PARAM_COLOUR ={
  92.   # ParamID => [:stat,       Colour1,                   Colour2          ],
  93.           0 => [ :hp,  Color.new(115,  20,  20), Color.new(170,  44,  44)],
  94.           1 => [ :mp,  Color.new(158, 113, 229), Color.new(205, 178, 245)],
  95.           2 => [ :atk, Color.new(151,  83, 123), Color.new(207, 181, 187)],
  96.           3 => [ :def, Color.new(121, 208, 151), Color.new(184, 233, 205)],
  97.           4 => [ :mat, Color.new( 82, 150, 215), Color.new(161, 197, 236)],
  98.           5 => [ :mdf, Color.new(236, 238, 150), Color.new(246, 253, 203)],
  99.           6 => [ :agi, Color.new(182, 150, 131), Color.new(222, 208, 194)],
  100.           7 => [ :luk, Color.new(146,  89, 165), Color.new(206, 182, 219)],
  101.   } # DO NOT REMOVE
  102.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  103.   # Parameter Vocabulary
  104.   PARAM_VOCAB_FULL={
  105.     0 => "Hit Points",
  106.     1 => "Spell Points",
  107.     2 => "Attack",
  108.     3 => "Defence",
  109.     4 => "Intelligence",
  110.     5 => "Resistance",
  111.     6 => "Agility",
  112.     7 => "Luck",
  113.   } # DO NOT REMOVE
  114.   XPARAM_VOCAB = {
  115.     0 => "HIT",
  116.     1 => "EVA",
  117.     2 => "CRI",
  118.     3 => "CEV",
  119.     4 => "MEV",
  120.     5 => "MRF",
  121.     6 => "CNT",
  122.     7 => "HRG",
  123.     8 => "MRG",
  124.     9 => "LRG",
  125.   } # DO NOT REMOVE
  126.   XPARAM_VOCAB_FULL={
  127.     0 => "Hit Rate",
  128.     1 => "Evasion",
  129.     2 => "Critical Hit",
  130.     3 => "Critical Evade",
  131.     4 => "Magic Evasion",
  132.     5 => "Magic Reflect",
  133.     6 => "Counter Rate",
  134.     7 => "HP Regen",
  135.     8 => "SP Regen",
  136.     9 => "LP Regen",
  137.   } # DO NOT REMOVE
  138.   SPARAM_VOCAB = {
  139.     0 => "TGR",
  140.     1 => "GRD",
  141.     2 => "REC",
  142.     3 => "PHA",
  143.     4 => "MCR",    
  144.     5 => "LCR",
  145.     6 => "PDR",
  146.     7 => "MDR",
  147.     8 => "FDR",
  148.     9 => "EXR",
  149.   } # DO NOT REMOVE
  150.   SPARAM_VOCAB_FULL={
  151.     0 => "Target Rate",
  152.     1 => "Guard Rate",
  153.     2 => "Recovery",
  154.     3 => "Item Boost",
  155.     4 => "SP Cost Rate",
  156.     5 => "LP Charge",
  157.     6 => "Physical Damage",
  158.     7 => "Magical Damage",
  159.     8 => "Floor Damage",
  160.     9 => "#{EXP_VOCAB} Rate",
  161.   } # DO NOT REMOVE
  162.   CPARAM_VOCAB ={
  163.     :cdr         => "CDR",  #cooldown rate       # Requires YEA - Skill Restrictions
  164.     :wur         => "WUR",  #warmup rate         # Requires YEA - Skill Restrictions
  165.     :hcr         => "HCR",  #hp cost rate        # Requires YEA - Skill Cost Manager
  166.     :tcr_y       => "LCR",  #tp cost rate        # Requires YEA - Skill Cost Manager
  167.     :gcr         => "GCR",  #gold cost rate      # Requires YEA - Skill Cost Manager
  168.     :hp_physical => "HPhys",#convert hp physical # Requires YEA - Convert Damage
  169.     :mp_physical => "SPhys",#convert mp physical # Requires YEA - Convert Damage
  170.     :hp_magical  => "HMag", #convert hp magical  # Requires YEA - Convert Damage
  171.     :mp_magical  => "SMag", #convert mp magical  # Requires YEA - Convert Damage
  172.   } # DO NOT REMOVE
  173.   CPARAM_VOCAB_FULL ={
  174.     :cdr         => "Cooldown Rate",    #cooldown rate       # Requires YEA - Skill Restrictions
  175.     :wur         => "Warmup Rate",      #warmup rate         # Requires YEA - Skill Restrictions
  176.     :tcr_y       => "LP Cost Rate",     #tp cost rate        # Requires YEA - Skill Cost Manager
  177.     :hcr         => "HP Cost Rate",     #hp cost rate        # Requires YEA - Skill Cost Manager    
  178.     :gcr         => "Gold Cost Rate",   #gold cost rate      # Requires YEA - Skill Cost Manager
  179.     :hp_physical => "Drain HP Physical",#convert hp physical # Requires YEA - Convert Damage
  180.     :mp_physical => "Drain SP Physical",#convert mp physical # Requires YEA - Convert Damage
  181.     :mp_magical  => "Drain HP Magical", #convert hp magical  # Requires YEA - Convert Damage
  182.     :hp_magical  => "Drain SP Magical", #convert mp magical  # Requires YEA - Convert Damage
  183.   } # DO NOT REMOVE
  184.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  185.   # - Actor Movement -
  186.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  187.   # Hold button when entering direction to turn actor.
  188.   ROTATE_INPUT = Input::Y  
  189.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  190.   # - Advanced Help -
  191.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  192.   # Show additional info in the help window
  193.   ADVANCED_HELP = true
  194.   # HELP_DISPLAY = [show_help_icon, show_name, show_description, show_type]
  195.   HELP_DISPLAY = [true, true, true, true]
  196.   HELP_SIZE = 2 # number of lines in help
  197.   ITEM_NAME_COLOR = Color.new(182, 150, 131) # color of item/skill name in help
  198.   # NOTE:
  199.   # color is overwritten if using hime item rarity or vlue weapon/armor randomizer
  200.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  201.   # - System Options -
  202.   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  203.   # This determines if the Game's Process Priority will be heightened to "High"
  204.   # at startup. This may help some lag issues.
  205.   HIGH_PROCESS = true  
  206.   # This determines if the Mouse Cursor should be hidden will inside the game.
  207.   # This only applies if the mouse is inside the Game's window.
  208.   HIDE_MOUSE = false
  209.   # This determines if the window should be resizable.
  210.   # By default, the game window is not resizable without script calls.
  211.   # Note this does not increase the Game's graphic displaying abilities,
  212.   # and will cause graphics stretching/shrinking.
  213.   ALLOW_RESIZING = false
  214. end
  215. #===============================================================================
  216. # Editting anything past this point may potentially result in causing computer
  217. # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
  218. # Therefore, edit at your own risk.
  219. #===============================================================================
  220. if $sel_time_frame != nil
  221.   BM::SELCHAR_CALENDER = true
  222. else
  223.   BM::SELCHAR_CALENDER = false
  224. end
  225. #===============================================================================
  226. module BM  
  227.   #--------------------------------------------------------------------------
  228.   # * New method: required_script
  229.   #--------------------------------------------------------------------------
  230.   def self.required_script(name, req, version, type = 0)
  231.     if version == true
  232.       return unless (!$imported[req]) # non-bm scripts
  233.       msg = "The script '%s' requires the script\n"
  234.       case type
  235.       when :above
  236.         msg += "'%s' above it to work properly\n"
  237.       when :below
  238.         msg += "'%s' or higher to work properly\n"
  239.       else        
  240.         msg += "'%s' below it to work properly\n"
  241.       end
  242.       msg += "Go to bmscripts.weebly.com to download this script."
  243.       self.exit_message(msg, name, req, version)
  244.     end
  245.     if type != :below && (!$imported[req] || $imported[req] < version) #checks version number
  246.       msg = "The script '%s' requires the script\n"
  247.       case type
  248.       when :above
  249.         msg += "'%s' v%s or higher above it to work properly\n"
  250.       else
  251.         msg += "'%s' v%s or higher to work properly\n"
  252.       end
  253.       msg += "Go to bmscripts.weebly.com to download this script."
  254.       self.exit_message(msg, name, req, version)
  255.     elsif type == :below && $imported[req] # wrong position
  256.       msg = "The script '%s' requires the script\n"
  257.       msg += "'%s' below it to work properly\n"
  258.       msg += "move the scripts to the proper position"
  259.       self.exit_message(msg, name, req, version)
  260.     end
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # * New method: exit_message
  264.   #--------------------------------------------------------------------------
  265.   def self.exit_message(message, name, req, version = 1.00)
  266.     name = self.script_name(name)
  267.     req  = self.script_name(req)
  268.     msgbox(sprintf(message, name, req, version))
  269.     exit
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # * New method: script_name
  273.   #--------------------------------------------------------------------------
  274.   def self.script_name(name, ext = "BM")
  275.     name = name.to_s.gsub("_", " ").upcase.split
  276.     name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
  277.     name.join(" ")
  278.   end
  279. end
  280. $imported ||= {}
  281. $imported[:bm_base] = 1.23
  282. #===============================================================================
  283. module BM
  284.   def self.handle
  285.     a = Win32API.new('kernel32', 'GetPrivateProfileString', 'pppplp', 'l')
  286.     b = Win32API.new('user32', 'FindWindow', 'pp', 'i')
  287.     a.call("Game", "Title", "", title = "\0" * 256, 256, ".//Game.ini")
  288.     return b.call("RGSS Player", title.delete!("\0"))
  289.   end
  290. end
  291. Win32API.new('user32', 'ShowCursor', 'i', 'i').call(0) if BM::HIDE_MOUSE
  292. Win32API.new('kernel32','SetPriorityClass','pi','i').call(-1, 256) if BM::HIGH_PROCESS
  293. Win32API.new('user32', 'SetWindowLong', 'lll', 'l').call(BM.handle, -16, 0x10C70000|0x00080000) if BM::ALLOW_RESIZING
  294. #==============================================================================
  295. # ** Cache
  296. #==============================================================================
  297. module Cache
  298.   #--------------------------------------------------------------------------
  299.   # * New Method: Get Portrait Graphic
  300.   #--------------------------------------------------------------------------
  301.   def self.portrait(filename, hue = 0)
  302.     load_bitmap(BM::PORTRAIT_FOLDER, filename, hue)
  303.   end
  304. end
  305. #==============================================================================
  306. # ** SE  (randomizes pitch)
  307. #==============================================================================
  308. module RPG
  309.   class SE < AudioFile
  310.     def play
  311.       unless @name.empty?
  312.         pitch = @pitch
  313.         pitch += rand(7)-3 if BM::RAND_PITCH
  314.         Audio.se_play("Audio/SE/" + @name, @volume, pitch)
  315.       end
  316.     end
  317.   end
  318. end
  319. #==============================================================================
  320. # ** Numeric
  321. #==============================================================================
  322. class Numeric  
  323.   #--------------------------------------------------------------------------
  324.   # * group_digits
  325.   #--------------------------------------------------------------------------
  326.   def group
  327.     return self.to_s unless $imported["YEA-CoreEngine"] && YEA::CORE::GROUP_DIGITS
  328.     self.to_s.gsub(/(\d)(?=\d{3}+(?:\.|$))(\d{3}\..*)?/,'\1,\2')
  329.   end  
  330. end
  331. #==============================================================================
  332. # ** Object
  333. #==============================================================================
  334. class Object
  335.   #--------------------------------------------------------------------------
  336.   # * New method: file_exist?
  337.   #--------------------------------------------------------------------------
  338.   def file_exist?(path, filename)
  339.     $file_list ||= {}
  340.     $file_list[path + filename] ||= file_test(path, filename)
  341.     $file_list[path + filename]
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # * New method: get_file_list
  345.   #--------------------------------------------------------------------------
  346.   def file_test(path, filename)
  347.     bitmap = Cache.load_bitmap(path, filename) rescue nil
  348.     bitmap ? true : false
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # * New method: portrait_exist?
  352.   #--------------------------------------------------------------------------
  353.   def portrait_exist?(filename)
  354.     file_exist?(BM::PORTRAIT_FOLDER, filename)
  355.   end
  356.   #--------------------------------------------------------------------------
  357.   # * New method: character_exist?
  358.   #--------------------------------------------------------------------------
  359.   def character_exist?(filename)
  360.     file_exist?("Graphics/Characters/", filename)
  361.   end
  362.   #--------------------------------------------------------------------------
  363.   # * New method: faceset_exist?
  364.   #--------------------------------------------------------------------------
  365.   def faceset_exist?(filename)
  366.     file_exist?("Graphics/Faces/", filename)
  367.   end
  368. end
  369. #==============================================================================
  370. # ** Horizontal fix
  371. #==============================================================================
  372. module Horizontal_Fix
  373.   #--------------------------------------------------------------------------
  374.   # * Get Number of Lines to Show
  375.   #--------------------------------------------------------------------------
  376.   def visible_line_number; return 1; end
  377.   #--------------------------------------------------------------------------
  378.   # * Get Digit Count
  379.   #--------------------------------------------------------------------------
  380.   def col_max; return item_max; end
  381.   #--------------------------------------------------------------------------
  382.   # * Get Spacing for Items Arranged Side by Side
  383.   #--------------------------------------------------------------------------
  384.   def spacing; return 8;  end
  385.   #--------------------------------------------------------------------------
  386.   # * Calculate Width of Window Contents
  387.   #--------------------------------------------------------------------------
  388.   def contents_width
  389.     (item_width + spacing) * item_max - spacing
  390.   end
  391.   #--------------------------------------------------------------------------
  392.   # * Calculate Height of Window Contents
  393.   #--------------------------------------------------------------------------
  394.   def contents_height; item_height; end
  395.   #--------------------------------------------------------------------------
  396.   # * Get Leading Digits
  397.   #--------------------------------------------------------------------------
  398.   def top_col
  399.     ox / (item_width + spacing)
  400.   end
  401.   #--------------------------------------------------------------------------
  402.   # * Set Leading Digits
  403.   #--------------------------------------------------------------------------
  404.   def top_col=(col)
  405.     self.ox = (col < 0 ? 0 : col) * (item_width + spacing)
  406.   end
  407.   #--------------------------------------------------------------------------
  408.   # * Get Trailing Digits
  409.   #--------------------------------------------------------------------------
  410.   def bottom_col
  411.     top_col + col_max - 1
  412.   end
  413.   #--------------------------------------------------------------------------
  414.   # * Set Trailing Digits
  415.   #--------------------------------------------------------------------------
  416.   def bottom_col=(col)
  417.     self.top_col = col - (col_max - 1)
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # * Overwrite: Scroll Cursor to Position Within Screen
  421.   #--------------------------------------------------------------------------
  422.   def ensure_cursor_visible
  423.     self.top_col = index if index < top_col
  424.     self.bottom_col = index if index > bottom_col
  425.   end  
  426.   #--------------------------------------------------------------------------
  427.   # * Get Rectangle for Displaying Items
  428.   #--------------------------------------------------------------------------
  429.   def item_rect(index)
  430.     rect = super
  431.     rect.x = index * (item_width + spacing)
  432.     rect.y = 0
  433.     rect
  434.   end
  435. end
  436. #==============================================================================
  437. # ** Vertical fix
  438. #==============================================================================
  439. module Vertical_Fix
  440.   #--------------------------------------------------------------------------
  441.   # * Get Number of Lines to Show
  442.   #--------------------------------------------------------------------------
  443.   def visible_line_number; return item_max; end
  444.   #--------------------------------------------------------------------------
  445.   # * Get Digit Count
  446.   #--------------------------------------------------------------------------
  447.   def col_max; return 1; end
  448.   #--------------------------------------------------------------------------
  449.   # * Get Spacing for Items Arranged Side by Side
  450.   #--------------------------------------------------------------------------
  451.   def spacing; return 32;  end
  452.   #--------------------------------------------------------------------------
  453.   # overwrite method: contents_width
  454.   #--------------------------------------------------------------------------
  455.   def contents_width; return width - standard_padding * 2; end
  456.   #--------------------------------------------------------------------------
  457.   # overwrite method: contents_height
  458.   #--------------------------------------------------------------------------
  459.   def contents_height
  460.     ch = height - standard_padding * 2
  461.     return [ch - ch % item_height, row_max * item_height].max
  462.   end
  463.   #--------------------------------------------------------------------------
  464.   # * Scroll Cursor to Position Within Screen
  465.   #--------------------------------------------------------------------------
  466.   def ensure_cursor_visible
  467.     self.top_row = row if row < top_row
  468.     self.bottom_row = row if row > bottom_row
  469.   end
  470.   #--------------------------------------------------------------------------
  471.   # * Get Rectangle for Drawing Items
  472.   #--------------------------------------------------------------------------
  473.   def item_rect(index)
  474.     rect = Rect.new
  475.     rect.width = item_width
  476.     rect.height = item_height
  477.     rect.x = index % col_max * (item_width + spacing)
  478.     rect.y = index / col_max * item_height
  479.     rect
  480.   end
  481.   #--------------------------------------------------------------------------
  482.   # overwrite method: cursor_down
  483.   #--------------------------------------------------------------------------
  484.   def cursor_down(wrap = false)
  485.     if index < item_max - col_max || (wrap && col_max == 1)
  486.       select((index + col_max) % item_max)
  487.     end
  488.   end  
  489.   #--------------------------------------------------------------------------
  490.   # overwrite method: cursor_up
  491.   #--------------------------------------------------------------------------
  492.   def cursor_up(wrap = false)
  493.     if index >= col_max || (wrap && col_max == 1)
  494.       select((index - col_max + item_max) % item_max)
  495.     end
  496.   end
  497. end
  498. #==============================================================================
  499. # ** Vocab
  500. #==============================================================================
  501. module Vocab  
  502.   def self.exp; BM::EXP_VOCAB;  end
  503.   def self.exp_a; BM::EXP_VOCAB; end
  504.   ExpTotal        = "Current #{self.exp}"
  505.   ObtainExp       = "%s #{self.exp} received!"
  506.   def self.element(id); $data_system.elements[id] ? $data_system.elements[id] : ""; end
  507.   def self.state(id); $data_states[id] ? $data_states[id].name : ""; end
  508.   def self.enemies(id); $data_enemies[id] ? $data_enemies[id].name : ""; end
  509.   def self.classes(id); $data_classes[id] ? $data_classes[id].name : ""; end
  510.   def self.items(id); $data_items[id] ? $data_items[id].name : ""; end
  511.   def self.weapons(id); $data_weapons[id] ? $data_weapons[id].name : ""; end
  512.   def self.armors(id); $data_armor[id] ? $data_armor[id].name : ""; end
  513.   def self.skills(id); $data_skills[id] ? $data_skills[id].name : ""; end
  514.   def self.skill_types(id); $data_system.skill_types[id] ? $data_system.skill_types[id] : ""; end
  515.   def self.weapon_types(id); $data_system.weapon_types[id] ?$data_system.weapon_types[id] : ""; end
  516.   def self.armor_types(id); $data_system.armor_types[id] ? $data_system.armor_types[id] : ""; end
  517.   def self.variables(id); $data_system.variables[id] ? $data_system.variables[id] : ""; end
  518.   def self.switches(id); $data_system.switches[id] ? $data_system.switches[id] : ""; end
  519.   #--------------------------------------------------------------------------
  520.   # * New Method: extra Parameters
  521.   #--------------------------------------------------------------------------
  522.   def self.param_a(id)
  523.     case id
  524.     when 0, :hp, :maxhp then self.param(0)
  525.     when 1, :mp, :maxmp then self.param(1)
  526.     when 2, :atk then self.param(2)
  527.     when 3, :def then self.param(3)
  528.     when 4, :mat then self.param(4)
  529.     when 5, :mdf then self.param(5)
  530.     when 6, :agi then self.param(6)
  531.     when 7, :luk then self.param(7)
  532.     else; ""
  533.     end
  534.   end
  535.   #--------------------------------------------------------------------------
  536.   def self.param_f(id)
  537.     case id
  538.     when 0, :maxhp, :hp then BM::PARAM_VOCAB_FULL[0]
  539.     when 1, :maxmp, :mp then BM::PARAM_VOCAB_FULL[1]
  540.     when 2, :atk then BM::PARAM_VOCAB_FULL[2]
  541.     when 3, :def then BM::PARAM_VOCAB_FULL[3]
  542.     when 4, :mat then BM::PARAM_VOCAB_FULL[4]
  543.     when 5, :mdf then BM::PARAM_VOCAB_FULL[5]
  544.     when 6, :agi then BM::PARAM_VOCAB_FULL[6]
  545.     when 7, :luk then BM::PARAM_VOCAB_FULL[7]
  546.     else; ""
  547.     end
  548.   end
  549.   #--------------------------------------------------------------------------
  550.   def self.xparam_a(id)
  551.     case id
  552.     when 0, :hit then BM::XPARAM_VOCAB[0]
  553.     when 1, :eva then BM::XPARAM_VOCAB[1]
  554.     when 2, :cri then BM::XPARAM_VOCAB[2]
  555.     when 3, :cev then BM::XPARAM_VOCAB[3]
  556.     when 4, :mev then BM::XPARAM_VOCAB[4]
  557.     when 5, :mrf then BM::XPARAM_VOCAB[5]
  558.     when 6, :cnt then BM::XPARAM_VOCAB[6]
  559.     when 7, :hrg then BM::XPARAM_VOCAB[7]
  560.     when 8, :mrg then BM::XPARAM_VOCAB[8]
  561.     when 9, :trg then BM::XPARAM_VOCAB[9]
  562.     else; ""
  563.     end
  564.   end  
  565.   #--------------------------------------------------------------------------
  566.   def self.xparam_f(id)
  567.     case id
  568.     when 0, :hit then BM::XPARAM_VOCAB_FULL[0]
  569.     when 1, :eva then BM::XPARAM_VOCAB_FULL[1]
  570.     when 2, :cri then BM::XPARAM_VOCAB_FULL[2]
  571.     when 3, :cev then BM::XPARAM_VOCAB_FULL[3]
  572.     when 4, :mev then BM::XPARAM_VOCAB_FULL[4]
  573.     when 5, :mrf then BM::XPARAM_VOCAB_FULL[5]
  574.     when 6, :cnt then BM::XPARAM_VOCAB_FULL[6]
  575.     when 7, :hrg then BM::XPARAM_VOCAB_FULL[7]
  576.     when 8, :mrg then BM::XPARAM_VOCAB_FULL[8]
  577.     when 9, :trg then BM::XPARAM_VOCAB_FULL[9]
  578.     else; ""
  579.     end
  580.   end
  581.   #--------------------------------------------------------------------------
  582.   def self.sparam_a(id)
  583.     case id
  584.     when 0, :tgr then BM::SPARAM_VOCAB[0]
  585.     when 1, :grd then BM::SPARAM_VOCAB[1]
  586.     when 2, :rec then BM::SPARAM_VOCAB[2]
  587.     when 3, :pha then BM::SPARAM_VOCAB[3]
  588.     when 4, :mcr then BM::SPARAM_VOCAB[4]  
  589.     when 5, :tcr then BM::SPARAM_VOCAB[5]
  590.     when 6, :pdr then BM::SPARAM_VOCAB[6]
  591.     when 7, :mdr then BM::SPARAM_VOCAB[7]
  592.     when 8, :fdr then BM::SPARAM_VOCAB[8]
  593.     when 9, :exr then BM::SPARAM_VOCAB[9]
  594.     else; ""
  595.     end    
  596.   end  
  597.   #--------------------------------------------------------------------------
  598.   def self.sparam_f(id)
  599.     case id
  600.     when 0, :tgr then BM::SPARAM_VOCAB_FULL[0]
  601.     when 1, :grd then BM::SPARAM_VOCAB_FULL[1]
  602.     when 2, :rec then BM::SPARAM_VOCAB_FULL[2]
  603.     when 3, :pha then BM::SPARAM_VOCAB_FULL[3]
  604.     when 4, :mcr then BM::SPARAM_VOCAB_FULL[4]
  605.     when 5, :tcr then BM::SPARAM_VOCAB_FULL[5]
  606.     when 6, :pdr then BM::SPARAM_VOCAB_FULL[6]
  607.     when 7, :mdr then BM::SPARAM_VOCAB_FULL[7]
  608.     when 8, :fdr then BM::SPARAM_VOCAB_FULL[8]
  609.     when 9, :exr then BM::SPARAM_VOCAB_FULL[9]
  610.     else; ""
  611.     end
  612.   end  
  613.   #--------------------------------------------------------------------------
  614.   def self.cparam_a(id)
  615.     case id
  616.       when :hcr, :tcr_y, :gcr, :cdr, :wur, :hp_physical, :mp_physical, :mp_magical, :hp_magical
  617.         BM::CPARAM_VOCAB[id]
  618.       when :gut
  619.         return unless $imported["BubsGuts"]
  620.         Vocab.guts_a
  621.       else; ""
  622.     end
  623.   end
  624.   #--------------------------------------------------------------------------
  625.   def self.cparam_f(id)
  626.     case id
  627.       when :hcr, :tcr_y, :gcr, :cdr, :wur, :hp_physical, :mp_physical, :mp_magical, :hp_magical
  628.         BM::CPARAM_VOCAB_FULL[id]
  629.       when :gut
  630.         return unless $imported["BubsGuts"]
  631.         Vocab.guts
  632.       else; ""
  633.     end
  634.   end  
  635. end
  636. #==============================================================================
  637. # ** Cache
  638. #==============================================================================
  639. module Cache  
  640.   #--------------------------------------------------------------------------
  641.   # new method: storage_image
  642.   #--------------------------------------------------------------------------
  643.   def self.storage_image(bitmap, name)
  644.     @image_cache ||= {}
  645.     @image_cache[name] = bitmap unless @image_cache.has_key?(name)
  646.     @image_cache[name]
  647.   end  
  648.   #--------------------------------------------------------------------------
  649.   # new method: storage_image
  650.   #--------------------------------------------------------------------------
  651.   def self.restore_image(name)
  652.     return false if @image_cache.nil? || !@image_cache.has_key?(name)
  653.     @image_cache[name]
  654.   end  
  655. end
  656. #==============================================================================
  657. # ** Game_Action
  658. #==============================================================================
  659. class Game_Action
  660.   #--------------------------------------------------------------------------
  661.   # * Overwrite: targets_for_friends
  662.   #--------------------------------------------------------------------------
  663.   def targets_for_friends
  664.     if item.for_user?
  665.       [subject]
  666.     elsif item.for_dead_friend?
  667.       if item.for_one?
  668.         [friends_unit.smooth_dead_target(@target_index)]
  669.       else
  670.         friends_unit.dead_members
  671.       end
  672.     elsif item.for_friend?
  673.       if item.for_one?
  674.         if @target_index < 0
  675.           [friends_unit.random_target]
  676.         else
  677.           [friends_unit.smooth_target(@target_index)]
  678.         end
  679.       else
  680.         friends_unit.alive_members
  681.       end
  682.     end
  683.   end
  684. end
  685. #==============================================================================
  686. # ** Game_BattlerBase
  687. #==============================================================================
  688. class Game_BattlerBase
  689.   #--------------------------------------------------------------------------
  690.   # * New Method: atk_element_rate
  691.   #--------------------------------------------------------------------------
  692.   def atk_element_rate(id); features_sum(FEATURE_ATK_ELEMENT, id); end
  693. end
  694. #==============================================================================
  695. # ** Game_Actor
  696. #==============================================================================
  697. class Game_Actor < Game_Battler
  698.   #--------------------------------------------------------------------------
  699.   # * Alias: Remove the equipment that can not be equipped with Item_gain,
  700.   # returned to the party equipment that removed
  701.   #--------------------------------------------------------------------------
  702.   alias :bm_base_rui :release_unequippable_items
  703.   def release_unequippable_items(item_gain = true)
  704.     loop do
  705.       last_equips = equips.dup
  706.       bm_base_rui(item_gain)
  707.       return if equips == last_equips
  708.     end
  709.   end
  710. end
  711. #==============================================================================
  712. # ** Game_Player
  713. #==============================================================================
  714. class Game_Player < Game_Character
  715.   #--------------------------------------------------------------------------
  716.   # * Alias: move_by_input
  717.   #--------------------------------------------------------------------------
  718.   alias :bm_base_mbi :move_by_input
  719.   def move_by_input
  720.     return if !movable? || $game_map.interpreter.running?
  721.     if Input.dir4 > 0
  722.       if Input.press?(BM::ROTATE_INPUT)
  723.         set_direction(Input.dir4)
  724.       else
  725.         bm_base_mbi
  726.       end
  727.     end
  728.   end
  729. end
  730. #==============================================================================
  731. # ** Game_Event
  732. #==============================================================================
  733. class Game_Event
  734.   #--------------------------------------------------------------------------
  735.   # * New method: name
  736.   #--------------------------------------------------------------------------
  737.   def name; @event ? @event.name : ""; end
  738. end
  739. #==============================================================================#
  740. # ** Game_Interpreter
  741. #==============================================================================#
  742. class Game_Interpreter
  743.   #--------------------------------------------------------------------------
  744.   # * New Method: Set SelfSwitch
  745.   #--------------------------------------------------------------------------
  746.   def setSelfSwitch(map, eID, selfSwitch, trueFalse)
  747.     switch = [map, eID, selfSwitch]
  748.     $game_self_switches[switch] = trueFalse
  749.     $game_map.refresh
  750.   end
  751.   #--------------------------------------------------------------------------
  752.   # * New Method: Is SelfSwitch true/false?
  753.   #--------------------------------------------------------------------------
  754.   def isSelfSwitch?(map, eID, selfSwitch)
  755.     switch = [map, eID, selfSwitch]
  756.     $game_self_switches[switch]
  757.   end
  758.   #--------------------------------------------------------------------------
  759.   # * New Method: Set all SelfSwitches
  760.   #--------------------------------------------------------------------------
  761.   def setAllSelf(map, eID, trueFalse)
  762.     switches = ["A","B","C","D"]
  763.     for i in switches
  764.       setSelfSwitch(map, eID, i, trueFalse)
  765.     end
  766.     $game_map.refresh
  767.   end
  768.   #--------------------------------------------------------------------------
  769.   # * New Method: Self On
  770.   #--------------------------------------------------------------------------
  771.   def self_on(mapID,eventID,switch)
  772.      $game_self_switches[[mapID, eventID, switch]] = true
  773.      $game_map.refresh
  774.   end
  775.   #--------------------------------------------------------------------------
  776.   # * New Method: Self Off
  777.   #--------------------------------------------------------------------------
  778.   def self_off(mapID,eventID,switch)
  779.      $game_self_switches[[mapID, eventID, switch]] = false
  780.      $game_map.refresh    
  781.   end
  782.   #--------------------------------------------------------------------------
  783.   # * New Method: A switch on
  784.   #--------------------------------------------------------------------------
  785.   def a_on(mapID,eventID)
  786.      $game_self_switches[[mapID, eventID, "A"]] = true
  787.      $game_map.refresh    
  788.   end
  789.   #--------------------------------------------------------------------------
  790.   # * New Method: A switch off
  791.   #--------------------------------------------------------------------------
  792.   def a_off(mapID,eventID)
  793.      $game_self_switches[[mapID, eventID, "A"]] = false
  794.      $game_map.refresh    
  795.   end  
  796.   #--------------------------------------------------------------------------
  797.   # * New Method: B switch on
  798.   #--------------------------------------------------------------------------
  799.   def b_on(mapID,eventID)
  800.      $game_self_switches[[mapID, eventID, "B"]] = true
  801.      $game_map.refresh
  802.   end
  803.   #--------------------------------------------------------------------------
  804.   # * New Method: B switch off
  805.   #--------------------------------------------------------------------------
  806.   def b_off(mapID,eventID)
  807.      $game_self_switches[[mapID, eventID, "B"]] = false
  808.      $game_map.refresh    
  809.   end  
  810.   #--------------------------------------------------------------------------
  811.   # * New Method: C switch on
  812.   #--------------------------------------------------------------------------
  813.   def c_on(mapID,eventID)
  814.      $game_self_switches[[mapID, eventID, "C"]] = true
  815.      $game_map.refresh    
  816.   end
  817.   #--------------------------------------------------------------------------
  818.   # * New Method: C switch off
  819.   #--------------------------------------------------------------------------
  820.   def c_off(mapID,eventID)
  821.      $game_self_switches[[mapID, eventID, "C"]] = false
  822.      $game_map.refresh    
  823.   end  
  824.   #--------------------------------------------------------------------------
  825.   # * New Method: D switch on
  826.   #--------------------------------------------------------------------------
  827.   def d_on(mapID,eventID)
  828.     $game_self_switches[[mapID, eventID, "D"]] = true
  829.     $game_map.refresh    
  830.   end
  831.   #--------------------------------------------------------------------------
  832.   # * New Method: D switch off
  833.   #--------------------------------------------------------------------------
  834.   def d_off(mapID,eventID)
  835.      $game_self_switches[[mapID, eventID, "D"]] = false
  836.      $game_map.refresh    
  837.   end
  838.   #--------------------------------------------------------------------------
  839.   # * Alias: Change of state
  840.   #--------------------------------------------------------------------------
  841.   alias :bm_base_c313 :command_313
  842.   def command_313
  843.     bm_base_c313
  844.     $game_party.clear_results
  845.   end
  846. end
  847. #==============================================================================
  848. # ** Window_Base
  849. #==============================================================================
  850. class Window_Base < Window
  851.   alias :bm_base_pnc :process_normal_character
  852.   def process_normal_character(c, pos)
  853.     return unless c >= ' '
  854.     bm_base_pnc(c, pos)
  855.   end
  856.   #--------------------------------------------------------------------------
  857.   # * New method: exp_gauge1
  858.   #--------------------------------------------------------------------------
  859.   def exp_gauge1; return text_color(BM::EXP_GAUGE1); end
  860.   #--------------------------------------------------------------------------
  861.   # * New method: exp_gauge2
  862.   #--------------------------------------------------------------------------
  863.   def exp_gauge2; return text_color(BM::EXP_GAUGE2); end
  864.   #--------------------------------------------------------------------------
  865.   # * New method: param_gauge1
  866.   #--------------------------------------------------------------------------
  867.   def param_gauge1(param_id); return BM::PARAM_COLOUR[param_id][1]; end
  868.   #--------------------------------------------------------------------------
  869.   # * New method: param_gauge2
  870.   #--------------------------------------------------------------------------
  871.   def param_gauge2(param_id); return BM::PARAM_COLOUR[param_id][2]; end
  872.   #--------------------------------------------------------------------------
  873.   # * New method: standby color
  874.   #--------------------------------------------------------------------------
  875.   def standby_color(actor)
  876.     return BM::STANDBY_COLOR unless battle_party?(actor)
  877.     return Color.new(0, 0, 0, 0)
  878.   end
  879.   #--------------------------------------------------------------------------
  880.   # * Overwrite: gauge colors
  881.   #--------------------------------------------------------------------------  
  882.   def hp_gauge_color1;   BM::PARAM_COLOUR[0][1];   end
  883.   def hp_gauge_color2;   BM::PARAM_COLOUR[0][2];   end
  884.   def mp_gauge_color1;   BM::PARAM_COLOUR[1][1];   end
  885.   def mp_gauge_color2;   BM::PARAM_COLOUR[1][2];   end
  886.   #--------------------------------------------------------------------------
  887.   def item_name_color; BM::ITEM_NAME_COLOR; end
  888.   #--------------------------------------------------------------------------
  889.   # * New Method: percent colour
  890.   #--------------------------------------------------------------------------
  891.   def percent_color(value)
  892.     if value < 0; power_down_color
  893.     elsif value > 0; power_up_color
  894.     else;  normal_color
  895.     end
  896.   end
  897.   #--------------------------------------------------------------------------
  898.   # * New Method: Get Percentage of exp needed
  899.   #--------------------------------------------------------------------------
  900.   def exp_rate(actor)
  901.     now_exp = actor.exp - actor.current_level_exp
  902.     next_exp = actor.next_level_exp - actor.current_level_exp
  903.     rate = now_exp * 1.0 / next_exp
  904.     rate = [[rate, 1.0].min, 0.0].max
  905.   end
  906.   #--------------------------------------------------------------------------
  907.   # * New Method: Get Percentage of Paramaters
  908.   #--------------------------------------------------------------------------
  909.   def param_ratio(actor, param_id)
  910.     minimum = 0
  911.     case BM::PARAM_RATIO_MAX
  912.     when :set
  913.       maximum = BM::PARAM_MAX
  914.     when :max
  915.       maximum = actor.param_max(param_id)
  916.     when :current
  917.       maximum = 1
  918.     end    
  919.     for i in 2..7
  920.       maximum = [actor.param(i), maximum].max
  921.       minimum = [actor.param(i), minimum].min
  922.     end
  923.     return 1.0 if maximum == minimum
  924.     rate = actor.param(param_id).to_f/maximum.to_f
  925.     return rate
  926.   end
  927.   #--------------------------------------------------------------------------
  928.   # * New Method: Draw Portrait
  929.   #     enabled : Enabled flag. When false, draw semi-transparently.
  930.   #--------------------------------------------------------------------------
  931.   def draw_portrait(portrait_name, x, y, enabled = true)
  932.     return unless portrait_exist?(portrait_name)
  933.     bitmap = Cache.portrait(portrait_name)
  934.     rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  935.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  936.     bitmap.dispose
  937.   end
  938.   #--------------------------------------------------------------------------
  939.   # * New Method: Draw Actor Portrait
  940.   #--------------------------------------------------------------------------
  941.   def draw_actor_portrait(actor, x, y, enabled = true)
  942.     filename = "#{actor.face_name}-#{actor.face_index}"
  943.     return unless portrait_exist?(filename)
  944.     draw_portrait(filename, x, y, enabled)
  945.   end
  946.   #--------------------------------------------------------------------------
  947.   # * Alias: Draw Actor level
  948.   #--------------------------------------------------------------------------
  949.   alias :bm_base_dal :draw_actor_level
  950.   def draw_actor_level(actor, x, y, width = 100)
  951.     draw_gauge(x + 10, y, width - 10, exp_rate(actor), exp_gauge1, exp_gauge2) if BM::SHOW_EXP_GAUGE
  952.     change_color(system_color)
  953.     draw_text(x, y, 32, line_height, Vocab::level_a)
  954.     change_color(normal_color)
  955.     draw_text(x, y, width, line_height, actor.level.group, 2)
  956.   end
  957.   #--------------------------------------------------------------------------
  958.   # * Alias: Draw Parameters
  959.   #--------------------------------------------------------------------------
  960.   alias :bm_base_dap :draw_actor_param
  961.   def draw_actor_param(actor, x, y, param_id, width = 156)
  962.     if BM::SHOW_PARAM_GAUGE
  963.       draw_gauge(x, y, width, param_ratio(actor, param_id), param_gauge1(param_id), param_gauge2(param_id))
  964.     end
  965.     change_color(system_color)
  966.     draw_text(x, y, 120, line_height, Vocab::param(param_id))
  967.     change_color(normal_color)
  968.     draw_text(x, y, width, line_height, actor.param(param_id).group, 2)
  969.   end
  970.   #--------------------------------------------------------------------------
  971.   # * New Method: battle_party?
  972.   #--------------------------------------------------------------------------
  973.   def battle_party?(actor)
  974.     if BM::NON_PARTY_MEMBER_TRANSPARENCY
  975.       return $game_party.battle_members.include?(actor)
  976.     else; true
  977.     end
  978.   end
  979.   #--------------------------------------------------------------------------
  980.   # * Overwrite: draw_actor_face
  981.   #--------------------------------------------------------------------------
  982.   alias :bm_menu_daf :draw_actor_face
  983.   def draw_actor_face(actor, x, y, enabled = battle_party?(actor))
  984.     face_background(actor, x, y)
  985.     bm_menu_daf(actor, x, y, enabled)
  986.   end
  987.   #--------------------------------------------------------------------------
  988.   # * New Method: face_background
  989.   #--------------------------------------------------------------------------
  990.   def face_background(actor, x, y, width = 96, height = 96)
  991.     contents.fill_rect(x, y, width, height, standby_color(actor))
  992.   end
  993.   #--------------------------------------------------------------------------
  994.   # * Overwrite: draw_character
  995.   #--------------------------------------------------------------------------
  996.   def draw_character(character_name, character_index, x, y, ani = false)
  997.     return unless character_name
  998.     bitmap = Cache.character(character_name)
  999.     sign = character_name[/^[\!\$]./]
  1000.     if sign && sign.include?('$')
  1001.       cw = bitmap.width / 3
  1002.       ch = bitmap.height / 4
  1003.     else
  1004.       cw = bitmap.width / 12
  1005.       ch = bitmap.height / 8
  1006.     end
  1007.     n = character_index
  1008.     step = 0
  1009.     step = @walk if ani
  1010.     src_rect = Rect.new((n%4*3+1+step)*cw, (n/4*4)*ch, cw, ch)
  1011.     contents.blt(x - cw / 2, y - ch, bitmap, src_rect, ani ? 255 : translucent_alpha)
  1012.   end
  1013.   #--------------------------------------------------------------------------
  1014.   # * Overwrite: draw_actor_graphic
  1015.   #--------------------------------------------------------------------------
  1016.   def draw_actor_graphic(actor, x, y, ani = false)
  1017.     draw_character(actor.character_name, actor.character_index, x, y, ani)
  1018.   end
  1019.   #--------------------------------------------------------------------------
  1020.   # * Alias: draw_actor_name
  1021.   #--------------------------------------------------------------------------
  1022.   alias :bm_base_dan :draw_actor_name
  1023.   def draw_actor_name(*args)
  1024.     contents.font.bold = BM::TEXT[:bold][:actor_name]
  1025.     contents.font.italic = BM::TEXT[:italic][:actor_name]
  1026.     bm_base_dan(*args)
  1027.     contents.font.bold = Font.default_bold
  1028.     contents.font.italic = Font.default_italic
  1029.   end
  1030.   #--------------------------------------------------------------------------
  1031.   # * Alias: draw_actor_class
  1032.   #--------------------------------------------------------------------------
  1033.   alias :bm_base_dac :draw_actor_class
  1034.   def draw_actor_class(*args)
  1035.     contents.font.bold = BM::TEXT[:bold][:actor_class]
  1036.     contents.font.italic = BM::TEXT[:italic][:actor_class]
  1037.     bm_base_dac(*args)
  1038.     contents.font.bold = Font.default_bold
  1039.     contents.font.italic = Font.default_italic
  1040.   end
  1041.   #--------------------------------------------------------------------------
  1042.   # * New Method: ani_motion
  1043.   #--------------------------------------------------------------------------
  1044.   def ani_motion
  1045.     @animtime += 1
  1046.     if @animtime == 10
  1047.       case @walk
  1048.       when 1; @walk -= 1
  1049.       when -1; @walk += 1
  1050.       when 0
  1051.         if @step == 1
  1052.           @walk = -1
  1053.           @step = 0
  1054.         else
  1055.           @walk = 1
  1056.           @step = 1
  1057.         end
  1058.       end
  1059.       refresh
  1060.       @animtime = 0
  1061.     end
  1062.   end
  1063.   #--------------------------------------------------------------------------
  1064.   # * game_time
  1065.   #--------------------------------------------------------------------------
  1066.   def game_time
  1067.     gametime = Graphics.frame_count / Graphics.frame_rate
  1068.     hours = gametime / 3600
  1069.     minutes = gametime / 60 % 60
  1070.     seconds = gametime % 60
  1071.     result = sprintf("%d:%02d:%02d", hours, minutes, seconds)
  1072.     return result
  1073.   end  
  1074.   #--------------------------------------------------------------------------
  1075.   # * new method: draw_icon_face
  1076.   #--------------------------------------------------------------------------
  1077.   def draw_icon_face(actor, dest_rect, enabled)
  1078.     bitmap = Cache.face(actor.face_name)
  1079.     rect = Rect.new(actor.face_index % 4 * 96, actor.face_index / 4 * 96, 96, 96)
  1080.     bitmap.blur if dest_rect.width < 96/2
  1081.     cache = Bitmap.new(dest_rect.width, dest_rect.height)
  1082.     cache.stretch_blt(Rect.new(0,0,dest_rect.width, dest_rect.height), bitmap, rect)
  1083.     Cache.storage_image(cache, actor.face_name + actor.face_index.to_s)
  1084.     bitmap.dispose
  1085.     contents.stretch_blt(dest_rect, cache, Rect.new(0,0,cache.width,cache.height), enabled ? 255 : translucent_alpha)
  1086.   end
  1087.   #--------------------------------------------------------------------------
  1088.   # * new method: Draw icon Character Graphic
  1089.   #--------------------------------------------------------------------------
  1090.   def draw_icon_character(actor, dest_rect, enabled = false)
  1091.     bitmap = Cache.character(actor.character_name)
  1092.     sign = actor.character_name[/^[\!\$]./]
  1093.     if sign && sign.include?('$')
  1094.       cw = bitmap.width / 3
  1095.       ch = bitmap.height / 4
  1096.     else
  1097.       cw = bitmap.width / 12
  1098.       ch = bitmap.height / 8
  1099.     end
  1100.     n = actor.character_index
  1101.     step = 0
  1102.     step = @walk if enabled
  1103.     src_rect = Rect.new((n%4*3+1+step)*cw, (n/4*4)*ch, cw, ch)
  1104.     bitmap.blur if dest_rect.width < bitmap.width/2
  1105.     cache = Bitmap.new(dest_rect.width, dest_rect.height)
  1106.     cache.stretch_blt(Rect.new(0,0,dest_rect.width, dest_rect.height), bitmap, src_rect)
  1107.     Cache.storage_image(cache, actor.character_name + actor.character_index.to_s)
  1108.     contents.stretch_blt(dest_rect, cache, Rect.new(0,0,cache.width,cache.height), enabled ? 255 : translucent_alpha)
  1109.   end
  1110. end
  1111. #==============================================================================
  1112. # ** Window_Help
  1113. #==============================================================================
  1114. class Window_Help < Window_Base
  1115.   #--------------------------------------------------------------------------
  1116.   # * Alias: Object Initialization
  1117.   #--------------------------------------------------------------------------
  1118.   alias bm_base_init initialize
  1119.   def initialize(line_number = BM::HELP_SIZE)
  1120.     bm_base_init(line_number)
  1121.   end
  1122.   #--------------------------------------------------------------------------
  1123.   # * new method: item color
  1124.   #--------------------------------------------------------------------------
  1125.   def set_item_color(item)
  1126.     @item_color = normal_color
  1127.     @item_color = item_name_color
  1128.     return unless item.is_a?(RPG::BaseItem)        
  1129.     return unless $imported[:TH_ItemRarity] || $imported[:Vlue_WARandom]
  1130.     if $imported[:TH_ItemRarity]
  1131.       @item_color = item.rarity_colour      
  1132.     elsif $imported[:Vlue_WARandom]
  1133.       if item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)
  1134.         @item_color = item.color
  1135.       elsif !item.is_a?(RPG::Weapon) || !item.is_a?(RPG::Armor)
  1136.         @item_color = item_name_color
  1137.       end    
  1138.     end    
  1139.   end
  1140.   #--------------------------------------------------------------------------
  1141.   # * Overwrite: set_item
  1142.   #--------------------------------------------------------------------------
  1143.   alias :bm_base_si :set_item
  1144.   def set_item(item)
  1145.     return bm_base_si(item) unless BM::ADVANCED_HELP
  1146.     unless item; set_text("") ; return; end
  1147.     new_line = "\n"
  1148.     icon = BM::HELP_DISPLAY[0] ? '\i[' + item.icon_index.to_s + '] ' : ""
  1149.     name = BM::HELP_DISPLAY[1] ? item.name : ""
  1150.     desc = BM::HELP_DISPLAY[2] ? '\c[0]' + item.description : ""
  1151.     if item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)
  1152.       weight = $imported["XAIL-INVENTORY-WEIGHT"] ? weight = " - Weight: #{item.weight}." : ""
  1153.       durability = $imported["XAIL-ITEM-DURABILITY"] ? durability = " - Durability: #{item.durability} / #{item.max_durability}." : ""
  1154.     else weight = ""; durability = ""
  1155.     end
  1156.     if BM::HELP_DISPLAY[3]
  1157.       if item.is_a?(RPG::Weapon) ; item_type = " (" + Vocab.weapon_types(item.wtype_id) + ")" end
  1158.       if item.is_a?(RPG::Armor) ; item_type = " (" + Vocab.armor_types(item.atype_id) + ")" end
  1159.     else; item_type = ""
  1160.     end
  1161.     item_text = icon + name + item_type.to_s + weight + durability + new_line + desc
  1162.     set_item_color(item)
  1163.     set_text(item_text)
  1164.   end
  1165.   #--------------------------------------------------------------------------
  1166.   # * Overwrite: Draw Text with Control Characters
  1167.   #--------------------------------------------------------------------------
  1168.   def draw_text_ex(x, y, text)
  1169.     reset_font_settings
  1170.     change_color(@item_color) unless @item_color == nil
  1171.     text = convert_escape_characters(text)
  1172.     pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  1173.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  1174.   end
  1175. end
  1176. #==============================================================================
  1177. # ** Window_BattleStatus
  1178. #==============================================================================
  1179. class Window_BattleStatus < Window_Selectable
  1180.   #--------------------------------------------------------------------------
  1181.   # * New Method: face_background
  1182.   #--------------------------------------------------------------------------
  1183.   def face_background(actor, x, y, width = 96, height = 96)
  1184.   end
  1185. end
  1186. #==============================================================================
  1187. # ** Window_SkillStatus
  1188. #==============================================================================
  1189. class Window_SkillStatus < Window_Base
  1190.   if BM::MOVE_STATE_OVER_FACE
  1191.     alias :bm_skill_dai :draw_actor_icons
  1192.     def draw_actor_icons(actor, x, y)
  1193.       bm_skill_dai(actor, 0, 72)
  1194.     end
  1195.   end
  1196. end
  1197. #==============================================================================
  1198. # ** Game_Actor
  1199. #==============================================================================
  1200. class Game_Actor < Game_Battler
  1201.   #--------------------------------------------------------------------------
  1202.   # * Public Instance Variables
  1203.   #--------------------------------------------------------------------------
  1204.   attr_accessor :icon_index
  1205.   #--------------------------------------------------------------------------
  1206.   # Alias: Setup
  1207.   #--------------------------------------------------------------------------
  1208.   alias :bm_base_setup :setup
  1209.   def setup(actor_id)
  1210.     bm_base_setup(actor_id)
  1211.     @icon_index = 0
  1212.   end
  1213. end
  1214. #===============================================================================
  1215. #
  1216. # END OF FILE
  1217. #
  1218. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement