Advertisement
blackmorning

Blackmorning - Ace Actor Titles

Nov 4th, 2015
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 49.84 KB | None | 0 0
  1. #==============================================================================
  2. # ** Titles for VXACE, by Blackmorning
  3. #==============================================================================
  4. #  Blackmorning
  5. #  Version 1.08
  6. #  released 01/29/2014
  7. #  updated 06/16/2015
  8. # updates
  9. # - allowed to select parameters shown
  10. #==============================================================================
  11. # Based on Titles System from RPG Maker VX by Blackmorning
  12. #
  13. # * compatible with YEA status menu
  14. # add [  :titles,  "Titles"], to list in COMMANDS in YEA status menu script
  15. #
  16. # * compatible with YEA menu engine
  17. # add :titles to COMMANDS in YEA menu engine script
  18. #
  19. #===============================================================================
  20. # Instructions
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # To install this script, open up your script editor and copy/paste this script
  23. # to an open slot below BM - Base but above ? Main. Remember to save.
  24. #
  25. # -----------------------------------------------------------------------------
  26. # Actor Notetags - These notetags go in the actors notebox in the database.
  27. # -----------------------------------------------------------------------------
  28. # <unlocked titles: x>
  29. # <unlocked titles: x, x>
  30. # This will set the default titles as unlocked for the actor. This does not
  31. # override the default titles unlocked in the module, but instead, adds on
  32. # to the number of unlocked titles.
  33.  
  34. # <init title: x>
  35. # This will set the initial title for the actor.
  36. # -----------------------------------------------------------------------------
  37. # Message Window codes - These go inside of your message window.
  38. # \nti[x]    - Writes out title x's name.
  39. # \ati[x]    - Write name of the title for actor x.
  40. # -----------------------------------------------------------------------------
  41. # Script Calls - These commands are used with script calls.
  42. # -----------------------------------------------------------------------------
  43. #
  44. # * Add title to actor
  45. #     add_titles(x, y)
  46. # This allows actor x to unlock title y, making it available for switching in
  47. # and out in the Titles scene.
  48. #
  49. # * remove title from actor
  50. #     remove_titles(x, y)
  51. # This causes actor x to remove title y from being able to switch to and from.
  52. # If the actor is currently title y, the actor's title will default to 0 and the
  53. # title will be removed.
  54. #
  55. # * change title from actor
  56. #     change_titles(x, y)
  57. # This causes actor x to change to title y.
  58. #
  59. # * check if title in list and assigns it to a switch
  60. #     check_titles(actor_id, title_id, switch)
  61. #   example:
  62. #     check_titles(4, 2, 5)
  63. #   checks if actor 4 has title 2 and puts answer in switch 5
  64. #   -can be used without switch_id
  65. #
  66. # * check actor title size and assigns it to a variable
  67. #     actor_title_list_size(actor_id, variable_id)
  68. #   example:
  69. #     actor_title_list_size(4, 10)
  70. #   checks title list size for actor 4 and puts answer in variable 10
  71. #
  72. # * assigns current title_id to variable
  73. #     actor_title_is?(actor_id, variable_id)
  74. #==============================================================================
  75. module BM
  76. module TITLES_SYSTEM
  77.   #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  78.   # Titles Customization
  79.   #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  80.   CUSTOM_TITLES = {
  81.   # format:
  82.   # title_id => ["Title name", "Description", costume name, costume Index],
  83.     1 => ["Normal",""],
  84.     2 => ["Nobleman","Those of noble birth"],
  85.     3 => ["Privateer","A real scoundrel at heart"],
  86.     4 => ["Crusader","Willing to take on any brave endevour"],
  87.     5 => ["Clumsy Fool","Keep out of the way!"],
  88.     6 => ["Juggler","What goes up, does not fall to the ground."],
  89.     7 => ["Bashful","Don't talk about me like that, I'm going red."],
  90.     8 => ["Tipsy","What wash in thish drink?  Whoops!"],
  91.     9 => ["Wolf","Hungry like a wolf", "Animal",6],
  92.   # Add more titles as you like      
  93.  
  94.   }# don't remove  
  95.   #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  96.   # Level Up Bonus
  97.   #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  98.   # titles can add (or subtract) from stats during level up
  99.   TITLE_PARAM_GROWTH_CHANGE = true  
  100.   PARAM_GROWTH = { # do not remove
  101.   #title_id    Hp  Mp Atk Def  Mat  Mdf   Agi   Luk]
  102.          2 => [ 40,  0,  0,  5,  0,   0,   0,    0],
  103.          3 => [ 0,  20,  0,  0,  0,   5,   0,    0],
  104.          4 => [50,  0,  0,  0,  0,   0,   0,    0],
  105.          5 => [10,  0,  0,  0,  0,   0,   0,    0],
  106.          6 => [ 0,  30,  0,  0,  0,   2,   0,    0],
  107.          7 => [ 60,  0,  0,  2,  0,   0,   0,    0],
  108.   # Add more titles as you like                
  109.          
  110.   }# do not remove  
  111.   #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  112.   # Base Stat Bonus
  113.   #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  114.   # titles can change base stats  
  115.   TITLE_PARAM_BASE_CHANGE = true
  116.   # change base stat change to :percent or :static
  117.   # :percent (ie. 20 is a 20% increase)
  118.   # :static (ie. 20 is +20)
  119.   TITLE_PARAM_BASE = :percent
  120.   PARAM_BASE = { # do not remove
  121.   #title_id    Hp  Mp Atk Def  Mat  Mdf   Agi   Luk]
  122.          2 => [20,  0,  0,  50,  0,   0,   0,    0],
  123.          3 => [ 0,  20,  0,  0,  0,   50,   0,    0],
  124.          4 => [50,  0,  0,  0,  0,   0,   0,    0],
  125.          5 => [10,  0,  0,  0,  0,   0,   0,    0],
  126.          6 => [ 0,  30,  0,  0,  0,   20,   0,    0],
  127.          7 => [ 60,  0,  0,  20,  0,   0,   0,    0],
  128.   # Add more titles as you like                
  129.          
  130.   }# do not remove
  131.   #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  132.   # - Switch Settings -
  133.   #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  134.   # These are the switches that govern whether or not certain menu items will
  135.   # appear and/or will be enabled. By binding them to a Switch, you can just
  136.   # set the Switch ON/OFF to show/hide or enable/disable a menu command. If
  137.   # you do not wish to use this feature, set these commands to 0.
  138.   #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  139.   STATUS_COMMANDS ={ # for YEA Status Menu
  140.   # :command => [EnableSwitch, ShowSwitch, Handler Method, Window Draw],
  141.     :titles    => [ 0,  0, :command_titles, :draw_titles],
  142.   } # DO NOT REMOVE
  143.   MENU_COMMANDS ={ # For main menu
  144.   # :command => ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
  145.     :titles   => [  "Titles",            3,          3, :command_titles],
  146.   } # DO NOT REMOVE
  147.   #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  148.   # Titles Window Options
  149.   #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  150.   CURRENT_TITLE_COLOUR = 17
  151.   PARAM_FONT_SIZE = 20
  152.   # This array sets the order of how classes are ordered in the class listing
  153.   # window. Any class ID's unlisted will not be shown.
  154.   TITLE_ORDER = [1..20]
  155.   DEFAULT_UNLOCKS = [1, 5]   # Titles unlocked by default.
  156.   PARAM_SHOWN = 0..7 # parameters shown when selecting titles
  157.   #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  158.   # - Titles Scene Commands -
  159.   #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  160.   # These settings adjust how the titles scene appears. Here, you can adjust
  161.   # the command list and the order at which items appear. These are mostly
  162.   # visual settings. Adjust them as you see fit.
  163.   COMMANDS =[ # The order at which the menu items are shown.
  164.     # [ :command,   "Display"],
  165.       [ :primary,   "Titles"],
  166.     # [ :custom1,   "Custom1"],
  167.     # [ :custom2,   "Custom2"],
  168.     ] # Do not remove this.
  169.   # For those who use scripts to that may produce unique effects for the
  170.   # titles menu, use this hash to manage the custom commands for the Titles
  171.   # Command Window. You can disable certain commands or prevent them from
  172.   # appearing by using switches. If you don't wish to bind them to a switch,
  173.   # set the proper switch to 0 for it to have no impact.
  174.   #--------------------------------------------------------------------------
  175.   CUSTOM_TITLES_COMMANDS ={
  176.   # :command => [EnableSwitch, ShowSwitch, Handler Method,
  177.     :custom1 => [           0,          0, :command_name1],
  178.     :custom2 => [           0,          0, :command_name2],
  179.   } # Do not remove this.  
  180.   end
  181. end
  182. #===============================================================================
  183. # Editting anything past this point may potentially result in causing computer
  184. # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
  185. # Therefore, edit at your own risk.
  186. #==============================================================================
  187. # ** module BM
  188. #==============================================================================
  189. module BM
  190.   def self.required(name, req, version, type = nil)
  191.     if !$imported[:bm_base]
  192.       msg = "The script '%s' requires the script\n"
  193.       msg += "'BM - Base' v%s or higher above it to work properly\n"
  194.       msg += "Go to bmscripts.weebly.com to download this script."
  195.       msgbox(sprintf(msg, self.script_name(name), version))
  196.       exit
  197.     else
  198.       self.required_script(name, req, version, type)
  199.     end
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # * script_name
  203.   #   Get the script name base on the imported value
  204.   #--------------------------------------------------------------------------
  205.   def self.script_name(name, ext = "BM")
  206.     name = name.to_s.gsub("_", " ").upcase.split
  207.     name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
  208.     name.join(" ")
  209.   end
  210. end
  211. $imported ||= {}
  212. $imported[:bm_titles] = 1.08
  213. BM.required(:bm_titles, :bm_base, 1.00, :above)
  214. #==========================================================================
  215. # ** Game Interpreter
  216. #==========================================================================
  217. class Game_Interpreter
  218.   #--------------------------------------------------------------------------
  219.   # * new method: add title
  220.   #--------------------------------------------------------------------------
  221.   def add_titles(actor_id, title_id)
  222.     $game_actors[actor_id].unlock_title(title_id)
  223.   end
  224.   #--------------------------------------------------------------------------
  225.   # * new method: remove title
  226.   #--------------------------------------------------------------------------
  227.   def remove_titles(actor_id, title_id)
  228.     $game_actors[actor_id].remove_title(title_id)
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # * new method: change title
  232.   #--------------------------------------------------------------------------
  233.   def change_titles(actor_id, title_id)
  234.     $game_actors[actor_id].change_title(title_id)
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # * new method: actor title is?
  238.   #--------------------------------------------------------------------------
  239.   def actor_title_is?(actor_id, variable_id = 0)
  240.     titles_id = $game_actors[actor_id].title_id
  241.     $game_variables[variable_id] = titles_id if variable_id > 0
  242.     return titles_id
  243.   end
  244.   #--------------------------------------------------------------------------
  245.   # * new method: check titles
  246.   #--------------------------------------------------------------------------
  247.   def check_titles(actor_id, title_id, switch_id = nil)
  248.     in_list = $game_actors[actor_id].unlocked_titles.include?(title_id)
  249.     $game_switches[switch_id] = in_list if switch_id > 0
  250.     return in_list
  251.   end
  252.   #--------------------------------------------------------------------------
  253.   # * new method: title list size
  254.   #--------------------------------------------------------------------------
  255.   def actor_title_list_size(actor, variable_id = 0)
  256.     title_list = $game_actors[actor].unlocked_titles
  257.     $game_variables[variable_id] = title_list.size if variable_id > 0
  258.     return title_list
  259.   end
  260. end
  261. #==========================================================================
  262. # ** BM::TITLES_SYSTEM
  263. #==========================================================================
  264. module BM::TITLES_SYSTEM
  265.   module_function  
  266.   #--------------------------------------------------------------------------
  267.   # convert_integer_array
  268.   #--------------------------------------------------------------------------
  269.   def convert_integer_array(array)
  270.     result = []
  271.     array.each { |i|
  272.       case i
  273.       when Range; result |= i.to_a
  274.       when Integer; result |= [i]
  275.       end }
  276.     return result
  277.   end
  278.   #--------------------------------------------------------------------------
  279.   # converted_contants
  280.   #--------------------------------------------------------------------------
  281.   DEFAULT_UNLOCKS = convert_integer_array(DEFAULT_UNLOCKS)
  282.   TITLE_ORDER = convert_integer_array(TITLE_ORDER)
  283. end
  284. #==============================================================================
  285. module BM
  286.   module REGEXP
  287.   module ACTOR    
  288.     UNLOCKED_TITLES =
  289.       /<(?:UNLOCKED_TITLES|unlocked titles):[ ]*(\d+(?:\s*,\s*\d+)*)>/i    
  290.     INIT_TITLE =
  291.       /<(?:INIT_TITLE|init title):[ ](\d+)>/i  
  292.   end # ACTOR
  293.   end # REGEXP
  294. end # YEA
  295. #==============================================================================
  296. # ** Switch
  297. #==============================================================================
  298. module Switch  
  299.   #--------------------------------------------------------------------------
  300.   # self.titles_show
  301.   #--------------------------------------------------------------------------
  302.   def self.titles_show
  303.     return true if BM::TITLES_SYSTEM::MENU_COMMANDS[:titles][2] <= 0
  304.     return $game_switches[BM::TITLES_SYSTEM::MENU_COMMANDS[:titles][2]]
  305.   end
  306.   #--------------------------------------------------------------------------
  307.   # self.titles_enable
  308.   #--------------------------------------------------------------------------
  309.   def self.titles_enable
  310.     return true if BM::TITLES_SYSTEM::MENU_COMMANDS[:titles][1] <= 0
  311.     return $game_switches[BM::TITLES_SYSTEM::MENU_COMMANDS[:titles][1]]
  312.   end    
  313. end # Switch
  314. #==============================================================================
  315. # ** Vocab
  316. #==============================================================================
  317. module Vocab
  318.   def self.titles_name(id)
  319.     return "" unless BM::TITLES_SYSTEM::CUSTOM_TITLES.include?(id)
  320.     return BM::TITLES_SYSTEM::CUSTOM_TITLES[id][0]
  321.   end
  322. end
  323. #==============================================================================
  324. # ** DataManager
  325. #==============================================================================
  326. module DataManager  
  327.   #--------------------------------------------------------------------------
  328.   # alias method: load_database
  329.   #--------------------------------------------------------------------------
  330.   class <<self; alias :bm_titles_ld :load_database; end
  331.   def self.load_database
  332.     bm_titles_ld
  333.     load_notetags_bm_titles
  334.   end  
  335.   #--------------------------------------------------------------------------
  336.   # new method: load_notetags_bm_titles
  337.   #--------------------------------------------------------------------------
  338.   def self.load_notetags_bm_titles
  339.     groups = [$data_actors]
  340.     for group in groups
  341.       for obj in group
  342.         next if obj.nil?
  343.         obj.load_notetags_bm_titles
  344.       end
  345.     end
  346.   end  
  347. end # DataManager
  348. #==============================================================================
  349. # ** RPG::Actor
  350. #==============================================================================
  351. class RPG::Actor < RPG::BaseItem  
  352.   #--------------------------------------------------------------------------
  353.   # public instance variables
  354.   #--------------------------------------------------------------------------
  355.   attr_accessor :unlocked_titles  
  356.   attr_accessor :init_title
  357.   #--------------------------------------------------------------------------
  358.   # common cache: load_notetags_bm_titles
  359.   #--------------------------------------------------------------------------
  360.   def load_notetags_bm_titles
  361.     @unlocked_titles = []
  362.     @init_title = 1
  363.     #---
  364.     self.note.split(/[\r\n]+/).each { |line|
  365.       case line
  366.       #---
  367.       when BM::REGEXP::ACTOR::UNLOCKED_TITLES
  368.         $1.scan(/\d+/).each { |num|
  369.         @unlocked_titles.push(num.to_i) if num.to_i > 0 }
  370.       when BM::REGEXP::ACTOR::INIT_TITLE
  371.         @init_title = $1.to_i
  372.       #---
  373.       end
  374.     } # self.note.split
  375.     #---
  376.   end  
  377. end # RPG::Actor
  378. #==============================================================================
  379. # ** Game_Temp
  380. #==============================================================================
  381. class Game_Temp  
  382.   #--------------------------------------------------------------------------
  383.   # public instance variables
  384.   #--------------------------------------------------------------------------
  385.   attr_accessor :scene_titles_index
  386.   attr_accessor :scene_titles_oy  
  387. end # Game_Temp
  388. #==============================================================================
  389. # ** Game_BattlerBase
  390. #==============================================================================
  391. class Game_BattlerBase  
  392.   #--------------------------------------------------------------------------
  393.   # public instance variables
  394.   #--------------------------------------------------------------------------
  395.   attr_accessor :temp_flag
  396.   #--------------------------------------------------------------------------
  397.   # * new method: title_param_bonus_growth
  398.   #--------------------------------------------------------------------------
  399.   def title_param_bonus_growth(param_id)
  400.     n = 0.0
  401.     return n unless BM::TITLES_SYSTEM::TITLE_PARAM_GROWTH_CHANGE && BM::TITLES_SYSTEM::PARAM_GROWTH.include?(@title_id)
  402.     if actor?
  403.       n += BM::TITLES_SYSTEM::PARAM_GROWTH[@title_id][param_id]
  404.     end
  405.     return n
  406.   end  
  407.   #--------------------------------------------------------------------------
  408.   # * new method: title_param_bonus_base
  409.   #--------------------------------------------------------------------------
  410.   def title_param_bonus_base(param_id)
  411.     n = 0.0
  412.     return n unless BM::TITLES_SYSTEM::TITLE_PARAM_BASE_CHANGE && BM::TITLES_SYSTEM::PARAM_BASE.include?(@title_id)
  413.     if actor?
  414.       n += BM::TITLES_SYSTEM::PARAM_BASE[@title_id][param_id]
  415.     end
  416.     return n
  417.   end  
  418. end # Game_BattlerBase
  419. #===============================================================================
  420. # Game_actor
  421. #===============================================================================
  422. class Game_Actor < Game_Battler
  423.   #--------------------------------------------------------------------------
  424.   # * Public Instance Variables
  425.   #--------------------------------------------------------------------------
  426.   attr_accessor :title_id                     # Title id
  427.   #--------------------------------------------------------------------------
  428.   # * alias: setup
  429.   #--------------------------------------------------------------------------
  430.   alias :bm_titles_setup :setup
  431.   def setup(actor_id)
  432.     bm_titles_setup(actor_id)
  433.     init_unlocked_titles
  434.   end
  435.   #--------------------------------------------------------------------------
  436.   # new method: init_unlocked_titles
  437.   #--------------------------------------------------------------------------
  438.   def init_unlocked_titles
  439.     @title_id = actor.init_title
  440.     @unlocked_titles = actor.unlocked_titles.clone
  441.     @unlocked_titles.push(@title_id) if !@unlocked_titles.include?(@title_id)
  442.     @unlocked_titles.sort!
  443.     @init_titles_graphics_name = @character_name
  444.     @init_titles_graphics_index = @character_index
  445.     change_title_graphic(@title_id)
  446.   end
  447.   #--------------------------------------------------------------------------
  448.   # new method: unlocked_titles
  449.   #--------------------------------------------------------------------------
  450.   def unlocked_titles
  451.     init_unlocked_titles if @unlocked_titles.nil?
  452.     return @unlocked_titles
  453.   end
  454.   #--------------------------------------------------------------------------
  455.   # new method: unlock_title
  456.   #--------------------------------------------------------------------------
  457.   def unlock_title(title_id)
  458.     init_unlocked_titles if @unlocked_titles.nil?
  459.     return unless BM::TITLES_SYSTEM::CUSTOM_TITLES.include?(title_id)
  460.     return if @unlocked_titles.include?(title_id)
  461.     @unlocked_titles.push(title_id)
  462.   end
  463.   #--------------------------------------------------------------------------
  464.   # new method: remove_title
  465.   #--------------------------------------------------------------------------
  466.   def remove_title(title_id)
  467.     init_unlocked_titles if @unlocked_titles.nil?
  468.     if title_id == @title_id
  469.       @title_id = 0
  470.     end
  471.     @unlocked_titles.delete(title_id)
  472.     refresh
  473.   end
  474.   #--------------------------------------------------------------------------
  475.   # new method: change_title
  476.   #--------------------------------------------------------------------------
  477.   def change_title(title_id)
  478.     return unless BM::TITLES_SYSTEM::CUSTOM_TITLES.include?(title_id)
  479.     @title_id = title_id
  480.     change_title_graphic(title_id)
  481.     unlock_title(title_id)
  482.     $game_player.refresh
  483.   end
  484.   #--------------------------------------------------------------------------
  485.   def change_title_graphic(title_id)
  486.     character_name = @init_titles_graphics_name
  487.     character_index = @init_titles_graphics_index
  488.     unless BM::TITLES_SYSTEM::CUSTOM_TITLES[title_id][2].nil?
  489.       character_name = BM::TITLES_SYSTEM::CUSTOM_TITLES[title_id][2]
  490.       character_index = BM::TITLES_SYSTEM::CUSTOM_TITLES[title_id][3]
  491.     end
  492.     set_graphic(character_name, character_index, @face_name, @face_index)
  493.     refresh
  494.   end
  495.   #--------------------------------------------------------------------------
  496.   # * alias: param_base
  497.   #--------------------------------------------------------------------------
  498.   alias :bm_title_pb :param_base
  499.   def param_base(param_id)
  500.     result = bm_title_pb(param_id)
  501.     if BM::TITLES_SYSTEM::TITLE_PARAM_BASE == :percent
  502.       result += result * title_param_bonus_base(param_id)/100
  503.     elsif BM::TITLES_SYSTEM::TITLE_PARAM_BASE == :static
  504.       result += title_param_bonus_base(param_id)
  505.     end    
  506.     return result.to_i
  507.   end
  508.   #---------------------------------------------------------------------------
  509.   # alias: level_up
  510.   #---------------------------------------------------------------------------
  511.   alias :bm_title_lup :level_up
  512.   def level_up
  513.     last_level = @level
  514.     bm_title_lup
  515.     apply_title_param_bonus_growth if last_level != @level  
  516.   end
  517.   #--------------------------------------------------------------------------
  518.   # new method: apply_title_param_bonus_growth
  519.   #--------------------------------------------------------------------------
  520.   def apply_title_param_bonus_growth(rate = 1)
  521.     for i in 0...8 do @param_plus[i] += title_param_bonus_growth(i) * rate end
  522.   end
  523. end
  524. #==============================================================================
  525. # ** Window_Base
  526. #==============================================================================
  527. class Window_Base < Window
  528.   #--------------------------------------------------------------------------
  529.   # * Alias: convert_escape_characters
  530.   #--------------------------------------------------------------------------
  531.   alias :bm_titles_cec :convert_escape_characters
  532.   def convert_escape_characters(text)
  533.     result = bm_titles_cec(text)
  534.     result = convert_bm_titles_characters(result)    
  535.     return result
  536.   end
  537.   #--------------------------------------------------------------------------
  538.   def convert_bm_titles_characters(result)
  539.     result.gsub!(/\eNTI\[(\d+)\]/i)  { Vocab.titles_name($1.to_i) rescue "" }    
  540.     result.gsub!(/\eATI\[([-+]?\d+)\]/i) {  escape_actor_titles_name($1.to_i) }
  541.     return result
  542.   end
  543.   #--------------------------------------------------------------------------
  544.   # new method: escape_actor_titles_name
  545.   #--------------------------------------------------------------------------
  546.   def escape_actor_titles_name(actor_id)
  547.     actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
  548.     actor = $game_actors[actor_id]
  549.     return "" if actor.nil?
  550.     return Vocab.titles_name(actor.title_id)
  551.   end
  552.   #--------------------------------------------------------------------------
  553.   def titles_desc(title_id)
  554.     return "" unless BM::TITLES_SYSTEM::CUSTOM_TITLES.include?(title_id)
  555.     desc = BM::TITLES_SYSTEM::CUSTOM_TITLES[title_id][1]
  556.     return (desc == nil) ? "" : desc
  557.   end
  558.   #--------------------------------------------------------------------------
  559.   # new method: draw_actor_title
  560.   #--------------------------------------------------------------------------
  561.   def draw_actor_title(actor, x, y, width = 112)
  562.     change_color(normal_color)
  563.     text = Vocab.titles_name(actor.title_id)
  564.     draw_text(x, y, width, line_height, text)
  565.   end  
  566. end # Window_Base
  567. #==============================================================================
  568. # ** Window_StatusItem
  569. #==============================================================================
  570. class Window_StatusItem < Window_Base
  571.   def draw_titles
  572.     data = []
  573.     for title_id in BM::TITLES_SYSTEM::TITLE_ORDER
  574.       next if !BM::TITLES_SYSTEM::CUSTOM_TITLES.include?(title_id)
  575.       next unless @actor.unlocked_titles.include?(title_id) or
  576.         BM::TITLES_SYSTEM::DEFAULT_UNLOCKS.include?(title_id)
  577.       data.push(title_id)
  578.     end
  579.     dx = 0; dy = 0; title_index = 0
  580.     for id in data
  581.       item = data[title_index]
  582.       reset_font_settings
  583.       if item == @actor.title_id
  584.         change_color(text_color(BM::TITLES_SYSTEM::CURRENT_TITLE_COLOUR))
  585.       else
  586.         change_color(normal_color)
  587.       end
  588.       text = Vocab.titles_name(item)
  589.       draw_text(24, dy, contents.width-24, line_height, text)
  590.       title_index += 1
  591.       dy += line_height
  592.       break if dy + line_height > contents.height
  593.     end
  594.     dw = Graphics.width * 2 / 5 - 24
  595.     dx = contents.width - dw; dy = 0
  596.     param_id = 0
  597.     for param_id in BM::TITLES_SYSTEM::PARAM_SHOWN
  598.       colour = Color.new(0, 0, 0, translucent_alpha/2)
  599.       rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
  600.       contents.fill_rect(rect, colour)
  601.       contents.font.size = BM::TITLES_SYSTEM::PARAM_FONT_SIZE
  602.       change_color(system_color)
  603.       draw_text(dx+4, dy, dw, line_height, Vocab::param(param_id))
  604.       change_color(normal_color)
  605.       dwa = (Graphics.width * 2 / 5 - 2) / 2
  606.       draw_text(dx, dy, dwa, line_height, @actor.param(param_id).group, 2)
  607.       reset_font_settings
  608.       change_color(system_color)
  609.       draw_text(dx + dwa, dy, 22, line_height, "?", 1)
  610.       dy += line_height
  611.       break if dy + line_height > contents.height
  612.     end
  613.   end
  614. end
  615. #==============================================================================
  616. # ** Window_TitleParam
  617. #==============================================================================
  618. class Window_TitleParam < Window_Base  
  619.   #--------------------------------------------------------------------------
  620.   # initialize
  621.   #--------------------------------------------------------------------------
  622.   def initialize(dx, dy)
  623.     super(dx, dy, window_width, Graphics.height - dy)
  624.     @actor = nil
  625.     @temp_actor = nil
  626.     refresh
  627.   end  
  628.   #--------------------------------------------------------------------------
  629.   # window_width
  630.   #--------------------------------------------------------------------------
  631.   def window_width; return Graphics.width * 2 / 5; end
  632.   #--------------------------------------------------------------------------
  633.   # actor=
  634.   #--------------------------------------------------------------------------
  635.   def actor=(actor)
  636.     return if @actor == actor
  637.     @actor = actor
  638.     refresh
  639.   end  
  640.   #--------------------------------------------------------------------------
  641.   # refresh
  642.   #--------------------------------------------------------------------------
  643.   def refresh
  644.     contents.clear
  645.     dy = 0
  646.     for i in BM::TITLES_SYSTEM::PARAM_SHOWN
  647.       draw_item(0, dy, i)
  648.       dy += line_height
  649.       break if dy + line_height > contents.height
  650.     end
  651.   end  
  652.   #--------------------------------------------------------------------------
  653.   # set_temp_actor
  654.   #--------------------------------------------------------------------------
  655.   def set_temp_actor(temp_actor)
  656.     return if @temp_actor == temp_actor
  657.     @temp_actor = temp_actor
  658.     refresh
  659.   end  
  660.   #--------------------------------------------------------------------------
  661.   # draw_item
  662.   #--------------------------------------------------------------------------
  663.   def draw_item(dx, dy, param_id)
  664.     draw_background_colour(dx, dy)
  665.     draw_param_name(dx + 4, dy, param_id)
  666.     draw_current_param(dx + 4, dy, param_id) if @actor
  667.     drx = (contents.width + 22) / 2
  668.     draw_right_arrow(drx, dy)
  669.     draw_new_param(drx + 22, dy, param_id) if @temp_actor
  670.     reset_font_settings
  671.   end  
  672.   #--------------------------------------------------------------------------
  673.   # draw_background_colour
  674.   #--------------------------------------------------------------------------
  675.   def draw_background_colour(dx, dy)
  676.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  677.     rect = Rect.new(dx+1, dy+1, contents.width - 2, line_height - 2)
  678.     contents.fill_rect(rect, colour)
  679.   end  
  680.   #--------------------------------------------------------------------------
  681.   # draw_param_name
  682.   #--------------------------------------------------------------------------
  683.   def draw_param_name(dx, dy, param_id)
  684.     contents.font.size = BM::TITLES_SYSTEM::PARAM_FONT_SIZE
  685.     change_color(system_color)
  686.     draw_text(dx, dy, contents.width, line_height, Vocab::param(param_id))
  687.   end  
  688.   #--------------------------------------------------------------------------
  689.   # draw_current_param
  690.   #--------------------------------------------------------------------------
  691.   def draw_current_param(dx, dy, param_id)
  692.     change_color(normal_color)
  693.     dw = (contents.width + 22) / 2
  694.     draw_text(0, dy, dw, line_height, @actor.param(param_id).group, 2)
  695.     reset_font_settings
  696.   end  
  697.   #--------------------------------------------------------------------------
  698.   # draw_right_arrow
  699.   #--------------------------------------------------------------------------
  700.   def draw_right_arrow(x, y)
  701.     change_color(system_color)
  702.     draw_text(x, y, 22, line_height, "?", 1)
  703.   end  
  704.   #--------------------------------------------------------------------------
  705.   # draw_new_param
  706.   #--------------------------------------------------------------------------
  707.   def draw_new_param(dx, dy, param_id)
  708.     contents.font.size = BM::TITLES_SYSTEM::PARAM_FONT_SIZE
  709.     new_value = @temp_actor.param(param_id)
  710.     change = new_value - @actor.param(param_id)
  711.     change_color(param_change_color(change))
  712.     w = contents.text_size(new_value).width
  713.     draw_icon(Icon.param_compare(change), contents.width-w-12, dy) if $imported[:bm_icon]    
  714.     draw_text(0, dy, contents.width-4, line_height, new_value.group, 2)
  715.     reset_font_settings
  716.   end  
  717. end
  718. #==============================================================================
  719. # ¦ Window_TitleList
  720. #==============================================================================
  721. class Window_TitleList < Window_Selectable  
  722.   #--------------------------------------------------------------------------
  723.   # initialize
  724.   #--------------------------------------------------------------------------
  725.   def initialize(dx, dy)
  726.     dw = Graphics.width - (Graphics.width * 2 / 5)
  727.     dh = Graphics.height - dy
  728.     super(dx, dy, dw, dh)
  729.     @actor = nil
  730.     @command_window = nil
  731.     @status_window
  732.     @data = []
  733.   end  
  734.   #--------------------------------------------------------------------------
  735.   # actor=
  736.   #--------------------------------------------------------------------------
  737.   def actor=(actor)
  738.     return if @actor == actor
  739.     @actor = actor
  740.     @last_item = nil
  741.     refresh
  742.     self.oy = 0
  743.   end  
  744.   #--------------------------------------------------------------------------
  745.   # command_window=
  746.   #--------------------------------------------------------------------------
  747.   def command_window=(command_window)
  748.     @command_window = command_window
  749.   end  
  750.   #--------------------------------------------------------------------------
  751.   # status_window=
  752.   #--------------------------------------------------------------------------
  753.   def status_window=(status_window)
  754.     @status_window = status_window
  755.   end  
  756.   #--------------------------------------------------------------------------
  757.   # item_max
  758.   #--------------------------------------------------------------------------
  759.   def item_max; return @data ? @data.size : 1; end  
  760.   #--------------------------------------------------------------------------
  761.   # item
  762.   #--------------------------------------------------------------------------
  763.   def item; return @data && index >= 0 ? @data[index] : nil; end  
  764.   #--------------------------------------------------------------------------
  765.   # current_item_enabled?
  766.   #--------------------------------------------------------------------------
  767.   def current_item_enabled?; return enable?(@data[index]); end  
  768.   #--------------------------------------------------------------------------
  769.   # include?
  770.   #--------------------------------------------------------------------------
  771.   def include?(item)
  772.     return true if BM::TITLES_SYSTEM::DEFAULT_UNLOCKS.include?(item)
  773.     return @actor.unlocked_titles.include?(item)
  774.   end  
  775.   #--------------------------------------------------------------------------
  776.   # enable?
  777.   #--------------------------------------------------------------------------
  778.   def enable?(item)
  779.     return false if item == @actor.title_id
  780.     return true
  781.   end  
  782.   #--------------------------------------------------------------------------
  783.   # make_item_list
  784.   #--------------------------------------------------------------------------
  785.   def make_item_list
  786.     @data = []
  787.     for title_id in BM::TITLES_SYSTEM::TITLE_ORDER
  788.       next if BM::TITLES_SYSTEM::CUSTOM_TITLES[title_id].nil?
  789.       item = title_id
  790.       @data.push(item) if include?(item)
  791.     end
  792.   end  
  793.   #--------------------------------------------------------------------------
  794.   # select_last
  795.   #--------------------------------------------------------------------------
  796.   def select_last
  797.     case @command_window.current_symbol
  798.     when :primary
  799.       select(@data.index(@actor.title_id))
  800.     else
  801.       select(0)
  802.     end
  803.   end  
  804.   #--------------------------------------------------------------------------
  805.   # draw_item
  806.   #--------------------------------------------------------------------------
  807.   def draw_item(index)
  808.     item = @data[index]
  809.     return if item.nil?
  810.     rect = item_rect(index)
  811.     rect.width -= 4
  812.     reset_font_settings
  813.     set_item_colour(item)
  814.     draw_titles_name(item, rect)
  815.   end  
  816.   #--------------------------------------------------------------------------
  817.   # set_item_colour
  818.   #--------------------------------------------------------------------------
  819.   def set_item_colour(item)
  820.     if item == @actor.title_id
  821.       change_color(text_color(BM::TITLES_SYSTEM::CURRENT_TITLE_COLOUR))
  822.     else
  823.       change_color(normal_color, enable?(item))
  824.     end
  825.   end
  826.   #--------------------------------------------------------------------------
  827.   # draw_titles_name
  828.   #--------------------------------------------------------------------------
  829.   def draw_titles_name(item, rect)
  830.     text = Vocab.titles_name(item)
  831.     draw_text(24, rect.y, rect.width-24, line_height, text)
  832.   end
  833.   #--------------------------------------------------------------------------
  834.   # update_help
  835.   #--------------------------------------------------------------------------
  836.   def update_help
  837.     @help_window.set_text(Vocab.titles_name(item) ? titles_desc(item) : "")
  838.     return if @actor.nil?
  839.     return if @status_window.nil?
  840.     update_param_window
  841.   end  
  842.   #--------------------------------------------------------------------------
  843.   # update_param_window
  844.   #--------------------------------------------------------------------------
  845.   def update_param_window
  846.     return if @last_item == item
  847.     @last_item = item
  848.     title_id = item.nil? ? @actor.title_id : item
  849.     temp_actor = Marshal.load(Marshal.dump(@actor))
  850.     temp_actor.temp_flag = true
  851.     case @command_window.current_symbol
  852.     when :primary
  853.       temp_actor.change_title(title_id)
  854.     end
  855.     @status_window.set_temp_actor(temp_actor)
  856.   end  
  857.   #--------------------------------------------------------------------------
  858.   # update_titles
  859.   #--------------------------------------------------------------------------
  860.   def update_titles
  861.     @last_item = nil
  862.     update_help
  863.     refresh
  864.     activate
  865.   end  
  866.   #--------------------------------------------------------------------------
  867.   # refresh
  868.   #--------------------------------------------------------------------------
  869.   def refresh
  870.     make_item_list
  871.     create_contents
  872.     draw_all_items
  873.   end  
  874. end
  875. #==============================================================================
  876. # ¦ Window_MenuCommand
  877. #==============================================================================
  878. class Window_MenuCommand < Window_Command  
  879.   #--------------------------------------------------------------------------
  880.   # alias method: add_formation_command
  881.   #--------------------------------------------------------------------------
  882.   alias :bm_titles_aoc :add_original_commands
  883.   def add_original_commands
  884.     add_titles_command unless $imported["YEA-AceMenuEngine"]
  885.     bm_titles_aoc
  886.   end  
  887.   #--------------------------------------------------------------------------
  888.   # new method: add_titles_command
  889.   #--------------------------------------------------------------------------
  890.   def add_titles_command
  891.     return unless Switch.titles_show
  892.     text = BM::TITLES_SYSTEM::MENU_COMMANDS[:titles][0]
  893.     add_command(text, :titles, Switch.titles_enable)
  894.   end  
  895. end # Window_MenuCommand
  896. #==============================================================================
  897. # ¦ Window_TitlesCommand
  898. #==============================================================================
  899. class Window_TitlesCommand < Window_Command  
  900.   #--------------------------------------------------------------------------
  901.   # initialize
  902.   #--------------------------------------------------------------------------
  903.   def initialize(x, y)
  904.     super(x, y)
  905.     @actor = nil
  906.   end  
  907.   #--------------------------------------------------------------------------
  908.   # ? ?????????
  909.   #--------------------------------------------------------------------------
  910.   def window_width; return 160; end  
  911.   #--------------------------------------------------------------------------
  912.   # actor=
  913.   #--------------------------------------------------------------------------
  914.   def actor=(actor)
  915.     return if @actor == actor
  916.     @actor = actor
  917.     refresh
  918.   end  
  919.   #--------------------------------------------------------------------------
  920.   # item_window=
  921.   #--------------------------------------------------------------------------
  922.   def item_window=(window)
  923.     @item_window = window
  924.   end  
  925.   #--------------------------------------------------------------------------
  926.   # visible_line_number
  927.   #--------------------------------------------------------------------------
  928.   def visible_line_number; return 4; end  
  929.   #--------------------------------------------------------------------------
  930.   # make_command_list
  931.   #--------------------------------------------------------------------------
  932.   def make_command_list
  933.     return if @actor.nil?
  934.     for command in BM::TITLES_SYSTEM::COMMANDS
  935.       case command[0]
  936.       when :primary
  937.         add_command(command[1], command[0])
  938.       else
  939.         process_custom_command(command)
  940.       end
  941.     end
  942.     if !$game_temp.scene_titles_index.nil?
  943.       select($game_temp.scene_titles_index)
  944.       self.oy = $game_temp.scene_titles_oy
  945.     end
  946.     $game_temp.scene_titles_index = nil
  947.     $game_temp.scene_titles_oy = nil
  948.   end  
  949.   #--------------------------------------------------------------------------
  950.   # process_ok
  951.   #--------------------------------------------------------------------------
  952.   def process_ok
  953.     $game_temp.scene_titles_index = index
  954.     $game_temp.scene_titles_oy = self.oy
  955.     super
  956.   end  
  957.   #--------------------------------------------------------------------------
  958.   # process_custom_command
  959.   #--------------------------------------------------------------------------
  960.   def process_custom_command(command)
  961.     return unless BM_TITLES_SYSTEM::CUSTOM_TITLES_COMMANDS.include?(command[0])
  962.     show =  BM_TITLES_SYSTEM::CUSTOM_TITLES_COMMANDS[command[0]][1]
  963.     continue = show <= 0 ? true : $game_switches[show]
  964.     return unless continue
  965.     text = command[1]
  966.     switch =  BM_TITLES_SYSTEM::CUSTOM_TITLES_COMMANDS[command[0]][0]
  967.     enabled = switch <= 0 ? true : $game_switches[switch]
  968.     add_command(text, command[0], enabled)
  969.   end
  970.   #--------------------------------------------------------------------------
  971.   # update
  972.   #--------------------------------------------------------------------------
  973.   def update
  974.     super
  975.     update_visible_windows
  976.   end  
  977.   #--------------------------------------------------------------------------
  978.   # update_visible_windows
  979.   #--------------------------------------------------------------------------
  980.   def update_visible_windows
  981.     return if @current_index == current_symbol
  982.     @current_index = current_symbol
  983.     @item_window.refresh unless @item_window.nil?
  984.   end  
  985. end
  986. #==============================================================================
  987. # ** Scene_Menu
  988. #==============================================================================
  989. class Scene_Menu < Scene_MenuBase  
  990.   #--------------------------------------------------------------------------
  991.   # alias method: create_command_window
  992.   #--------------------------------------------------------------------------
  993.   alias :bm_titles_ccw :create_command_window
  994.   def create_command_window
  995.     bm_titles_ccw
  996.     @command_window.set_handler(:titles, method(:command_personal))
  997.   end  
  998.   #--------------------------------------------------------------------------
  999.   # alias method: on_personal_ok
  1000.   #--------------------------------------------------------------------------
  1001.   alias :bm_titles_opk :on_personal_ok
  1002.   def on_personal_ok
  1003.     case @command_window.current_symbol
  1004.     when :titles
  1005.       command_titles
  1006.     else
  1007.       bm_titles_opk
  1008.     end
  1009.   end
  1010.   #--------------------------------------------------------------------------
  1011.   # new method: command_titles
  1012.   #--------------------------------------------------------------------------
  1013.   def command_titles
  1014.     SceneManager.call(Scene_Titles)
  1015.   end  
  1016. end # Scene_Menu
  1017. #==============================================================================
  1018. # ** Scene_Titles
  1019. #==============================================================================
  1020. class Scene_Titles < Scene_MenuBase  
  1021.   #--------------------------------------------------------------------------
  1022.   # start
  1023.   #--------------------------------------------------------------------------
  1024.   def start
  1025.     super
  1026.     create_help_window
  1027.     create_command_window
  1028.     create_status_window
  1029.     create_param_window
  1030.     create_item_window
  1031.     relocate_windows
  1032.   end  
  1033.   #--------------------------------------------------------------------------
  1034.   # create_command_window
  1035.   #--------------------------------------------------------------------------
  1036.   def create_command_window
  1037.     wy = @help_window.height
  1038.     @command_window = Window_TitlesCommand.new(0, wy)
  1039.     @command_window.viewport = @viewport
  1040.     @command_window.help_window = @help_window
  1041.     @command_window.actor = @actor
  1042.     @command_window.set_handler(:cancel,   method(:return_scene))
  1043.     @command_window.set_handler(:primary,  method(:command_title_change))
  1044.     process_custom_class_commands
  1045.     return if $game_party.in_battle
  1046.     @command_window.set_handler(:pagedown, method(:next_actor))
  1047.     @command_window.set_handler(:pageup,   method(:prev_actor))
  1048.   end
  1049.   #--------------------------------------------------------------------------
  1050.   # process_custom_class_commands
  1051.   #--------------------------------------------------------------------------
  1052.   def process_custom_class_commands
  1053.     for command in BM::TITLES_SYSTEM::COMMANDS
  1054.       next unless BM::TITLES_SYSTEM::CUSTOM_TITLES_COMMANDS.include?(command[0])
  1055.       called_method = BM::TITLES_SYSTEM::CUSTOM_TITLES_COMMANDS[command[0]][2]
  1056.       @command_window.set_handler(command[0], method(called_method))
  1057.     end
  1058.   end
  1059.   #--------------------------------------------------------------------------
  1060.   # create_status_window
  1061.   #--------------------------------------------------------------------------
  1062.   def create_status_window
  1063.     wy = @help_window.height
  1064.     @status_window = Window_SkillStatus.new(@command_window.width, wy)
  1065.     @status_window.viewport = @viewport
  1066.     @status_window.actor = @actor
  1067.   end  
  1068.   #--------------------------------------------------------------------------
  1069.   # create_param_window
  1070.   #--------------------------------------------------------------------------
  1071.   def create_param_window
  1072.     dx = Graphics.width - (Graphics.width * 2 / 5)
  1073.     dy = @status_window.y + @status_window.height
  1074.     @param_window = Window_TitleParam.new(dx, dy)
  1075.     @param_window.viewport = @viewport
  1076.     @param_window.actor = @actor
  1077.   end  
  1078.   #--------------------------------------------------------------------------
  1079.   # create_item_window
  1080.   #--------------------------------------------------------------------------
  1081.   def create_item_window
  1082.     dy = @status_window.y + @status_window.height
  1083.     @item_window = Window_TitleList.new(0, dy)
  1084.     @item_window.help_window = @help_window
  1085.     @item_window.command_window = @command_window
  1086.     @item_window.status_window = @param_window
  1087.     @item_window.viewport = @viewport
  1088.     @item_window.actor = @actor
  1089.     @command_window.item_window = @item_window
  1090.     @item_window.set_handler(:ok,     method(:on_title_ok))
  1091.     @item_window.set_handler(:cancel, method(:on_title_cancel))
  1092.   end  
  1093.   #--------------------------------------------------------------------------
  1094.   # relocate_windows
  1095.   #--------------------------------------------------------------------------
  1096.   def relocate_windows
  1097.     return unless $imported["YEA-AceMenuEngine"]
  1098.     case Menu.help_window_location
  1099.     when 0 # Top
  1100.       @help_window.y = 0
  1101.       @command_window.y = @help_window.height
  1102.       @param_window.y = @command_window.y + @command_window.height
  1103.     when 1 # Middle
  1104.       @command_window.y = 0
  1105.       @help_window.y = @command_window.height
  1106.       @param_window.y = @help_window.y + @help_window.height
  1107.     else # Bottom
  1108.       @command_window.y = 0
  1109.       @param_window.y = @command_window.height
  1110.       @help_window.y = @param_window.y + @param_window.height
  1111.     end
  1112.     @status_window.y = @command_window.y
  1113.     @item_window.y = @param_window.y
  1114.   end  
  1115.   #--------------------------------------------------------------------------
  1116.   # on_actor_change
  1117.   #--------------------------------------------------------------------------
  1118.   def on_actor_change
  1119.     @command_window.actor = @actor
  1120.     @status_window.actor = @actor
  1121.     @param_window.actor = @actor
  1122.     @item_window.actor = @actor
  1123.     @command_window.activate
  1124.   end
  1125.   #--------------------------------------------------------------------------
  1126.   # command_title_change
  1127.   #--------------------------------------------------------------------------
  1128.   def command_title_change
  1129.     @item_window.activate
  1130.     @item_window.select_last
  1131.   end  
  1132.   #--------------------------------------------------------------------------
  1133.   # on_title_cancel
  1134.   #--------------------------------------------------------------------------
  1135.   def on_title_cancel
  1136.     @item_window.unselect
  1137.     @command_window.activate
  1138.     @param_window.set_temp_actor(nil)
  1139.   end  
  1140.   #--------------------------------------------------------------------------
  1141.   # on_title_ok
  1142.   #--------------------------------------------------------------------------
  1143.   def on_title_ok
  1144.     Sound.play_equip
  1145.     title_id = @item_window.item
  1146.     hp = @actor.hp * 1.0 / @actor.mhp
  1147.     mp = @actor.mp * 1.0 / [@actor.mmp, 1].max
  1148.     case @command_window.current_symbol
  1149.     when :primary
  1150.       @actor.change_title(title_id)
  1151.     else
  1152.       @item_window.activate
  1153.       return
  1154.     end
  1155.     @actor.hp = (@actor.mhp * hp).to_i
  1156.     @actor.mp = (@actor.mmp * mp).to_i
  1157.     @status_window.refresh
  1158.     @item_window.update_titles
  1159.   end
  1160.   #--------------------------------------------------------------------------
  1161.   # command_name1
  1162.   #--------------------------------------------------------------------------
  1163.   def command_name1
  1164.     # Do nothing.
  1165.   end  
  1166.   #--------------------------------------------------------------------------
  1167.   # command_name2
  1168.   #--------------------------------------------------------------------------
  1169.   def command_name2
  1170.     # Do nothing.
  1171.   end
  1172. end
  1173. #==============================================================================
  1174. # ** Scene_Status
  1175. #==============================================================================
  1176. class Scene_Status < Scene_MenuBase
  1177.   #--------------------------------------------------------------------------
  1178.   # new method: command_titles
  1179.   #--------------------------------------------------------------------------
  1180.   def command_titles
  1181.     SceneManager.call(Scene_Titles)
  1182.   end  
  1183. end # Scene_Status
  1184. #==============================================================================
  1185. if $imported["YEA-StatusMenu"]
  1186.   if !YEA::STATUS::CUSTOM_STATUS_COMMANDS.include?(:titles)
  1187.     YEA::STATUS::CUSTOM_STATUS_COMMANDS.merge!(BM::TITLES_SYSTEM::STATUS_COMMANDS)
  1188.   end
  1189. end
  1190. #==============================================================================
  1191. if $imported["YEA-AceMenuEngine"]
  1192.   if !YEA::MENU::CUSTOM_COMMANDS.include?(:titles)
  1193.     YEA::MENU::CUSTOM_COMMANDS.merge!(BM::TITLES_SYSTEM::MENU_COMMANDS)
  1194.   end
  1195. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement