Advertisement
blackmorning

Blackmorning - YEA Status Addon

Nov 4th, 2015
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 72.75 KB | None | 0 0
  1. #==============================================================================
  2. # ** Blackmorning -> YEA - STATUS Addon: Elemental/Status Resistances & Rates
  3. #------------------------------------------------------------------------------
  4. #  Blackmorning
  5. #  Version 3.00
  6. #  released 01/29/2014
  7. #  updated 11/05/2015
  8. # - added background image change
  9. # - can change opacity of status scene
  10. #==============================================================================
  11. #  - INTRODUCTION -
  12. # - include resistances and infliction rates as well as parameters in YEA status
  13. #   screen
  14. #   resistances and parameter ratios in polygon graphical format.
  15. # - can toggle between windows with toggle button
  16. # - allows the actor's portraits to appear or not in different status windows
  17. #   - large portrait for actor if available
  18. #    found in folder assigned to portrait/bust images (see BM-Base)
  19. #    file format -  face_name-face-index
  20. #    (size:270px x 290px)
  21. # - adds bio info (height, age, birthplace. etc) can be switched with YEA by
  22. #   clicking on it
  23. #==============================================================================
  24. # ? Instructions
  25. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  26. # To install this script, open up your script editor and copy/paste this script
  27. # to an open slot below BM - Base and YEA - Status Menu but above ? Main.
  28. # * need TRGSSX.dll in folder with game.exe
  29. # If using BM - Advanced Menu, put this below it.
  30. # Remember to save.
  31. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  32. # Actor's Notetag
  33. # To set an actor's initial age, enter:
  34. #       <age: number>
  35. # To set an actor's birthplace to x, enter:
  36. #       <birthplace: x>
  37. # To set an actor's height to x, enter:
  38. #       <height: x>
  39. # To set an actor's custom bio y to x, enter:
  40. #       <cbio y: x>
  41. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  42. # Message Codes (x is actor_id)
  43. # To write an actor's age, enter:
  44. # \aage[x]
  45. # To write an actor's birthplace, enter:
  46. # \abirth[x]
  47. # To write an actor's height, enter:
  48. # \aheight[x]
  49. # To write an actor's custom bio y, enter:
  50. # \abio[y, x]
  51. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  52. # Script Codes (x is actor_id, n is new value, c is custombio id)
  53. # change bio properties ingame:
  54. # $game_actors[x].set_age = n
  55. # $game_actors[x].set_height = n
  56. # $game_actors[x].set_birthplace = "n"
  57. # $game_actors[x].set_custom_bio[c] = "n"
  58. #------------------------------------------------------------------------------
  59. # * add this to the COMMANDS on YEA - status menu where you want it to show:
  60. #      [    :element,      "Elements"],
  61. #      [    :state,        "States"],
  62. #      [    :infliction,   "Attributes"],
  63. #      [    :resistance,   "Resistances"],
  64. #      [    :bmproperties, "Properties"], #can be used instead of :properties
  65. #==============================================================================
  66. module BM
  67.   module STATUS
  68.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  69.     # - Main Page Settings
  70.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  71.     GAUGE = {# show gauge with numbers
  72.       :exp   => true,
  73.       :hp    => true,
  74.       :mp    => true,
  75.       :tp    => true,
  76.       :param => true,
  77.     }  
  78.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  79.     # Background Options
  80.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  81.     BG_OPTIONS ={
  82.       :win_opacity  => 255,    # window opacity for menu
  83.       :show_bg_img  => false, # show background image
  84.       :bg_image     => "Wallpaper",   # image name (Located in Graphics/System
  85.       :bg_opacity   => 255,  # background image opacity
  86.       :bg_scroll_x  => 1,    # horizontal movement
  87.       :bg_scroll_y  => 0,    # vertical movement
  88.     }# DO NOT REMOVE
  89.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  90.     # - BM Properties Window Settings -
  91.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  92.     # BM properties is similar to Properties in YEA Status, but the properties
  93.     # will automatically split into equal columns.
  94.     # These settings adjust the way the properties window visually appears.
  95.     # Change whether or not they appear, and what order they will appear in.
  96.     # can use YEA's if you want to assign each column.
  97.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  98.     # :hit,:eva,:cri,:cev,:mev,:mrf,:cnt,:hrg,:mrg,:trg
  99.     # :tgr,:grd,:rec,:pha,:mcr,:tcr,:pdr,:mdr,:fdr,:exr
  100.     # :wur,:gut,:hcr,:tcr_y,:hp_physical,:mp_physical,:hp_magical,:mp_magical
  101.     # :blank   (makes a empty entry for spacing, can be used in YEA or BM)
  102.     # :hblank when you want half line empty
  103.     BMPROPERTIES_COLUMN =[
  104.       :hit, :eva, :cri, :cev, :mev, :mrf, :cnt,
  105.       :cdr, :wur,     # Requires YEA - Skill Restrictions
  106.       :gut, # Requires Bubs - Guts Effects
  107.       :tgr, :grd, :rec, :pha, :mcr,
  108.       :hcr, :tcr_y,    # Requires YEA - Skill Cost Manager
  109.       :tcr, :exr, :hrg, :mrg, :trg, :pdr, :mdr, :fdr,
  110.       :hp_physical, :mp_physical, :hp_magical, :mp_magical,  # Requires YEA - Convert Damage
  111.     ] # DO NOT REMOVE  
  112.     NUM_COL = 2 #default = 3
  113.     PROPERTIES_FULL_NAME = true # values set in BM-Base script
  114.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  115.     # - Biography Window Settings -
  116.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  117.     # These settings adjust the way the biography appears
  118.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  119.     BIO_INFO = [:blank,:align, :age, :gender, :birthplace, :height, :custom_bio1, :custom_bio2]
  120.     ACTOR_BIO_INFO = {}
  121.     # for custom actor bio list
  122.     #format: ACTOR_BIO_INFO[actor_id] = [custom list]
  123.     ACTOR_BIO_INFO[1] = [:blank,:align, :age, :gender, :birthplace, :height]
  124.     #ACTOR_BIO_INFO[2] = [:blank,:align, :age, :gender, :birthplace, :height]
  125.    
  126.    
  127.     # put :blank when you want a line empty,:hblank when you want half line empty
  128.     BIO_INFO_TEXT = {
  129.       :align      => "Alignment:", # requires BM alignment
  130.       :age        => "Age:",
  131.       :gender     => "Gender:", # Bubs
  132.       :birthplace => "Birthplace:",
  133.       :height     => "Height:",
  134.       :nickname   => "Nickname:",
  135.     } # DO NOT REMOVE
  136.     CBIO_INFO_TEXT ={ # custom bio info that you create, up to custom_bio10
  137.       :custom_bio1    => "Species:",
  138.       :custom_bio2    => "Weight:",
  139.       :custom_bio3    => "",
  140.       :custom_bio4    => "",
  141.       :custom_bio5    => "",
  142.       :custom_bio6    => "",
  143.       :custom_bio7    => "",
  144.       :custom_bio8    => "",
  145.       :custom_bio9    => "",
  146.       :custom_bio10   => "",      
  147.     } # DO NOT REMOVE
  148.     BIO_FONT_SIZE = 22 # font size of bio info text
  149.     YEA_BIO_BOX = false # background box for YEA bio
  150.     HEIGHT_UNIT = "%s cm" # %s is the height given in actor's notebox
  151.     EMPTY_BIO = "--"
  152.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  153.     # - ACTOR Portrait -
  154.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  155.     # shows the actor's portrait in the background for the status screens you want,
  156.     # using the COMMANDS from YEA Status.
  157.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  158.     PORTRAIT_BACKGROUND = [:general,:biography,:titles,:rename,:retitle,:yeabio,:bmbio]
  159.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  160.     # Chart Options
  161.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  162.     # * all info on window for new element/state/infliction/resistance Scene when
  163.     # selected in status menu, otherwise will toggle
  164.     ONE_PAGE = {
  165.       :element => true,
  166.       :state   => true,
  167.       :infliction => false,
  168.       :resistance  => false,
  169.     } # DO NOT REMOVE    
  170.     LIST_ITEMS_ORDER={
  171.       :element => [9,10,3,4,5,6,7,8], # elements you want shown
  172.       :state   => [2..8],  # states you want shown
  173.       :param   => [2..7],  # parameters you want shown
  174.     } # DO NOT REMOVE      
  175.     CHART_ITEMS_ORDER={#order can differ from list for better visuals
  176.       :element => [9,3,4,5,10,6,7,8], # elements you want shown
  177.       :state   => [2..8],  # states you want shown
  178.       :param   => [2..7],  # parameters you want shown
  179.     } # DO NOT REMOVE
  180.     # * format of info
  181.     # 0 .. numbers
  182.     # 1 .. chart
  183.     # 2 .. chart & numbers
  184.     # 3 .. numbers (: spacing leaves blank size of chart)
  185.     # 1, 2 must have «KGC bitmap expansion».
  186.     INFO_STYLE = {
  187.       :element => 2,
  188.       :state   => 2,
  189.       :param   => 2,
  190.       :resist  => 2,
  191.       :inflict => 3,
  192.     } # DO NOT REMOVE
  193.     CHART_FONT_SIZE = 18
  194.     # * resistance number format
  195.     # 0 .. Attributes: normal 100, (negative absorption) 99 or less reduce, weakness more than 101
  196.     # State: Additional success rate (susceptibility)
  197.     # boosted resistance to inside, susceptibility to outside
  198.     # 1 .. Attribute: Normal, (absorption 101 or more) reduction, plus weakness minus 0
  199.     # State: Additional evasion rate (hardness apply)
  200.     # boosted resistance to outside, susceptibility to inside
  201.     NUMBER_STYLE = {
  202.       :element => 1,
  203.       :state   => 1,
  204.       :param   => 0,
  205.     } # DO NOT REMOVE
  206.     PARAMETER_NAME = {
  207.       :element        => "Elemental",
  208.       :state          => "States",
  209.       :resist         => "Resistance",
  210.       :inflict        => "Infliction",
  211.     } # DO NOT REMOVE
  212.     #------------------------------------------------------------------------
  213.     # Chart Icons
  214.     #------------------------------------------------------------------------
  215.     # Assign Icons for the charts (parameters, elements and states)
  216.     # *Note* If you're using BM-Icons, and want to use those same icons,
  217.     # remove or comment (#) them out. (states would be made default from database)
  218.     CHART_ICONS={
  219.     :param => {
  220.       2 => 900, # ATK,   ATtacK power
  221.       3 => 901, # DEF,   DEFense power
  222.       4 => 902, # MAT,   Magic ATtack power
  223.       5 => 903, # MDF,   Magic DeFense power
  224.       6 => 904, # AGI,   AGIlity
  225.       7 => 905, # LUK,   LUcK  
  226.       }, # DO NOT REMOVE
  227.     :element   => {  
  228.       3  => 104,  # Fire element.
  229.       4  => 105,  # Ice element.
  230.       5  => 106,  # Volt element.
  231.       6  => 107,  # Earth element.
  232.       7  => 108,  # Water element.
  233.       8  => 109,  # Air element.
  234.       9  => 110,  # Light element.
  235.       10 => 111,  # Dark element.
  236.       }, # DO NOT REMOVE
  237.     :state   => {  
  238.      # 2  => 104,  
  239.      # 3  => 105,  
  240.      # 4  => 106,
  241.      # 5  => 107,
  242.      # 6  => 108,
  243.      # 7  => 109,
  244.      # 8  => 110,  
  245.      # 9 => 111,
  246.       }, # DO NOT REMOVE
  247.     } # DO NOT REMOVE
  248.     #------------------------------------------------------------------------
  249.     # Chart Graphics
  250.     #------------------------------------------------------------------------
  251.     LINE_COLOR = {
  252.       :element => Color.new(128, 255, 128),
  253.       :state   => Color.new(228, 255, 128),
  254.       :param   => Color.new(228,  55,  28),
  255.     } # DO NOT REMOVE
  256.     BASE_COLOR = {
  257.       :element => Color.new(128, 192, 255),
  258.       :state   => Color.new(128, 192, 255),
  259.       :param   => Color.new(128, 192, 255),
  260.     } # DO NOT REMOVE
  261.     FLASH_COLOR = {
  262.       :element => Color.new(128, 255, 128),
  263.       :state   => Color.new(228, 255, 128),
  264.       :param   => Color.new(228,  55,  28),
  265.     } # DO NOT REMOVE
  266.     CHART_HIGHQUALITY = true    
  267.     CHART_FRAME_RATE = 0.2 # speed of blinking chart (<1 slower, >1 faster)
  268.  
  269.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  270.     # - Switch & Toggle Settings -
  271.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  272.     # These are the switches that govern whether or not certain status items will
  273.     # appear and/or will be enabled. By binding them to a Switch, you can just
  274.     # set the Switch ON/OFF to show/hide or enable/disable a status command. If
  275.     # you do not wish to use this feature, set these commands to 0.
  276.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  277.     TOGGLE_ICON = 1027 #appears in bottom corner to show you can toggle screens
  278.     TOGGLE_BUTTON = :Z
  279.     TOGGLE_SOUND = true # uses default select sound if true
  280.     # toggle between multiple windows
  281.     # command => [command1, command2, command3, ...]
  282.     # command is what is placed in the YEA commands list
  283.     TOGGLE_WINDOWS={
  284.       :element    => [:element, :state],
  285.       :state      => [:state, :element],
  286. #      :element    => [:ele_resist, :ele_inflict],
  287. #      :state      => [:state_resist, :state_inflict],
  288. #      :general    => [:general, :bmbio,:yeabio],
  289.       :biography     => [:yeabio, :bmbio],
  290.       :parameters    => [:parameters, :bmproperties],
  291.       :bmproperties  => [:bmproperties, :parameters],
  292.       :resistance    => [:ele_resist, :state_resist],
  293.       :infliction    => [:ele_inflict, :state_inflict],
  294.     }# DO NOT REMOVE  
  295.     CHART_STATUS_COMMANDS ={
  296.     # switch Handler Method to :do_nothing when you don't want the confirm button
  297.     # to do anything
  298.     # :command => [EnableSwitch, ShowSwitch, Handler Method, Window Draw],
  299.       :bmproperties  => [ 0,  0, :do_nothing, :draw_bmprop],
  300.       :resistance    => [ 0,  0, :command_resist, :draw_resist],
  301.       :infliction    => [ 0,  0, :command_inflict, :draw_inflict],
  302.       :element       => [ 0,  0, :command_elements, :draw_elemental],
  303.       :ele_resist    => [ 0,  0, :command_elements, :draw_ele_resist],
  304.       :ele_inflict   => [ 0,  0, :command_elements, :draw_ele_inflict],
  305.       :state         => [ 0,  0, :command_states, :draw_states],
  306.       :state_inflict => [ 0,  0, :command_states, :draw_state_inflict],
  307.       :state_resist  => [ 0,  0, :command_states, :draw_state_resist],
  308.       :yeabio        => [ 0,  0, :command_bio, :draw_actor_yeabiography],
  309.       :bmbio         => [ 0,  0, :command_bio, :draw_actor_bmbiography],
  310.     } # DO NOT REMOVE
  311.   end
  312. end
  313. #===============================================================================
  314. # Editting anything past this point may potentially result in causing computer
  315. # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
  316. # Therefore, edit at your own risk.
  317. #==============================================================================
  318. # ** module BM
  319. #==============================================================================
  320. module BM
  321.   def self.required(name, req, version, type = nil)
  322.     if !$imported[:bm_base]
  323.       msg = "The script '%s' requires the script\n"
  324.       msg += "'BM - Base' v%s or higher above it to work properly\n"
  325.       msg += "Go to bmscripts.weebly.com to download this script."
  326.       msgbox(sprintf(msg, self.script_name(name), version))
  327.       exit
  328.     else
  329.       self.required_script(name, req, version, type)
  330.     end
  331.   end
  332.   #--------------------------------------------------------------------------
  333.   # * script_name
  334.   #   Get the script name base on the imported value
  335.   #--------------------------------------------------------------------------
  336.   def self.script_name(name, ext = "BM")
  337.     name = name.to_s.gsub("_", " ").upcase.split
  338.     name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
  339.     name.join(" ")
  340.   end
  341. end
  342. $imported ||= {}
  343. $imported[:bm_status] = 3.00
  344. BM.required(:bm_status, :bm_base, 1.00, :above)
  345. BM.required(:bm_status, "YEA-StatusMenu", true, :above)
  346. BM.required(:bm_status, "BitmapExtension", true, :above)    
  347. #==========================================================================
  348. # ** BM::Regexp
  349. #==========================================================================
  350. module BM
  351.   module REGEXP
  352.      module ACTOR
  353.        AGE = /<(?:AGE|age):[ ](\d+)>/i
  354.        BIRTHPLACE = /<(?:BIRTHPLACE|birthplace|birth|BIRTH):[ ](.*)>/i
  355.        HEIGHT = /<(?:HEIGHT|height):[ ](.*)>/i
  356.        CUSTOMBIO = /<(?:CBIO|cbio)[ ](\d+):[ ](.*)>/i
  357.      end
  358.   end
  359. end  
  360. #==========================================================================
  361. # ** BM::STATUS
  362. #==========================================================================
  363. module BM::STATUS
  364.   module_function
  365.   def convert_integer_array(chart)
  366.     array = LIST_ITEMS_ORDER[chart]
  367.     result = []
  368.     array.each { |i|
  369.       case i
  370.       when Range
  371.         result |= i.to_a
  372.       when Integer
  373.         result |= [i]
  374.       end
  375.     }
  376.     return result
  377.   end
  378.   #--------------------------------------------------------------------------
  379.   def convert_integer_chart_array(chart)
  380.     array = CHART_ITEMS_ORDER[chart]
  381.     result = []
  382.     array.each { |i|
  383.       case i
  384.       when Range
  385.         result |= i.to_a
  386.       when Integer
  387.         result |= [i]
  388.       end
  389.     }
  390.     return result
  391.   end
  392.   LIST_ITEMS_ORDER[:element] = convert_integer_array(:element)
  393.   LIST_ITEMS_ORDER[:state] = convert_integer_array(:state)
  394.   LIST_ITEMS_ORDER[:param] = convert_integer_array(:param)
  395.   CHART_ITEMS_ORDER[:element] = convert_integer_chart_array(:element)
  396.   CHART_ITEMS_ORDER[:state] = convert_integer_chart_array(:state)
  397.   CHART_ITEMS_ORDER[:param] = convert_integer_chart_array(:param)
  398. end
  399. #==============================================================================
  400. # ** DataManager
  401. #==============================================================================
  402. module DataManager  
  403.   #--------------------------------------------------------------------------
  404.   # * Alias: load_database
  405.   #--------------------------------------------------------------------------
  406.   class << self; alias :bm_status_ld :load_database; end
  407.   def self.load_database
  408.     bm_status_ld
  409.     load_notetags_bm_status
  410.   end  
  411.   #--------------------------------------------------------------------------
  412.   # * New Method: load_notetags_bm_status
  413.   #--------------------------------------------------------------------------
  414.   def self.load_notetags_bm_status
  415.     groups = [$data_actors]
  416.     for group in groups
  417.       for obj in group
  418.         next if obj.nil?
  419.         obj.load_notetags_bm_status
  420.       end
  421.     end
  422.   end
  423. end
  424. #==============================================================================
  425. # ** RPG::Actor
  426. #==============================================================================
  427. class RPG::Actor < RPG::BaseItem
  428.   #--------------------------------------------------------------------------
  429.   # * Public Instance Variables
  430.   #--------------------------------------------------------------------------
  431.   attr_accessor :age
  432.   attr_accessor :birthplace
  433.   attr_accessor :height
  434.   attr_accessor :custom_bio
  435.   #--------------------------------------------------------------------------
  436.   # * Cache: load_notetags_bm_status
  437.   #--------------------------------------------------------------------------
  438.   def load_notetags_bm_status
  439.     @custom_bio = {}
  440.     for i in 1..10
  441.       @custom_bio[i] = BM::STATUS::EMPTY_BIO
  442.     end
  443.     @age = BM::STATUS::EMPTY_BIO
  444.     @birthplace = BM::STATUS::EMPTY_BIO
  445.     @height = BM::STATUS::EMPTY_BIO
  446.     self.note.split(/[\r\n]+/).each { |line|
  447.       case line
  448.       #---
  449.       when BM::REGEXP::ACTOR::AGE
  450.         @age = $1.to_i
  451.       when BM::REGEXP::ACTOR::BIRTHPLACE
  452.         @birthplace = $1
  453.       when BM::REGEXP::ACTOR::HEIGHT
  454.         @height = $1
  455.       when BM::REGEXP::ACTOR::CUSTOMBIO
  456.         @custom_bio[$1.to_i] = $2
  457.       #---
  458.       end
  459.     } # self.note.split
  460.   end
  461. end
  462. #==============================================================================
  463. # ** Game_Actor
  464. #==============================================================================
  465. class Game_Actor < Game_Battler  
  466.   #--------------------------------------------------------------------------
  467.   # * Public Instance Variables
  468.   #--------------------------------------------------------------------------
  469.   attr_accessor :age
  470.   attr_accessor :set_age
  471.   attr_accessor :birthplace
  472.   attr_accessor :set_birthplace
  473.   attr_accessor :height
  474.   attr_accessor :set_height
  475.   attr_accessor :gender  
  476.   attr_accessor :custom_bio
  477.   attr_accessor :set_custom_bio
  478.   #--------------------------------------------------------------------------
  479.   # Alias: Setup
  480.   #--------------------------------------------------------------------------
  481.   alias :bm_status_setup :setup
  482.   def setup(actor_id)
  483.     bm_status_setup(actor_id)
  484.     init_bio
  485.   end
  486.   #--------------------------------------------------------------------------
  487.   # * New Method: init_bio
  488.   #--------------------------------------------------------------------------
  489.   def init_bio
  490.     @init_year = 0
  491.     @init_year = $game_variables[HM_SEL::YEAR] if BM::SELCHAR_CALENDER
  492.     @set_age = actor.age
  493.     @set_height = actor.height
  494.     @set_birthplace = actor.birthplace
  495.     @gender = gender
  496.     @set_custom_bio = {}
  497.     for i in 1..10
  498.       @set_custom_bio[i] = actor.custom_bio[i]
  499.     end
  500.   end
  501.   #--------------------------------------------------------------------------
  502.   alias_bio = 1..10
  503.   alias_bio.each {|i|
  504.   aStr = %Q(
  505.   attr_accessor :custom_bio#{i}
  506.   attr_accessor :set_custom_bio#{i}
  507.   def custom_bio#{i}
  508.     @set_custom_bio[#{i}]
  509.   end
  510.   )
  511.   module_eval(aStr)
  512.   } # Do not remove this.
  513.   #--------------------------------------------------------------------------
  514.   def height
  515.     return @set_height if @set_height == BM::STATUS::EMPTY_BIO
  516.     height = sprintf(BM::STATUS::HEIGHT_UNIT, @set_height)
  517.   end
  518.   #--------------------------------------------------------------------------
  519.   def birthplace
  520.     @set_birthplace
  521.   end
  522.   #--------------------------------------------------------------------------
  523.   # * New Method: gender
  524.   #--------------------------------------------------------------------------
  525.   def gender
  526.     return "" unless $imported["BubsGenderFunctions"]
  527.     n = BM::STATUS::EMPTY_BIO
  528.     n = "Male" if male?
  529.     n = "Female" if female?
  530.     return n
  531.   end
  532.   #--------------------------------------------------------------------------
  533.   # * New Method: age
  534.   #--------------------------------------------------------------------------
  535.   def age
  536.     return @set_age unless BM::SELCHAR_CALENDER
  537.     @set_age = actor.age + ($game_variables[HM_SEL::YEAR] - @init_year)
  538.   end
  539. end
  540. #==============================================================================
  541. # ** Window_Base
  542. #==============================================================================
  543. class Window_Base < Window
  544.   #--------------------------------------------------------------------------
  545.   # * Alias: convert_escape_characters
  546.   #--------------------------------------------------------------------------
  547.   alias :bm_status_cec :convert_escape_characters
  548.   def convert_escape_characters(text)
  549.     result = bm_status_cec(text)
  550.     result = convert_bm_status_characters(result)    
  551.     return result
  552.   end
  553.   #--------------------------------------------------------------------------
  554.   def convert_bm_status_characters(result)
  555.     result.gsub!(/\eAAGE\[([-+]?\w+)\]/i)  { escape_actor_bio(:age, $1.to_i) }
  556.     result.gsub!(/\eABIRTH\[([-+]?\w+)\]/i)  { escape_actor_bio(:birthplace, $1.to_i) }
  557.     result.gsub!(/\eAHEIGHT\[([-+]?\w+)\]/i)  { escape_actor_bio(:height, $1.to_i) }
  558.     result.gsub!(/\eAGEN\[([-+]?\w+)\]/i)  { escape_actor_bio(:gender, $1.to_i) }
  559.     result.gsub!(/\eABIO\[(\d+),([-+]?\w+)\]/i)  { escape_actor_cbio($1.to_i, $2.to_i) }
  560.     return result
  561.   end
  562.   #--------------------------------------------------------------------------
  563.   def escape_actor_bio(type, actor_id)
  564.     actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
  565.     actor = $game_actors[actor_id]
  566.     return "" if actor.nil?
  567.     text = eval("actor.#{type}")
  568.     return text
  569.   end
  570.   #--------------------------------------------------------------------------
  571.   def escape_actor_cbio(type, actor_id)
  572.     actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
  573.     actor = $game_actors[actor_id]
  574.     return "" if actor.nil?
  575.     text = eval("actor.custom_bio#{type}")
  576.     return text
  577.   end
  578. end
  579. #==============================================================================
  580. module BMCHART
  581.   #--------------------------------------------------------------------------
  582.   # * adds to: initialize
  583.   #--------------------------------------------------------------------------
  584.   def initialize(*args)
  585.     super(*args)
  586.     @duration = 0    
  587.     @element_chart_sprite = Sprite_Base.new
  588.     @state_chart_sprite = Sprite_Base.new
  589.     @param_chart_sprite = Sprite_Base.new
  590.     create_chart_sprite(@element_chart_sprite)
  591.     create_chart_sprite(@state_chart_sprite)
  592.     create_chart_sprite(@param_chart_sprite)
  593.   end
  594.   #--------------------------------------------------------------------------
  595.   # * New Method: chart_starter_visibility
  596.   #--------------------------------------------------------------------------
  597.   def chart_starter_visibility
  598.     return unless @element_chart_sprite != nil  
  599.     @element_chart_sprite.visible = false
  600.     @state_chart_sprite.visible   = false
  601.     @param_chart_sprite.visible   = false
  602.   end
  603.   #--------------------------------------------------------------------------
  604.   # * New Method: Draw Element Block
  605.   #--------------------------------------------------------------------------
  606.   def draw_elemental
  607.     dx = contents.width / 3
  608.     contents.draw_text(dx, 0, dx, line_height, BM::STATUS::PARAMETER_NAME[:resist],1)
  609.     contents.draw_text(dx * 2, 0, dx, line_height, BM::STATUS::PARAMETER_NAME[:inflict],1)
  610.     type = BM::STATUS::INFO_STYLE[:element]
  611.     draw_stelpa_info(:element,:both, type)
  612.   end
  613.   #--------------------------------------------------------------------------
  614.   # * New Method: Draw Element resist
  615.   #--------------------------------------------------------------------------
  616.   def draw_ele_resist
  617.     dx = contents.width / 3
  618.     contents.draw_text(dx, 0, contents.width - dx, line_height, BM::STATUS::PARAMETER_NAME[:resist],1)
  619.     type = BM::STATUS::INFO_STYLE[:resist]
  620.     draw_stelpa_info(:element,:resist, type)
  621.   end
  622.   #--------------------------------------------------------------------------
  623.   # * New Method: Draw Element inflict
  624.   #--------------------------------------------------------------------------
  625.   def draw_ele_inflict
  626.     dx = contents.width / 3
  627.     contents.draw_text(dx, 0, contents.width - dx, line_height, BM::STATUS::PARAMETER_NAME[:inflict],1)
  628.     type = BM::STATUS::INFO_STYLE[:inflict]
  629.     draw_stelpa_info(:element,:inflict, type)
  630.   end
  631.   #--------------------------------------------------------------------------
  632.   # * New Method: Draw States Block
  633.   #--------------------------------------------------------------------------
  634.   def draw_states
  635.     dx = contents.width / 3
  636.     contents.draw_text(dx, 0, dx, line_height, BM::STATUS::PARAMETER_NAME[:resist],1)
  637.     contents.draw_text(dx * 2, 0, dx, line_height, BM::STATUS::PARAMETER_NAME[:inflict],1)
  638.     type = BM::STATUS::INFO_STYLE[:state]
  639.     draw_stelpa_info(:state,:both, type)
  640.   end
  641.   #--------------------------------------------------------------------------
  642.   # * New Method: Draw Element resist
  643.   #--------------------------------------------------------------------------
  644.   def draw_state_resist
  645.     dx = contents.width / 3
  646.     contents.draw_text(dx, 0, contents.width - dx, line_height, BM::STATUS::PARAMETER_NAME[:resist],1)
  647.     type = BM::STATUS::INFO_STYLE[:resist]
  648.     draw_stelpa_info(:state,:resist, type)
  649.   end
  650.   #--------------------------------------------------------------------------
  651.   # * New Method: Draw Element inflict
  652.   #--------------------------------------------------------------------------
  653.   def draw_state_inflict
  654.     dx = contents.width / 3
  655.     contents.draw_text(dx, 0, contents.width - dx, line_height, BM::STATUS::PARAMETER_NAME[:inflict],1)
  656.     type = BM::STATUS::INFO_STYLE[:inflict]
  657.     draw_stelpa_info(:state,:inflict, type)
  658.   end
  659.   #--------------------------------------------------------------------------
  660.   # * New Method: Draw resist
  661.   #--------------------------------------------------------------------------
  662.   def draw_resist
  663.     contents.font.bold = true
  664.     change_color(system_color)
  665.     contents.draw_text(0, 0, contents.width, line_height, BM::STATUS::PARAMETER_NAME[:resist],1)
  666.     contents.font.bold = false
  667.     type = BM::STATUS::INFO_STYLE[:resist]
  668.     draw_four_column_info(x, line_height * 3 / 2, :resist, type)
  669.   end
  670.   #--------------------------------------------------------------------------
  671.   # * New Method: Draw inflict
  672.   #--------------------------------------------------------------------------
  673.   def draw_inflict
  674.     contents.font.bold = true
  675.     change_color(system_color)
  676.     contents.draw_text(0, 0, contents.width, line_height, BM::STATUS::PARAMETER_NAME[:inflict],1)
  677.     contents.font.bold = false
  678.     type = BM::STATUS::INFO_STYLE[:resist]
  679.     draw_four_column_info(x, line_height * 3 / 2, :inflict, type)
  680.   end
  681.   #--------------------------------------------------------------------------
  682.   def draw_four_column_info(x, y, info, type)
  683.     chart = :element
  684.     r = 0
  685.     r = (contents.width - x)/12 - 4 if type > 0  
  686.     width = (contents.width - r*7)/2
  687.     contents.font.size = YEA::STATUS::PROPERTIES_FONT_SIZE      
  688.       if [1, 2, 3].include?(type) && $imported["BitmapExtension"]  
  689.         x = draw_actor_chart(x, y, r, chart, type) - 10
  690.       else; x = 0
  691.       end
  692.       if [0, 2, 3].include?(type)        
  693.         x = draw_actor_numbers(x, y, width, chart, info)
  694.       end
  695.     chart = :state
  696.       if [1, 2, 3].include?(type) && $imported["BitmapExtension"]  
  697.         x = draw_actor_chart(x, y, r, chart, type)
  698.       else; x = 0
  699.       end
  700.       if [0, 2, 3].include?(type)
  701.         x = contents.width - width
  702.         x = draw_actor_numbers(x, y, width, chart, info)
  703.       end
  704.     return x
  705.   end
  706.   #--------------------------------------------------------------------------
  707.   def draw_stelpa_info(chart, info, type)
  708.     contents.font.bold = true
  709.     change_color(system_color)
  710.     contents.draw_text(0, 0, contents.width / 3, line_height, BM::STATUS::PARAMETER_NAME[chart],1)
  711.     contents.font.bold = false
  712.     reset_font_settings
  713.     contents.font.size = BM::STATUS::CHART_FONT_SIZE
  714.     draw_actor_chart_and_numbers(0, line_height * 3 / 2, chart, info, type)
  715.   end
  716.   #--------------------------------------------------------------------------
  717.   # * new method: draw_actor_chart_and_numbers
  718.   #--------------------------------------------------------------------------
  719.   def draw_actor_chart_and_numbers(x, y, chart, info, type)
  720.     r = 0
  721.     r  = [(contents.width - x - 80)/6,(contents.height - y - 80)/2].min if type > 0
  722.     if [1, 2, 3].include?(type) && $imported["BitmapExtension"]
  723.       x = draw_actor_chart(x, y, r, chart, type)      
  724.     else; x = 0
  725.     end
  726.     if [0, 2, 3].include?(type)
  727.       contents.font.size = YEA::STATUS::PROPERTIES_FONT_SIZE      
  728.       w = (contents.width - x)/2 - 4
  729.       x = draw_actor_numbers(x, y, w, chart, info)
  730.     end
  731.     return x
  732.   end
  733.   #--------------------------------------------------------------------------
  734.   # * new method: draw_actor_chart
  735.   #--------------------------------------------------------------------------
  736.   def draw_actor_chart(x, y, radius, chart, type)
  737.     Bitmap.smoothing_mode = TRGSSX::SM_ANTIALIAS if BM::STATUS::CHART_HIGHQUALITY
  738.     r  = radius
  739.     cx = x + r + 28
  740.     cy = y + r + 28
  741.     pw = (Bitmap.smoothing_mode == TRGSSX::SM_ANTIALIAS ? 2 : 1)
  742.     items_shown = BM::STATUS::CHART_ITEMS_ORDER[chart]
  743.     size = 0
  744.     for i in items_shown; size += 1; end
  745.     draw_chart_line(cx, cy, r, size, 3, pw, chart) unless type == 3
  746.     points = []
  747.     items_shown.each_with_index { |e, i|
  748.       icon1 = chart_icon(chart, e)
  749.       n   = graph_values(chart,e)
  750.       n   = 100 - n if BM::STATUS::NUMBER_STYLE[chart] == 1  
  751.       n   = [[n, -100].max, 200].min
  752.       dr  = r * (n + 100) / 100 / 3
  753.       rad = Math::PI * (360.0 * i / size - 90.0) / 180.0
  754.       dx  = cx + Integer(dr * Math.cos(-rad))
  755.       dy  = cy + Integer(dr * Math.sin(rad))
  756.       points << [dx, dy]
  757.       dx = cx + Integer((r + 14) * Math.cos(-rad)) - 12
  758.       dy = cy + Integer((r + 14) * Math.sin(rad))  - 12
  759.       draw_icon(icon1, dx, dy) unless type == 3
  760.       i += 1
  761.     }
  762.     unless type == 3
  763.       if chart == :element;  @element_chart_sprite.visible = true
  764.       elsif chart == :state; @state_chart_sprite.visible = true
  765.       elsif chart == :param; @param_chart_sprite.visible = true
  766.       end
  767.       draw_chart(cx, cy, r, points, pw, chart)
  768.       draw_chart_flash(x, y, r, points, pw, chart)
  769.     end
  770.     Bitmap.smoothing_mode = TRGSSX::SM_DEFAULT
  771.     return (x + cx + r + 42)
  772.   end  
  773.   #--------------------------------------------------------------------------
  774.   def graph_values(chart,id)
  775.     n = 0
  776.     case chart
  777.     when :element
  778.       n    = eval("(@actor.#{chart}_rate(#{id})*100).to_i")
  779.       if $imported["YEA-ElementReflect"] && @actor.element_reflect_rate(id) != 0
  780.         n = -(@actor.element_reflect_rate(id) * 100).to_i
  781.       elsif $imported["Elemental_Modifiers"]
  782.         n  = (@actor.element_resist_rate(id) * 100).to_i
  783.       end
  784.     when :state
  785.       n    = eval("(@actor.#{chart}_rate(id)*100).to_i")
  786.       n    = 0 if @actor.state_resist_set.include?(id)
  787.     when :param
  788.       n    = (param_ratio(@actor, id) * 100).to_i
  789.     end
  790.     return n
  791.   end
  792.   #--------------------------------------------------------------------------
  793.   def chart_icon(chart, id)
  794.     if BM::STATUS::CHART_ICONS[chart].include?(id)
  795.       return icon = BM::STATUS::CHART_ICONS[chart][id]
  796.     elsif $imported[:bm_icon]
  797.       return icon = eval("Icon.#{chart}(id)")
  798.     elsif chart == :state
  799.       return icon = $data_states[id].icon_index
  800.     else
  801.       return icon = 0
  802.     end    
  803.   end
  804.   #--------------------------------------------------------------------------
  805.   # * New Method: draw_actor_numbers
  806.   #--------------------------------------------------------------------------
  807.   def draw_actor_numbers(x, y, width, chart, info)
  808.     dx = contents.width / 3
  809.     case info
  810.     when :resist
  811.       x = show_actor_resist(x, y, width, chart)
  812.     when :inflict
  813.       x = show_actor_inflict(x, y, width, chart)
  814.     when :both
  815.       x = show_actor_compound(x, y, width, chart)
  816.     end
  817.     return x + width
  818.   end
  819.   #--------------------------------------------------------------------------
  820.   # * New Method: draw both resistance and inflictions
  821.   #--------------------------------------------------------------------------
  822.   def show_actor_compound(x, y, width, chart)
  823.     items_shown = BM::STATUS::LIST_ITEMS_ORDER[chart]
  824.     for id in items_shown
  825.       value = eval("#{chart}_number(id)")    
  826.       colour = Color.new(0, 0, 0, translucent_alpha/2)
  827.       rect = Rect.new(x + 1, y + 1, width - 2, line_height - 2)
  828.       contents.fill_rect(rect, colour)
  829.       change_color(value[2])
  830.       draw_text(x, y, width - 6, line_height, value[0])      
  831.       draw_text(x, y, width - 6, line_height, value[1], 2)
  832.       unless chart == :param
  833.         dx = contents.width - (contents.width - x)/2 + 6
  834.         colour = Color.new(0, 0, 0, translucent_alpha/2)
  835.         rect = Rect.new(dx + 1, y + 1, width - 2, line_height - 2)
  836.         contents.fill_rect(rect, colour)
  837.         change_color(value[4])
  838.         draw_text(dx, y, width - 6, line_height, value[0])      
  839.         draw_text(dx, y, width - 6, line_height, value[3], 2)
  840.       end
  841.       y += line_height
  842.       break if y + line_height > contents.height
  843.      
  844.     end
  845.     return x
  846.   end
  847.   #--------------------------------------------------------------------------
  848.   # * New Method: draw inflictions
  849.   #--------------------------------------------------------------------------
  850.   def show_actor_inflict(x, y, width, chart)
  851.     items_shown = BM::STATUS::LIST_ITEMS_ORDER[chart]
  852.     dy = y
  853.     for id in items_shown
  854.       value = eval("#{chart}_number(id)")    
  855.       colour = Color.new(0, 0, 0, translucent_alpha/2)
  856.       rect = Rect.new(x + 1, y + 1, width - 2, line_height - 2)
  857.       contents.fill_rect(rect, colour)
  858.       change_color(value[4])
  859.       draw_text(x, y, width - 6, line_height, value[0])      
  860.       draw_text(x, y, width - 6, line_height, value[3], 2)
  861.       y += line_height
  862.       if y + line_height > contents.height
  863.         x = x + width + 6
  864.         y = dy
  865.       end
  866.     end
  867.     return x
  868.   end
  869.   #--------------------------------------------------------------------------
  870.   # * New Method: draw resist
  871.   #--------------------------------------------------------------------------
  872.   def show_actor_resist(x, y, width, chart)
  873.     items_shown = BM::STATUS::LIST_ITEMS_ORDER[chart]
  874.     dy = y
  875.     for id in items_shown
  876.       value = eval("#{chart}_number(id)")    
  877.       colour = Color.new(0, 0, 0, translucent_alpha/2)
  878.       rect = Rect.new(x + 1, y + 1, width - 2, line_height - 2)
  879.       contents.fill_rect(rect, colour)
  880.       change_color(value[2])
  881.       draw_text(x, y, width - 6, line_height, value[0])      
  882.       draw_text(x, y, width - 6, line_height, value[1], 2)
  883.       y += line_height
  884.       if y + line_height > contents.height
  885.         x = x + width + 6
  886.         y = dy
  887.       end
  888.     end
  889.     return x
  890.   end
  891.   #--------------------------------------------------------------------------
  892.   # * New Method: element_number
  893.   #--------------------------------------------------------------------------
  894.   def element_number(id)
  895.     value1 = graph_values(:element,id)
  896.     if $imported["YEA-ElementReflect"] && @actor.element_reflect_rate(id) != 0
  897.       value1 = (@actor.element_reflect_rate(id) * 100).to_i
  898.       color1 = text_color(22)
  899.       text1 = sprintf("#{Vocab.xparam_a(5)} %d%", value1)      #shows mrf
  900.     else
  901.       color1 = percent_color((value1 - 100) * -1.to_i)
  902.       if value1 == 0; text1 = 'Immune'
  903.       elsif value1 < 0; text1 = 'Absorb'
  904.       else
  905.         value1 = (value1 - 100) * -1.to_i if BM::STATUS::NUMBER_STYLE[:element] == 1
  906.         text1 = sprintf("%d%", value1)
  907.       end
  908.     end      
  909.     value2 = (@actor.atk_element_rate(id) * 100).to_i
  910.     value2 = (@actor.element_attack_rate(id) * 100).to_i if $imported["Elemental_Modifiers"]
  911.     color2 = percent_color(value2)
  912.     text2 = sprintf("%d%", value2)
  913.     return [Vocab.element(id), text1, color1, text2, color2]
  914.   end
  915.   #--------------------------------------------------------------------------
  916.   # * New Method: state_number
  917.   #--------------------------------------------------------------------------
  918.   def state_number(id)
  919.     value1 = graph_values(:state,id)
  920.     color1 = percent_color((value1 - 100) * -1.to_i)
  921.     if value1 == 0; text1 = 'Immune'
  922.     else
  923.       value1 = (value1 - 100) * -1.to_i if BM::STATUS::NUMBER_STYLE[:state] == 1
  924.       text1 = sprintf("%d%", value1)
  925.     end
  926.     value2 = (@actor.atk_states_rate(id) * 100).to_i
  927.     color2 = percent_color(value2)
  928.     text2 = sprintf("%d%", value2)  
  929.     return [Vocab.state(id), text1, color1, text2, color2]
  930.   end
  931.   #--------------------------------------------------------------------------
  932.   # * New Method: param_number
  933.   #--------------------------------------------------------------------------
  934.   def param_number(id)
  935.     text1 = @actor.param(id).group
  936.     color1 = normal_color
  937.     return [Vocab.param(id), text1, color1, text1, color1]
  938.   end
  939.   #--------------------------------------------------------------------------
  940.   # * new method: draw_chart_line
  941.   #--------------------------------------------------------------------------
  942.   def draw_chart_line(cx, cy, r, n, breaks, pw, chart)
  943.     color = BM::STATUS::BASE_COLOR[chart].clone
  944.     contents.draw_regular_polygon(cx, cy, r, n, color, pw)
  945.     color.alpha = color.alpha * 5 / 8
  946.     contents.draw_spoke(cx, cy, r, n, color, pw)
  947.     (1..breaks).each { |i|
  948.       contents.draw_regular_polygon(cx, cy, r * i / breaks, n, color, pw)
  949.     }
  950.   end
  951.   #--------------------------------------------------------------------------
  952.   # * new method: draw_chart
  953.   #--------------------------------------------------------------------------
  954.   def draw_chart(cx, cy, r, points, pw, chart)
  955.     contents.draw_polygon(points, BM::STATUS::LINE_COLOR[chart], 2)
  956.   end
  957.   #--------------------------------------------------------------------------
  958.   # * new method: draw_chart_flash
  959.   #--------------------------------------------------------------------------
  960.   def draw_chart_flash(x, y, r, points, pw, chart)
  961.     if chart == :element; sprite = @element_chart_sprite
  962.     elsif chart == :state; sprite = @state_chart_sprite
  963.     elsif chart == :param; sprite = @param_chart_sprite
  964.     else; return
  965.     end
  966.     points = points.clone
  967.     points.each { |pt| pt[0] -= x }
  968.     cx = x + r + 28
  969.     cy = y + r + 28
  970.     color = BM::STATUS::FLASH_COLOR[chart]
  971.     sprite.bitmap.clear
  972.     sprite.bitmap.fill_polygon(points, Color.new(0, 0, 0, 0), color)
  973.     sprite.ox = cx - x
  974.     sprite.oy = cy
  975.     sprite.x  = self.x + cx + standard_padding
  976.     sprite.y  = self.y + cy + standard_padding
  977.   end
  978.   #--------------------------------------------------------------------------
  979.   # * new method: update_chart
  980.   #--------------------------------------------------------------------------
  981.   def update_chart(sprite)
  982.     return if sprite == nil
  983.     sprite.update
  984.     zoom = opacity = 0
  985.     case @duration
  986.     when 0..11
  987.       zoom    = @duration / 11.0
  988.       opacity = 255
  989.     when 12..27
  990.       zoom    = 1
  991.       opacity = (27 - @duration) * 16
  992.     end
  993.     sprite.zoom_x  = sprite.zoom_y = zoom
  994.     sprite.opacity = opacity
  995.     @duration = (@duration + BM::STATUS::CHART_FRAME_RATE) % Graphics.frame_rate
  996.   end
  997.   #--------------------------------------------------------------------------
  998.   # * new method: create_chart_sprite
  999.   #--------------------------------------------------------------------------
  1000.   def create_chart_sprite(sprite)
  1001.     return if sprite == nil
  1002.     sprite.z = 1000
  1003.     sprite.bitmap = Bitmap.new(height - 32, height - 32)
  1004.     sprite.ox = sprite.width  / 2
  1005.     sprite.oy = sprite.height / 2
  1006.     sprite.blend_type = 1
  1007.     sprite.opacity = 0
  1008.     sprite.visible = false
  1009.   end  
  1010.   #--------------------------------------------------------------------------
  1011.   # * adds to: update
  1012.   #--------------------------------------------------------------------------
  1013.   def update
  1014.     super
  1015.     update_chart(@element_chart_sprite)
  1016.     update_chart(@state_chart_sprite)
  1017.     update_chart(@param_chart_sprite)
  1018.   end  
  1019.   #--------------------------------------------------------------------------
  1020.   # * adds to: dispose
  1021.   #--------------------------------------------------------------------------
  1022.   def dispose
  1023.     super
  1024.     dispose_sprites(@element_chart_sprite)
  1025.     dispose_sprites(@state_chart_sprite)
  1026.     dispose_sprites(@param_chart_sprite)
  1027.   end
  1028.   #--------------------------------------------------------------------------
  1029.   # * new Method: dispose
  1030.   #--------------------------------------------------------------------------
  1031.   def dispose_sprites(sprite)
  1032.     return unless sprite != nil
  1033.     sprite.bitmap.dispose
  1034.     sprite.dispose
  1035.   end
  1036.   #--------------------------------------------------------------------------
  1037.   # * mew method: Z
  1038.   #--------------------------------------------------------------------------
  1039.   def z=(value)
  1040.     super(value)
  1041.     @element_chart_sprite.z = z + 1 if @element_chart_sprite != nil
  1042.     @state_chart_sprite.z   = z + 1 if @state_chart_sprite   != nil
  1043.     @param_chart_sprite.z   = z + 1 if @param_chart_sprite   != nil
  1044.   end
  1045. end
  1046. #==============================================================================
  1047. # ** Window_StatusItem
  1048. #==============================================================================
  1049. class Window_StatusItem < Window_Base
  1050.   include BMCHART
  1051.   #--------------------------------------------------------------------------
  1052.   # * alias: initialize
  1053.   #--------------------------------------------------------------------------
  1054.   alias :bm_status_init :initialize
  1055.   def initialize(*args)
  1056.     @page = {}
  1057.     bm_status_init(*args)
  1058.   end  
  1059.   #--------------------------------------------------------------------------
  1060.   def current_page  
  1061.     if @page[@command_window.current_symbol] == nil
  1062.       @page[@command_window.current_symbol] = 0
  1063.     end
  1064.     return @page[@command_window.current_symbol]
  1065.   end
  1066.   #--------------------------------------------------------------------------
  1067.   def new_page(symbol)
  1068.     if current_page >= 0 && current_page < BM::STATUS::TOGGLE_WINDOWS[symbol].size-1
  1069.       @page[symbol] += 1
  1070.     elsif current_page == BM::STATUS::TOGGLE_WINDOWS[symbol].size-1
  1071.       @page[symbol] = 0
  1072.     end
  1073.     refresh
  1074.   end
  1075.   #--------------------------------------------------------------------------
  1076.   # alias: draw_window_contents
  1077.   #--------------------------------------------------------------------------
  1078.   alias :bm_status_dwc :draw_window_contents
  1079.   def draw_window_contents
  1080.     chart_starter_visibility
  1081.     if BM::STATUS::TOGGLE_WINDOWS.include?(@command_window.current_symbol)
  1082.       page_name = BM::STATUS::TOGGLE_WINDOWS[@command_window.current_symbol][current_page]
  1083.       if BM::STATUS::PORTRAIT_BACKGROUND.include?(page_name)
  1084.         draw_actor_portrait(@actor, 0, 10, false)
  1085.       end
  1086.       case page_name
  1087.       when :general
  1088.         draw_actor_general
  1089.       when :parameters
  1090.         draw_parameter_graph
  1091.       when :properties
  1092.         draw_properties_list
  1093.       when :biography, :rename, :retitle
  1094.         draw_actor_biography
  1095.       else
  1096.         draw_toggle_custom
  1097.       end
  1098.       dx = contents.width - 24; dy = contents.height - 24
  1099.       draw_icon(BM::STATUS::TOGGLE_ICON, dx, dy)
  1100.     else
  1101.       bm_status_dwc    
  1102.     end    
  1103.   end
  1104.   #--------------------------------------------------------------------------
  1105.   # draw_toggle_custom
  1106.   #--------------------------------------------------------------------------
  1107.   def draw_toggle_custom
  1108.     current_symbol = BM::STATUS::TOGGLE_WINDOWS[@command_window.current_symbol][current_page]
  1109.     return unless YEA::STATUS::CUSTOM_STATUS_COMMANDS.include?(current_symbol)
  1110.     method(YEA::STATUS::CUSTOM_STATUS_COMMANDS[current_symbol][3]).call
  1111.   end
  1112.   #--------------------------------------------------------------------------
  1113.   # * overwrite: draw_actor_general
  1114.   #--------------------------------------------------------------------------
  1115.   def draw_actor_general
  1116.     contents.font.bold = true
  1117.     change_color(system_color)
  1118.     text = YEA::STATUS::PARAMETERS_VOCAB
  1119.     draw_text(0, 0, contents.width, line_height, text, 1)
  1120.     reset_font_settings
  1121.     x = 0; y = line_height * 3 / 2
  1122.     dx = draw_actor_chart_and_numbers(x, y, :param, :both, 1) - 14
  1123.     draw_general_parameters(dx)
  1124.   end  
  1125.   #--------------------------------------------------------------------------
  1126.   # * overwrite: draw_general_parameters
  1127.   #--------------------------------------------------------------------------
  1128.   def draw_general_parameters(dx)
  1129.     dy = line_height * 3 / 2
  1130.     dw = (contents.width - dx) / 3 - 6    
  1131.     draw_actor_level(dx + dw * 0, line_height * 0 + dy, dw)
  1132.     draw_actor_exp(dx + dw * 1 + 6, line_height * 0 + dy, (dw + 3)*2)
  1133.     draw_exp_gauge(dx + dw * 0, line_height * 0.7 + dy, (dw+3)*3) if BM::STATUS::GAUGE[:exp]
  1134.    
  1135.     draw_actor_param(0, dx + dw * 0, line_height * 2 + dy, dw)
  1136.     draw_gauge(dx + dw * 0, line_height * 2.7 + dy, dw, @actor.hp_rate, hp_gauge_color1, hp_gauge_color2) if BM::STATUS::GAUGE[:hp]
  1137.     draw_actor_param(1, dx + dw * 1 + 6, line_height * 2 + dy, dw)
  1138.     draw_gauge(dx + dw * 1 + 6, line_height * 2.7 + dy, dw, @actor.mp_rate, mp_gauge_color1, mp_gauge_color2) if BM::STATUS::GAUGE[:mp]
  1139.     draw_actor_tp(@actor, dx + dw * 2 + 12, line_height * 2 + dy, dw)
  1140.     draw_gauge(dx + dw * 2 + 12, line_height * 2.7 + dy, dw, @actor.tp_rate, tp_gauge_color1, tp_gauge_color2) if BM::STATUS::GAUGE[:tp]
  1141.    
  1142.     draw_actor_param(2, dx + dw * 0, line_height * 4 + dy, dw)
  1143.     draw_actor_param(4, dx + dw * 1 + 6, line_height * 4 + dy, dw)
  1144.     draw_actor_param(6, dx + dw * 2 + 12, line_height * 4 + dy, dw)
  1145.     dy += 6
  1146.     draw_actor_param(3, dx + dw * 0, line_height * 5 + dy, dw)
  1147.     draw_actor_param(5, dx + dw * 1 + 6, line_height * 5 + dy, dw)
  1148.     draw_actor_param(7, dx + dw * 2 + 12, line_height * 5 + dy, dw)
  1149.     if BM::STATUS::GAUGE[:param]
  1150.       draw_gauge(dx + dw * 0, line_height * 4.1 + dy, dw, param_ratio(@actor,2),  param_gauge1(2),  param_gauge2(2))
  1151.       draw_gauge(dx + dw * 1+6, line_height * 4.1 + dy, dw, param_ratio(@actor,4),  param_gauge1(4),  param_gauge2(4))
  1152.       draw_gauge(dx + dw * 2+12, line_height * 4.1 + dy, dw, param_ratio(@actor,6),  param_gauge1(6),  param_gauge2(6))
  1153.       dy += 6
  1154.       draw_gauge(dx + dw * 0, line_height * 5.1 + dy, dw, param_ratio(@actor,3),  param_gauge1(3),  param_gauge2(3))
  1155.       draw_gauge(dx + dw * 1+6, line_height * 5.1 + dy, dw, param_ratio(@actor,5),  param_gauge1(5),  param_gauge2(5))
  1156.       draw_gauge(dx + dw * 2+12, line_height * 5.1 + dy, dw, param_ratio(@actor,7),  param_gauge1(7),  param_gauge2(7))
  1157.     end
  1158.   end
  1159.   #--------------------------------------------------------------------------
  1160.   # * Draw EXP Gauge
  1161.   #--------------------------------------------------------------------------
  1162.   def draw_exp_gauge(x, y, width = 124)
  1163.     draw_gauge(x, y, width, exp_rate(@actor), exp_gauge1, exp_gauge2)
  1164.   end
  1165.   #--------------------------------------------------------------------------
  1166.   # * Draw TP
  1167.   #--------------------------------------------------------------------------
  1168.   def draw_actor_tp(actor, x, y, width = 124)
  1169.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  1170.     rect = Rect.new(x+1, y+1, width-2, line_height-2)
  1171.     contents.fill_rect(rect, colour)
  1172.     change_color(system_color)
  1173.     draw_text(x+4, y, width-8, line_height, Vocab::tp)
  1174.     change_color(normal_color)
  1175.     draw_text(x+4, y, width-8, line_height, actor.tp.to_i, 2)
  1176.   end
  1177.   #--------------------------------------------------------------------------
  1178.   # * new method: draw_actor_exp
  1179.   #--------------------------------------------------------------------------
  1180.   def draw_actor_exp(dx, dy, dw)
  1181.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  1182.     rect = Rect.new(dx + 1, dy + 1, dw - 2, line_height - 2)
  1183.     contents.fill_rect(rect, colour)
  1184.     change_color(system_color)
  1185.     draw_text(dx + 4, dy, dw - 8, line_height, "#{Vocab.exp} needed")
  1186.     s2 = @actor.max_level? ? "-------" : @actor.next_level_exp - @actor.exp
  1187.     change_color(normal_color)
  1188.     draw_text(dx + 4, dy, dw - 8, line_height, s2, 2)
  1189.   end  
  1190.   #--------------------------------------------------------------------------
  1191.   # * overwrite: draw_parameter_graph
  1192.   #--------------------------------------------------------------------------
  1193.   def draw_parameter_graph
  1194.     draw_parameter_title
  1195.     type = BM::STATUS::INFO_STYLE[:param]
  1196.     draw_actor_chart_and_numbers(0, line_height * 3 / 2, :param, :both, type)
  1197.   end
  1198.   #--------------------------------------------------------------------------
  1199.   # * overwrite: draw_parameter_title
  1200.   #--------------------------------------------------------------------------
  1201.   def draw_parameter_title
  1202.     contents.font.bold = true
  1203.     change_color(system_color)
  1204.     text = YEA::STATUS::PARAMETERS_VOCAB
  1205.     draw_text(0, 0, contents.width, line_height, text, 1)
  1206.     reset_font_settings
  1207.   end
  1208.   #--------------------------------------------------------------------------
  1209.   # * new method: draw_bmproper_title
  1210.   #--------------------------------------------------------------------------
  1211.   def draw_bmproper_title
  1212.     contents.font.bold = true
  1213.     change_color(system_color)
  1214.     text = "Attributes"
  1215.     draw_text(0, 0, contents.width, line_height, text, 1)
  1216.     reset_font_settings
  1217.   end
  1218.   #--------------------------------------------------------------------------
  1219.   # * new method: draw_bmproper
  1220.   #--------------------------------------------------------------------------
  1221.   def draw_bmprop
  1222.     draw_bmproper_title
  1223.     contents.font.size = YEA::STATUS::PROPERTIES_FONT_SIZE
  1224.     draw_bmproper_column
  1225.     reset_font_settings
  1226.   end  
  1227.   #--------------------------------------------------------------------------
  1228.   # * new method: draw_bmproper_column
  1229.   #--------------------------------------------------------------------------
  1230.   def draw_bmproper_column
  1231.     dx = 0
  1232.     dw = (contents.width-dx*2) / BM::STATUS::NUM_COL - 6
  1233.     dy = line_height * 3 / 2
  1234.     size = BM::STATUS::BMPROPERTIES_COLUMN.size
  1235.     max_size = contents.height - line_height * 3 / 2
  1236.     col = (size / BM::STATUS::NUM_COL * line_height) + dy - line_height
  1237.     for property in BM::STATUS::BMPROPERTIES_COLUMN
  1238.       dy = draw_property(property, dx, dy, dw)
  1239.       if dy > [col, max_size].min
  1240.         dy = line_height * 3 / 2
  1241.         dx += dw + 6
  1242.       end
  1243.       if dx > contents.width - dw; return; end
  1244.     end
  1245.   end
  1246.   #--------------------------------------------------------------------------
  1247.   # overwrite: draw_properties_column1
  1248.   #--------------------------------------------------------------------------
  1249.   def draw_properties_column1
  1250.     dx = 24
  1251.     dw = (contents.width - 24) / 3 - 24
  1252.     dy = 0
  1253.     for property in YEA::STATUS::PROPERTIES_COLUMN1
  1254.       dy = draw_property(property[0], dx, dy, dw)
  1255.     end
  1256.   end  
  1257.   #--------------------------------------------------------------------------
  1258.   # overwrite: draw_properties_column2
  1259.   #--------------------------------------------------------------------------
  1260.   def draw_properties_column2
  1261.     dx = 24 + (contents.width - 24) / 3
  1262.     dw = (contents.width - 24) / 3 - 24
  1263.     dy = 0
  1264.     for property in YEA::STATUS::PROPERTIES_COLUMN2
  1265.       dy = draw_property(property[0], dx, dy, dw)
  1266.     end
  1267.   end  
  1268.   #--------------------------------------------------------------------------
  1269.   # overwrite: draw_properties_column3
  1270.   #--------------------------------------------------------------------------
  1271.   def draw_properties_column3
  1272.     dx = 24 + (contents.width - 24) / 3 * 2
  1273.     dw = (contents.width - 24) / 3 - 24
  1274.     dy = 0
  1275.     for property in YEA::STATUS::PROPERTIES_COLUMN3
  1276.       dy = draw_property(property[0], dx, dy, dw)
  1277.     end
  1278.   end
  1279.   #--------------------------------------------------------------------------
  1280.   # * overwrite method: draw_property
  1281.   #--------------------------------------------------------------------------
  1282.   def draw_property(property, dx, dy, dw)
  1283.     case property
  1284.     #---
  1285.     when :hit, :eva, :cri, :cev, :mev, :mrf, :cnt, :hrg, :mrg, :trg
  1286.       text1 = Vocab.xparam_a(property)
  1287.       text2 = Vocab.xparam_f(property)
  1288.       value = eval("@actor.#{property}")
  1289.     when :tgr, :grd, :rec, :pha, :mcr, :tcr, :pdr, :mdr, :fdr, :exr
  1290.       text1 = Vocab.sparam_a(property)
  1291.       text2 = Vocab.sparam_f(property)
  1292.       value = eval("@actor.#{property}")
  1293.     when :gut
  1294.       return dy unless $imported["BubsGuts"]
  1295.       text1 = Vocab.cparam_a(property)
  1296.       text2 = Vocab.cparam_f(property)
  1297.       value = eval("@actor.#{property}/@actor.#{property}_max")
  1298.     when :hcr, :tcr_y, :gcr
  1299.       return dy unless $imported["YEA-SkillCostManager"]
  1300.       text1 = Vocab.cparam_a(property)
  1301.       text2 = Vocab.cparam_f(property)
  1302.       value = eval("@actor.#{property}")
  1303.     when :cdr, :wur
  1304.       return dy unless $imported["YEA-SkillRestrictions"]
  1305.       text1 = Vocab.cparam_a(property)
  1306.       text2 = Vocab.cparam_f(property)
  1307.       value = eval("@actor.#{property}")
  1308.     when :hp_physical, :mp_physical, :hp_magical, :mp_magical
  1309.       return dy unless $imported["YEA-ConvertDamage"]
  1310.       text1 = Vocab.cparam_a(property)
  1311.       text2 = Vocab.cparam_f(property)
  1312.       value = @actor.convert_dmg_rate(property)
  1313.     #---
  1314.     when :blank; return dy + line_height
  1315.     when :hblank; return dy + line_height/2
  1316.     else; return dy
  1317.     end  
  1318.     value = sprintf("%1.1f%%", value * 100) if value != nil
  1319.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  1320.     rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  1321.     contents.fill_rect(rect, colour)
  1322.     change_color(system_color)
  1323.     cw = text_size("100.0%").width
  1324.     if BM::STATUS::PROPERTIES_FULL_NAME
  1325.       draw_text(dx, dy, dw-cw, line_height, text2, 0)
  1326.     else
  1327.       draw_text(dx, dy, dw-cw, line_height, text1, 0)
  1328.     end
  1329.     change_color(normal_color)
  1330.     draw_text(dx + 4, dy, dw - 8, line_height, value, 2)
  1331.     return dy + line_height
  1332.   end
  1333.   #--------------------------------------------------------------------------
  1334.   # * new method: draw_actor_nickname
  1335.   #--------------------------------------------------------------------------
  1336.   def draw_actor_nickname
  1337.     contents.font.bold = true
  1338.     fmt = YEA::STATUS::BIOGRAPHY_NICKNAME_TEXT
  1339.     text = sprintf(fmt, @actor.name, @actor.nickname)
  1340.     contents.font.size = YEA::STATUS::BIOGRAPHY_NICKNAME_SIZE
  1341.     draw_text(0, 0, contents.width, line_height*2, text, 1)
  1342.   end
  1343.   #--------------------------------------------------------------------------
  1344.   # draw_actor_yeabiography
  1345.   #--------------------------------------------------------------------------
  1346.   def draw_actor_yeabiography    
  1347.     draw_actor_nickname
  1348.     reset_font_settings
  1349.     x = 24;y = line_height * 2
  1350.     if BM::STATUS::YEA_BIO_BOX
  1351.       colour = Color.new(0, 0, 0, translucent_alpha/2)
  1352.       rect = Rect.new(x, y, contents.width-x*2, contents.height-y - line_height)
  1353.       contents.fill_rect(rect, colour)
  1354.     end
  1355.     draw_text_ex(x, y, @actor.description)
  1356.   end
  1357.   #--------------------------------------------------------------------------
  1358.   # * new method: draw_actor_bmbiography
  1359.   #--------------------------------------------------------------------------
  1360.   def draw_actor_bmbiography
  1361.     draw_actor_nickname
  1362.     reset_font_settings
  1363.     y = line_height * 1
  1364.     contents.font.size = BM::STATUS::BIO_FONT_SIZE
  1365.     bio_info_list = BM::STATUS::BIO_INFO
  1366.     bio_info_list = BM::STATUS::ACTOR_BIO_INFO[@actor.id] if BM::STATUS::ACTOR_BIO_INFO.include?(@actor.id)
  1367.     for id in bio_info_list
  1368.       y = draw_actor_bio_info(id, 260, y, contents.width-272)
  1369.       break if y + line_height > contents.height
  1370.     end
  1371.     reset_font_settings
  1372.   end
  1373.   #--------------------------------------------------------------------------
  1374.   # * new method: draw_actor_bio_info
  1375.   #--------------------------------------------------------------------------
  1376.   def draw_actor_bio_info(id, x, y, width = 100)
  1377.     case id
  1378.     when :blank; return y + line_height
  1379.     when :hblank; return dy + line_height/2
  1380.     when :align
  1381.       return y unless $imported[:bm_align]
  1382.       text1 = BM::STATUS::BIO_INFO_TEXT[id]
  1383.       text2 = eval("@actor.#{id}_name")
  1384.     when :age, :birthplace, :height, :nickname
  1385.       text1 = BM::STATUS::BIO_INFO_TEXT[id]
  1386.       text2 = eval("@actor.#{id}")
  1387.     when :gender
  1388.       return y unless $imported["BubsGenderFunctions"]
  1389.       text1 = BM::STATUS::BIO_INFO_TEXT[id]
  1390.       text2 = eval("@actor.#{id}")
  1391.     else
  1392.       return y unless BM::STATUS::CBIO_INFO_TEXT.include?(id)
  1393.       text1 = BM::STATUS::CBIO_INFO_TEXT[id]
  1394.       text2 = eval("@actor.#{id}")
  1395.     end
  1396.     cw = text_size(text1).width  
  1397.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  1398.     rect = Rect.new(x-2, y-1, width+4, line_height-2)
  1399.     contents.fill_rect(rect, colour)
  1400.     change_color(system_color)
  1401.     draw_text(x, y, width, line_height, text1)
  1402.     change_color(normal_color)
  1403.     draw_text(x + cw, y, width-cw, line_height, text2, 2)
  1404.     return y + line_height
  1405.   end    
  1406. end
  1407. #==============================================================================
  1408. # ** Scene_Status
  1409. #==============================================================================
  1410. class Scene_Status < Scene_MenuBase
  1411.   #--------------------------------------------------------------------------
  1412.   # alias: start
  1413.   #--------------------------------------------------------------------------
  1414.   alias :bm_status_s :start
  1415.   def start
  1416.     bm_status_s
  1417.     bm_win_opacity
  1418.   end
  1419.   #--------------------------------------------------------------------------
  1420.   def bm_win_opacity
  1421.     @command_window.opacity = BM::STATUS::BG_OPTIONS[:win_opacity] unless @command_window.nil?
  1422.     @help_window.opacity = BM::STATUS::BG_OPTIONS[:win_opacity] unless @help_window.nil?
  1423.     @item_window.opacity = BM::STATUS::BG_OPTIONS[:win_opacity] unless @item_window.nil?
  1424.     @status_window.opacity = BM::STATUS::BG_OPTIONS[:win_opacity] unless @status_window.nil?
  1425.   end
  1426.   #--------------------------------------------------------------------------
  1427.   # * Create Background Image
  1428.   #--------------------------------------------------------------------------
  1429.   alias :bm_status_cb :create_background
  1430.   def create_background
  1431.     return bm_status_cb unless custom_bg? && !$imported[:bm_menustatus]
  1432.     custom_background
  1433.   end
  1434.   #--------------------------------------------------------------------------
  1435.   def custom_bg?
  1436.     return false if BM::STATUS::BG_OPTIONS[:bg_image] == ""
  1437.     return false unless BM::STATUS::BG_OPTIONS[:show_bg_img]
  1438.     return true
  1439.   end
  1440.   #--------------------------------------------------------------------------
  1441.   def custom_background
  1442.     @background_sprite = Plane.new
  1443.     @background_sprite.bitmap = Cache.system(BM::STATUS::BG_OPTIONS[:bg_image])
  1444.     @background_sprite.opacity = BM::STATUS::BG_OPTIONS[:bg_opacity]
  1445.   end
  1446.   #--------------------------------------------------------------------------
  1447.   def update_background
  1448.     return if BM::STATUS::BG_OPTIONS[:bg_scroll_x] == 0 && BM::STATUS::BG_OPTIONS[:bg_scroll_y] == 0
  1449.     @background_sprite.ox += BM::STATUS::BG_OPTIONS[:bg_scroll_x]
  1450.     @background_sprite.oy += BM::STATUS::BG_OPTIONS[:bg_scroll_y]
  1451.   end
  1452.   #--------------------------------------------------------------------------
  1453.   # * overwrite: create_status_window
  1454.   #--------------------------------------------------------------------------
  1455.   def create_status_window
  1456.     wy = @help_window.height
  1457.     @status_window = Window_SkillStatus.new(@command_window.width, wy)
  1458.     @status_window.viewport = @viewport
  1459.     @status_window.actor = @actor
  1460.   end
  1461.   #--------------------------------------------------------------------------
  1462.   # alias: update
  1463.   #--------------------------------------------------------------------------
  1464.   alias :bm_status_up :update
  1465.   def update
  1466.     bm_status_up    
  1467.     update_background if custom_bg? && !$imported[:bm_menustatus]
  1468.     if Input.trigger?(BM::STATUS::TOGGLE_BUTTON)
  1469.       if BM::STATUS::TOGGLE_WINDOWS.include?(@command_window.current_symbol)
  1470.         command_toggle(@command_window.current_symbol)
  1471.       end
  1472.     end
  1473.   end
  1474.   #--------------------------------------------------------------------------
  1475.   # new method: command_toggle
  1476.   #--------------------------------------------------------------------------
  1477.   def command_toggle(symbol)
  1478.     Sound.play_ok if BM::STATUS::TOGGLE_SOUND
  1479.     @item_window.new_page(symbol)
  1480.     @command_window.activate
  1481.     return
  1482.   end  
  1483.   #--------------------------------------------------------------------------
  1484.   # overwrite: process_custom_status_commands
  1485.   #--------------------------------------------------------------------------  
  1486.   def process_custom_status_commands
  1487.     for command in YEA::STATUS::COMMANDS
  1488.       if BM::STATUS::TOGGLE_WINDOWS.include?(command)
  1489.       end
  1490.     end    
  1491.     for command in YEA::STATUS::COMMANDS
  1492.       next unless YEA::STATUS::CUSTOM_STATUS_COMMANDS.include?(command[0])
  1493.       called_method = YEA::STATUS::CUSTOM_STATUS_COMMANDS[command[0]][2]
  1494.       called_method = nil if called_method == :do_nothing  
  1495.       unless called_method == nil      
  1496.         @command_window.set_handler(command[0], method(called_method))
  1497.       end
  1498.     end
  1499.   end  
  1500.   #--------------------------------------------------------------------------
  1501.   # new method: command_states
  1502.   #--------------------------------------------------------------------------
  1503.   def command_states
  1504.     SceneManager.call(Scene_StatusStates)
  1505.   end
  1506.   #--------------------------------------------------------------------------
  1507.   # new method: command_resist
  1508.   #--------------------------------------------------------------------------
  1509.   def command_resist
  1510.     SceneManager.call(Scene_StatusResist)
  1511.   end
  1512.   #--------------------------------------------------------------------------
  1513.   # new method: command_inflict
  1514.   #--------------------------------------------------------------------------
  1515.   def command_inflict
  1516.     SceneManager.call(Scene_StatusInflict)
  1517.   end
  1518.   #--------------------------------------------------------------------------
  1519.   # new method: command_elements
  1520.   #--------------------------------------------------------------------------
  1521.   def command_elements
  1522.     SceneManager.call(Scene_StatusElements)
  1523.   end
  1524.   #--------------------------------------------------------------------------
  1525.   # relocate_windows
  1526.   #--------------------------------------------------------------------------
  1527.   alias :bm_status_rw :relocate_windows
  1528.   def relocate_windows
  1529.     return unless $imported["YEA-AceMenuEngine"]
  1530.     bm_status_rw
  1531.     @item_window.refresh
  1532.   end
  1533. end
  1534. #==============================================================================
  1535. # ** Window_StatesElements
  1536. #==============================================================================
  1537. class Window_StatesElements < Window_Selectable
  1538.   include BMCHART
  1539.   #--------------------------------------------------------------------------
  1540.   # initialize
  1541.   #--------------------------------------------------------------------------
  1542.   def initialize(actor, x, y, chart)
  1543.     @page = {}
  1544.     if BM::STATUS::ONE_PAGE[chart]
  1545.       @page[chart] = -1
  1546.     else
  1547.       @page[chart] = 0
  1548.     end
  1549.     super(x, y, Graphics.width, Graphics.height-y)    
  1550.     @actor = actor
  1551.     @chart = chart
  1552.     @page_index = 0
  1553.     refresh
  1554.     activate
  1555.   end
  1556.   #--------------------------------------------------------------------------
  1557.   def current_page  
  1558.     if @page[@chart] == nil
  1559.       @page[@chart] = 0
  1560.     end
  1561.     return @page[@chart]
  1562.   end
  1563.   #--------------------------------------------------------------------------
  1564.   def new_page(symbol)
  1565.     if current_page >= 0 && current_page < BM::STATUS::TOGGLE_WINDOWS[@chart].size-1
  1566.       @page[symbol] += 1
  1567.     elsif current_page == BM::STATUS::TOGGLE_WINDOWS[@chart].size-1
  1568.       @page[symbol] = 0
  1569.     end
  1570.     refresh
  1571.   end
  1572.   #--------------------------------------------------------------------------
  1573.   # actor=
  1574.   #--------------------------------------------------------------------------
  1575.   def actor=(actor)
  1576.     return if @actor == actor
  1577.     @actor = actor
  1578.     refresh
  1579.   end
  1580.   #--------------------------------------------------------------------------
  1581.   # refresh
  1582.   #--------------------------------------------------------------------------
  1583.   def refresh
  1584.     contents.clear
  1585.     reset_font_settings
  1586.     return unless @actor
  1587.     draw_window_contents
  1588.   end
  1589.   #--------------------------------------------------------------------------
  1590.   def draw_window_contents
  1591.     chart_starter_visibility
  1592.     draw_custom
  1593.     if !BM::STATUS::ONE_PAGE[@chart]
  1594.       dx = contents.width - 24; dy = contents.height - 24
  1595.       draw_icon(BM::STATUS::TOGGLE_ICON, dx, dy)
  1596.     end
  1597.   end
  1598.   #--------------------------------------------------------------------------
  1599.   # draw_toggle_custom
  1600.   #--------------------------------------------------------------------------
  1601.   def draw_custom
  1602.     if BM::STATUS::TOGGLE_WINDOWS.include?(@chart) && !BM::STATUS::ONE_PAGE[@chart]
  1603.       current_symbol = BM::STATUS::TOGGLE_WINDOWS[@chart][current_page]
  1604.     else
  1605.       current_symbol = @chart
  1606.     end
  1607.     return unless YEA::STATUS::CUSTOM_STATUS_COMMANDS.include?(current_symbol)
  1608.     method(YEA::STATUS::CUSTOM_STATUS_COMMANDS[current_symbol][3]).call
  1609.   end
  1610.   #--------------------------------------------------------------------------
  1611.   # alias: update
  1612.   #--------------------------------------------------------------------------
  1613.   alias :bm_status_up :update
  1614.   def update
  1615.     bm_status_up
  1616.     if Input.trigger?(BM::STATUS::TOGGLE_BUTTON)
  1617.       new_page(@chart)
  1618.     end
  1619.   end
  1620. end
  1621. #==============================================================================
  1622. # ** Scene_PolyVisual
  1623. #==============================================================================
  1624. class Scene_PolyVisual < Scene_MenuBase
  1625.   #--------------------------------------------------------------------------
  1626.   # * Start Processing
  1627.   #--------------------------------------------------------------------------
  1628.   def start
  1629.     super
  1630.     create_status_window
  1631.     create_info_window
  1632.     bm_win_opacity
  1633.   end
  1634.   #--------------------------------------------------------------------------
  1635.   def bm_win_opacity
  1636.     @info_window.opacity = BM::STATUS::BG_OPTIONS[:win_opacity] unless @info_window.nil?
  1637.     @status_window.opacity = BM::STATUS::BG_OPTIONS[:win_opacity] unless @status_window.nil?
  1638.   end
  1639.   #--------------------------------------------------------------------------
  1640.   # * Create Background Image
  1641.   #--------------------------------------------------------------------------
  1642.   unless method_defined?(:bm_menu_cb)
  1643.     alias :bm_menu_cb :create_background
  1644.   end
  1645.   def create_background
  1646.     return bm_menu_cb unless custom_bg?
  1647.     custom_background
  1648.   end
  1649.   #--------------------------------------------------------------------------
  1650.   def custom_bg?
  1651.     return false if BM::STATUS::BG_OPTIONS[:bg_image] == ""
  1652.     return false unless BM::STATUS::BG_OPTIONS[:show_bg_img]
  1653.     return true
  1654.   end
  1655.   #--------------------------------------------------------------------------
  1656.   def custom_background
  1657.     @background_sprite = Plane.new
  1658.     @background_sprite.bitmap = Cache.system(BM::STATUS::BG_OPTIONS[:bg_image])
  1659.     @background_sprite.opacity = BM::STATUS::BG_OPTIONS[:bg_opacity]
  1660.   end
  1661.   #--------------------------------------------------------------------------
  1662.   def update_background
  1663.     return if BM::STATUS::BG_OPTIONS[:bg_scroll_x] == 0 && BM::STATUS::BG_OPTIONS[:bg_scroll_y] == 0
  1664.     @background_sprite.ox += BM::STATUS::BG_OPTIONS[:bg_scroll_x]
  1665.     @background_sprite.oy += BM::STATUS::BG_OPTIONS[:bg_scroll_y]
  1666.   end
  1667.   #--------------------------------------------------------------------------
  1668.   # * Update_Background_Image
  1669.   #--------------------------------------------------------------------------
  1670.   unless method_defined?(:bm_menu_u)
  1671.     alias :bm_menu_u :update
  1672.   end
  1673.   def update
  1674.     bm_menu_u
  1675.     update_background if custom_bg?
  1676.   end
  1677.   #--------------------------------------------------------------------------
  1678.   def type
  1679.     return :state
  1680.   end
  1681.   #--------------------------------------------------------------------------
  1682.   # * create_states_window
  1683.   #--------------------------------------------------------------------------
  1684.   def create_info_window
  1685.     wy = @status_window.height
  1686.     @info_window = Window_StatesElements.new(@actor,0,wy,type)
  1687.     @info_window.set_handler(:cancel,   method(:return_scene))
  1688.     @info_window.set_handler(:pagedown, method(:next_actor))
  1689.     @info_window.set_handler(:pageup,   method(:prev_actor))
  1690.   end
  1691.   #--------------------------------------------------------------------------
  1692.   # * Change Actors
  1693.   #--------------------------------------------------------------------------
  1694.   def on_actor_change
  1695.     @info_window.actor = @actor
  1696.     @status_window.actor = @actor
  1697.     @info_window.activate
  1698.   end
  1699.   #--------------------------------------------------------------------------
  1700.   # * Create Status Window
  1701.   #--------------------------------------------------------------------------
  1702.   def create_status_window
  1703.     @status_window = Window_SkillStatus.new(0, 0)
  1704.     @status_window.width = Graphics.width
  1705.     @status_window.viewport = @viewport
  1706.     @status_window.actor = @actor
  1707.   end
  1708. end
  1709. #==============================================================================
  1710. # ** Scene_StatusElements
  1711. #==============================================================================
  1712. class Scene_StatusElements < Scene_PolyVisual
  1713.   #--------------------------------------------------------------------------
  1714.   def type
  1715.     return :element
  1716.   end
  1717. end
  1718. #==============================================================================
  1719. # ** Scene_StatusStates
  1720. #==============================================================================
  1721. class Scene_StatusStates < Scene_PolyVisual
  1722.   #--------------------------------------------------------------------------
  1723.   def type
  1724.     return :state
  1725.   end
  1726. end
  1727. #==============================================================================
  1728. # ** Scene_StatusResist
  1729. #==============================================================================
  1730. class Scene_StatusResist < Scene_PolyVisual
  1731.   #--------------------------------------------------------------------------
  1732.   def type
  1733.     return :resistance
  1734.   end
  1735. end
  1736. #==============================================================================
  1737. # ** Scene_StatusInflict
  1738. #==============================================================================
  1739. class Scene_StatusInflict < Scene_PolyVisual
  1740.   #--------------------------------------------------------------------------
  1741.   def type
  1742.     return :infliction
  1743.   end
  1744. end
  1745.  
  1746.  
  1747. if !YEA::STATUS::CUSTOM_STATUS_COMMANDS.include?(:resistances)
  1748.   YEA::STATUS::CUSTOM_STATUS_COMMANDS.merge!(BM::STATUS::CHART_STATUS_COMMANDS)
  1749. end
  1750. #===============================================================================
  1751. #
  1752. # END OF FILE
  1753. #
  1754. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement