SHARE
TWEET

[VXA] Monster Catalogue 1.1

modern_algebra Feb 4th, 2012 3,776 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #==============================================================================
  2. #    Monster Catalogue
  3. #    Version: 1.1
  4. #    Author: modern algebra (rmrk.net)
  5. #    Date: March 24, 2012
  6. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7. #  Description:
  8. #
  9. #    This script creates a scene that you can call which shows data on any and
  10. #   all monsters you have collected. You can change the exact point at which
  11. #   data will show up. By default, the script will show only ?????? for any
  12. #   monsters not yet fought, but once they are first encountered by the player
  13. #   then the monster's name, battler, and stats will show up. There are options
  14. #   to change that though. For instance, you could make it so that only the
  15. #   monster's name and battler will show up when the monster is encountered,
  16. #   and to show the stats you will need to use a special analyze item, which
  17. #   you can set up in the database by simply putting \analyze in an item or
  18. #   skill's notebox.
  19. #
  20. #    Additionally, you can give the enemies species and use different
  21. #   categories to separate them.
  22. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  23. #  Instructions:
  24. #
  25. #    Paste this script into its own slot in the Script Editor, above Main but
  26. #   below Materials.
  27. #
  28. #    This script can be mostly plug & play, but there are a few configuration
  29. #   options worth playing around with and a bunch of totally useless
  30. #   configuration options I added in a fit of paranoia.
  31. #
  32. #    The most important options are from lines 102-263, and I explain what
  33. #   each option does in a comment directly preceding it, so I will ask you to
  34. #   look through that section in detail.
  35. #``````````````````````````````````````````````````````````````````````````````
  36. #  Notetags for Enemies:
  37. #
  38. #    \desc{description of the monster} - This allows you to give each monster
  39. #       a description which will appear in the bottom window in the Monster
  40. #       Catalogue scene. You can use \N to go to the next line, and you can
  41. #       also use any normal message codes like \c[n], \v[n], etc... If you do
  42. #       not want to give monsters descriptions, you can turn the window off by
  43. #       changing the value of :desc_window_lines to 0 at line 270.
  44. #
  45. #    \species[id] - This allows you to give each enemy a species, which will be
  46. #      shown by its icon and text directly below the monster's name in the data
  47. #      window. You set up the species in the :species array at line 187.
  48. #
  49. #    \hide_from_catalogue - This will prevent the monster from ever showing up
  50. #      in the catalogue. It is useful for dummy monsters or, for instance, boss
  51. #      monsters. You can hide or reveal a monster using the following codes in
  52. #      a script call of an event (see lines 84-89 for more detail):
  53. #          hide_monster(id)
  54. #          reveal_monster(id)
  55. #
  56. #    \category[x, y, z] - This allows you to add a monster to categories, which
  57. #      you can then add to your monster catalogue to make navigation easier.
  58. #      See lines 239-250 for more detail.
  59. #
  60. #    \silhouette["filename", hue] - If you are using the silhouette feature,
  61. #      this allows you to set a silhouette graphic to be loaded for a monster,
  62. #      instead of automatically generated (since automatic generation is slow).
  63. #      See lines 224-237 for more details.
  64. #
  65. #    \icon[index] - This lets you set an icon for each monster, which will then
  66. #      be shown to the left of its name in the list.
  67. #``````````````````````````````````````````````````````````````````````````````
  68. #  Notetags for Items and Skills:
  69. #
  70. #    \analyze - This will identify an item or skill as an analyzing item or
  71. #      skill, which means that when it is used, a data window on the enemy will
  72. #      be shown in battle, and further, that enemy will be considered analyzed.
  73. #      You can use analyze status as a criterion for showing data, etc. in the
  74. #      regular catalogue as well. See lines 104-140.
  75. #``````````````````````````````````````````````````````````````````````````````
  76. #  Script Calls in Events:
  77. #
  78. #    encounter_monster(id)
  79. #      This will manually set a monster as encountered. See lines 104-140.
  80. #
  81. #    analyze_monster(id)
  82. #      This will manually set a monster as analyzed. See lines 104-140.
  83. #
  84. #    hide_monster(id)
  85. #      This will set it so the identified monster will not show up in the
  86. #     catalogue under any conditions
  87. #
  88. #    reveal_monster(id)
  89. #      This will set it so the identified monster is no longer hidden
  90. #
  91. #    call_monster_catalogue
  92. #      This will call the Monster Catalogue scene.
  93. #==============================================================================
  94.  
  95. $imported ||= {}
  96. $imported[:MA_MonsterCatalogue] = true
  97.  
  98. MAMC_CONFIG = {
  99.   #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  100.   #  BEGIN Editable Region
  101.   #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  102.   #  Useful Options
  103.   #````````````````````````````````````````````````````````````````````````````
  104.   #  The first four options all have this in common - they can be set to one of
  105.   # the following values:
  106.   #    :always    - The value to be shown will always be shown
  107.   #    :encounter - The value to be shown will be shown once the monster has
  108.   #                been encountered. You can either manually encounter an enemy
  109.   #                through a call script, or it will automatically happen the
  110.   #                first time the party fights that kind of enemy.
  111.   #    :analyze   - The value to be shown will be shown once the monster has
  112.   #                been analyzed. You can set either manually analyze an enemy
  113.   #                through a call script, or you can do it by setting items and
  114.   #                skills to be \analyze items that, when used, will analyze
  115.   #                a monster and show data on it. By default, I do not use this
  116.   #                option for anything.
  117.   #````````````````````````````````````````````````````````````````````````````
  118.   # :show_entry_when - When does the monster show up in the catalogue? Note
  119.   #    that hidden enemies will never show up, regardless of your choice here,
  120.   #    and also note that unless either the battler or data are to be shown,
  121.   #    the name of the monster will not be shown even if it is present.
  122.   :show_entry_when => :always,      
  123.   # :show_battler_when - When does the monster's battler show up when looking
  124.   #    at that enemy in the catalogue? Note that if the data is shown, the
  125.   #    battler will automatically be shown anyway.
  126.   :show_battler_when => :encounter,
  127.   # :show_data_when - When does the monster's stats show up when looking at
  128.   #    that enemy in the catalogue?
  129.   :show_data_when => :encounter,
  130.   # :complete_when - This feature is only useful if you are tracking completion
  131.   #    and showing it. This tracks when a monster is counted as collected, so
  132.   #    as to show up in the left side of the completion.
  133.   :complete_when => :encounter,
  134.   # :show_completion - This feature allows you to choose whether to track
  135.   #    completion. If set to :none, then it will not show up at all in the
  136.   #    catalogue. If set to :fraction, then it will show up as a fraction like
  137.   #    x/y where x is the amount of monsters you have completed (as per the
  138.   #    :complete_when condition) and y is the total number of monsters in the
  139.   #    category. If set to :percent, it will show up as a percentage - ie. if
  140.   #    you have collected 8 out of 50 monsters, it will show up as 16%
  141.   :show_completion => :fraction,
  142.   # :absent_monster_name - If a monster entry is shown but neither the battler
  143.   #    nor the stats are shown, this replaces the name of the monster. If you
  144.   #    actually still want the name to be shown, then you can put "%s" as the
  145.   #    value.
  146.   :absent_monster_name => "??????",
  147.   # :shown_stats - This determines which stats of a monster are shown when
  148.   #    data is shown for the monster. You also must set the corresponding text
  149.   #    to be shown. Ie. each line must be something like:
  150.   #
  151.   #        :stat => "Label",
  152.   #
  153.   #      :stat must correspond to a method name in Game_Enemy or its
  154.   #    superclasses or inherited modules, or else it will not be shown. Some
  155.   #    valid values for this are: :mhp, :mmp, :atk, :def, :mat, :mdf, :agi,
  156.   #    :luk, :hit, :eva, :cri, :exp, :gold, :cev, :mev, :mrf, :cnt, :hrg, :mrg,
  157.   #    :trg, :tgr, :grd, :rec, :pha, :mcr, :tcr, :pdr, :mdr, :fdr, and :exr.
  158.   #
  159.   #      "Label" is the text to be drawn. Note that if the "Label" is a String,
  160.   #    then that word will be drawn. However, if you make :"Label" a symbol by
  161.   #    putting a colon before the quotation marks, then the text shown will be
  162.   #    the result of evaluationg "Label". This is useful since it allows you
  163.   #    to use terms in Vocab, meaning it will change depending on what you put
  164.   #    in the database and you don't have to change it again here.
  165.   #
  166.   #   EXAMPLE Lines:
  167.   #    where the Enemy's Attack is 45, the enemy's hit rate is 95, and the name
  168.   #    of the Attack parameter set in Terms is ATK.
  169.   #      :atk => :"Vocab.param(2)",
  170.   #        shows up as:      ATK          45
  171.   #      :atk => "DMG",
  172.   #        shows up as:      DMG          45
  173.   #      :hit => "HIT",
  174.   #        shows up as:      HIT          95%
  175.   :shown_stats => { # <= Do not touch
  176.     :mhp  => :"Vocab.hp",
  177.     :mmp  => :"Vocab.mp",
  178.     :atk  => :"Vocab.param(2)",
  179.     :def  => :"Vocab.param(3)",
  180.     :mat  => :"Vocab.param(4)",
  181.     :mdf  => :"Vocab.param(5)",
  182.     :agi  => :"Vocab.param(6)",
  183.     :luk  => :"Vocab.param(7)",
  184.   }, # <= Do not touch
  185.   # :stats_label - This is the label placed just above the Stats section.
  186.   :stats_label => "Stats",
  187.   # :species - This allows you to give monsters species, and the icon and name
  188.   #    of the species will show up underneath its name once data is revealed.
  189.   #    Each line must be in the format:
  190.   #
  191.   #        [icon_index, "name"],
  192.   #
  193.   #      icon_index is the Integer index of the icon you want to use
  194.   #      "name" is a String and is the name of the species.
  195.   #
  196.   #    Then, to assign a species to an Enemy, all you need to do is put the
  197.   #    following code in its notebox:
  198.   #
  199.   #        \species_id[n]
  200.   #
  201.   #      n is the ID of the species, which is its place in the following array.
  202.   #        Note that 0 is not used - it starts at 1.
  203.   :species => [
  204.     [335, "Monster"],     # ID: 1 - Monster
  205.     [291, "Beast"],       # ID: 2 - Beast
  206.     [339, "Undead"],      # ID: 3 - Undead
  207.     [121, "Human"],       # ID: 4 - Human
  208.   ],
  209.   # :menu_access - This value determines whether the Bestiary is accessible
  210.   #    from a command in the menu. If true, then it is. If false, it isn't.
  211.   :menu_access => true,
  212.   # :menu_index - If :menu_access is true, then this value determines where in
  213.   #    the menu command window it is inserted.
  214.   :menu_index => 4,
  215.   # :menu_label - If :menu_access is true, then this value determines the name
  216.   #    of the command in the menu
  217.   :menu_label => "Monster Catalogue",
  218.   # :map_access - This value determines whether the catalogue is accessible by
  219.   #    pressing a button in the map. If true, then it is. If false, it isn't.
  220.   :map_access => false,
  221.   #  :map_button - If :map_access is true, then this is the button that needs
  222.   #    to be pressed in order to open the catalogue from the map.
  223.   :map_button => :R,
  224.   # :silhouette - This value determines whether, if the battler is not yet
  225.   #    shown for a monster in the catalogue, it should show a silhouette. The
  226.   #    silhouette can be automatically generated, but that is a time-consuming
  227.   #    process, especially for larger battlers. Lag may be experienced. If you
  228.   #    do want this feature on, however, then there is an option to have the
  229.   #    silhouette graphic be loaded directly from the Battlers folder by
  230.   #    placing the following code in an Enemy's notebox:
  231.   #
  232.   #      \silhouette["Filename", hue]
  233.   #
  234.   #        "Filename" is the filename of the Graphic in Battlers to be loaded
  235.   #        hue is an integer between 0 and 360 and setss the graphic's hue
  236.   #
  237.   #    That can be especially useful to avoid lag with larger battlers.
  238.   :silhouette => false,
  239.   # :categories - This lets you create categories of monsters, and the setup is
  240.   #    identical to :species (see line 191). The first entry in the array must
  241.   #    be the "All" category; it includes every monster and the ID for it is 0.
  242.   #    However, the next ones can be whatever you want. To add an enemy to a
  243.   #    category, you just need to put the following code into its notebox:
  244.   #
  245.   #      \category[x]
  246.   #  
  247.   #    Where x is the ID of the category you want to put it in. One monster can
  248.   #    be in as many categories as you want, so you can put more in, like this:
  249.   #
  250.   #      \category[x, y, z]
  251.   :categories => [
  252.     [334, "Monster Catalogue"],  # ID: 0 - All Enemies
  253.   ],
  254.   # :shown_categories - This is the order of the categories in the catalogue.
  255.   #    It must be an array of the IDs of the above set categories. If you only
  256.   #    put in one number, then the category window won't be shown in the
  257.   #    catalogue and it will just always show the specified category.
  258.   :shown_categories => [0],
  259.   # :hide_category_cursor - If you are using the categories feature, then this
  260.   #    value determines whether a cursor should be shown in that window or
  261.   #    whether it should just rely on the fact that only the icon of the
  262.   #    selected category is enabled.
  263.   :hide_category_cursor => true,
  264.   #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  265.   #  Superfluous options
  266.   #````````````````````````````````````````````````````````````````````````````
  267.   # :list_window_width - This allows you to set, in pixels, the width of the
  268.   #    window which lists the monsters in the catalogue.
  269.   :list_window_width => 216,
  270.   # :desc_window_lines - This allows you to choose how many lines will fit in
  271.   #    the help window. If set to 0, there will be no help window to show
  272.   #    description.
  273.   :desc_window_lines => 2,
  274.   # :sort_by - This allows you to choose how the monsters are sorted in the
  275.   #    list. It can only be one of the following options:
  276.   #      :id - The monsters will be ordered from the smallest ID to the largest
  277.   #      :alphabet - The monsters will be in alphabetical order
  278.   #      :encounter - The monsters will be in the order they were encountered
  279.   :sort_by => :id,
  280.   # :number_by - This option allows you to number the monsters in the list. It
  281.   #    can be one of three options:
  282.   #      :none - The monsters will not be numbered
  283.   #      :id - The monsters will be numbered by their ID
  284.   #      :index - The monsters will be numbered by the order they are in
  285.   :number_by => :id,
  286.   # :number_format - If :number_by is not :none, then this is the format the
  287.   #    number will show up in. %d is where the number will show up, so "%d. "
  288.   #    will show up as:
  289.   #      1. name
  290.   #      2. name (etc.)
  291.   #    while something like "(%d) " would show up as:
  292.   #      (1) name
  293.   #      (2) name (etc.)
  294.   :number_format => "%d. ",
  295.   # :frame_width - The width, in pixels of the frame for the monster data.
  296.   :frame_width => 2,
  297.   # :battler_opacity - The opacity of the battler when drawn
  298.   :battler_opacity => 255,
  299.   # :battler_opacity_under_stats - Some large battlers extend over the stats
  300.   #    region of the window. This sets the opacity for that section of the
  301.   #    battler.
  302.   :battler_opacity_under_stats => 128,
  303.   # :windowskin - This sets the windowskin to be used in the Monster Catalogue
  304.   #    scene. It must be a graphic in the System folder of Graphics. If set to
  305.   #    false, it will use whatever windowskin is default.
  306.   :windowskin => false,
  307.   # :font_name - The font to be used in the Monster Catalogue scene. It can
  308.   #    be either a String, an Array, or false. If false, it will use the
  309.   #    default font. If a String, it will use that font. If an array, it will
  310.   #    use the first font in the array that the player has installed.
  311.   :font_name => false,
  312.   # :show_monster_icon - This feature allows you to set it so that an icon is
  313.   #    shown to the left of each monster's name in the list. To set what icon
  314.   #    will show, you would use the following code in a notebox of an Enemy:
  315.   #
  316.   #      \icon[index]
  317.   #
  318.   #    where index is the index of the icon you want to use.
  319.   :show_monster_icon => false,
  320.   # :inherit_species_icon - If :show_monster_icon is on, then you can turn this
  321.   #    value to true and, if you do not directly set an icon for a monster,
  322.   #    then it will use the icon for its species.
  323.   :inherit_species_icon => false,
  324.   #````````````````````````````````````````````````````````````````````````````
  325.   # Colours - the next seven options all set colours for various things. They
  326.   #   can accept the following values:
  327.   #     Integer - if an integer, then it will choose the colour from the
  328.   #       windowskin palette.
  329.   #     Array - if an array, it must have between three and four entries and
  330.   #       the first three will be the rgb values and the last is optional and
  331.   #       it will be the alpha (opacity).
  332.   #     Symbol - if a symbol, then the colour chosen will be the result of
  333.   #       calling that method.
  334.   #````````````````````````````````````````````````````````````````````````````
  335.   # :system_colour - This allows you to change the colour of all of the labels
  336.   #    and other text that are drawn in the system color.
  337.   :system_colour => :system_color,
  338.   # :normal_colour - This allows you to change the colour of all of the values
  339.   #    and other text that are drawn in the normal color.
  340.   :normal_colour => :normal_color,
  341.   # :frame_colour - This allows you to select the colour of the frame
  342.   :frame_colour => :system_color,
  343.   # :frame_shadow_colour - This allows you to select the colour of the frame's
  344.   #    shadow.
  345.   :frame_shadow_colour => [0, 0, 0, 128],
  346.   # :species_colour - This allows you to select the colour for the species name
  347.   :species_colour => 8,
  348.   # :silhouette_colour - This allows you to select the colour of the silhouette
  349.   #    if you are using that feature and automatically generating them.
  350.   :silhouette_colour => [0, 0, 0],
  351.   # :complete_colour - This allows you to select the colour the completion stat
  352.   #    is drawn in when all monsters in a category are collected.
  353.   :complete_colour => 3,
  354.   #````````````````````````````````````````````````````````````````````````````
  355.   # :completion_label - This must be a string. If it is empty, then the
  356.   #    completion stat will simply be drawn centred. If the string isn't empty,
  357.   #    then this text will be drawn on the left in system_color and the
  358.   #    completion stat will be aligned to the right.
  359.   :completion_label => "",
  360.   # :percent_format - If showing the completion stat in fraction format, this
  361.   #    allows you to choose how it shows up. The first %d will be replaced by
  362.   #    the number completed and the second %d will be replaced by the total
  363.   #    number of monsters in the category
  364.   :fraction_format => "%d/%d",
  365.   # :percent_format - If showing the completion stat in percent format, this
  366.   #    allows you to choose how it shows up. The %.1f will be replaced by the
  367.   #    completion percentage to 1 decimal place. %% will be replaced by %
  368.   :percent_format => "%.1f%%",
  369.   #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  370.   # END Editable Region
  371.   #////////////////////////////////////////////////////////////////////////////
  372. }
  373.  
  374. MAMC_CONFIG[:categories] = [[334, "Monster Catalogue"]] if MAMC_CONFIG[:categories].nil? || MAMC_CONFIG[:categories].empty?
  375. MAMC_CONFIG[:shown_categories].reject! { |n| MAMC_CONFIG[:categories][n] == nil }
  376. MAMC_CONFIG[:shown_categories] = [0] if MAMC_CONFIG[:shown_categories].empty?
  377.  
  378. #==============================================================================
  379. # ** RPG::UsableItem
  380. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  381. #  Summary of Changes:
  382. #    new method - mamc_analyze?
  383. #==============================================================================
  384.  
  385. class RPG::UsableItem
  386.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  387.   # * Analyze Item
  388.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  389.   def mamc_analyze?
  390.     @mamc_analyze = !self.note[/\\ANALYZE/i].nil? if !@mamc_analyze
  391.     @mamc_analyze
  392.   end
  393. end
  394.  
  395. #==============================================================================
  396. # ** RPG::Enemy
  397. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  398. #  Summary of Changes:
  399. #    new method - description; icon_index; species_id; category_ids;
  400. #      silhouette_battler; mamc_hide?
  401. #==============================================================================
  402.  
  403. class RPG::Enemy
  404.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  405.   # * Description
  406.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  407.   def description(*args, &block)
  408.     if !@mamc_description
  409.       @mamc_description = super(*args, &block)
  410.       if note[/\\(DESCRIPTION|DESC)\{(.+?)\}/im]
  411.         @mamc_description = $2
  412.         @mamc_description.gsub!(/[\r\n]/, "")
  413.         @mamc_description.gsub!(/\\[Nn]/, "\n")
  414.       end
  415.       @mamc_description = "" unless @mamc_description.is_a?(String)
  416.     end
  417.     @mamc_description
  418.   end
  419.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  420.   # * Icon Index
  421.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  422.   def icon_index(*args, &block)
  423.     if !@mamc_icon_index
  424.       @mamc_icon_index = super(*args, &block)
  425.       if note[/\\ICON\[\s*(\d+)\s*\]/i]
  426.         @mamc_icon_index = $1.to_i
  427.       elsif MAMC_CONFIG[:inherit_species_icon]
  428.         # Species Icon
  429.         @mamc_icon_index = MAMC_CONFIG[:species][species_id - 1][0]
  430.       end
  431.       @mamc_icon_index = 0 unless @mamc_icon_index.is_a?(Integer)
  432.     end
  433.     @mamc_icon_index
  434.   end
  435.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  436.   # * Species ID
  437.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  438.   def species_id
  439.     if !@mamc_species_id
  440.       @mamc_species_id = (self.note[/\\SPECIES\[\s*(\d+)\s*\]/i] ? $1.to_i : 0)
  441.     end
  442.     @mamc_species_id
  443.   end
  444.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  445.   # * Category IDs
  446.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  447.   def category_ids
  448.     if !@mamc_category_ids
  449.       @mamc_category_ids = [0]
  450.       if self.note[/\\CATEGOR(Y|IES)\[(.+?)\]/i] != nil
  451.         @mamc_category_ids |= $2.scan(/\d+/).collect { |id| id.to_i }
  452.       end
  453.     end
  454.     @mamc_category_ids
  455.   end
  456.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  457.   # * Hide?
  458.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  459.   def mamc_hide?
  460.     @mamc_hide = !self.note[/\\HIDE_FROM_CATALOG/i].nil? if !@mamc_hide
  461.     @mamc_hide
  462.   end
  463.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  464.   # * Silhouette Battler
  465.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  466.   def silhouette_battler
  467.     if !@mamc_silhouette_battler
  468.       @mamc_silhouette_battler = []
  469.       if self.note[/\\SILHOUETTE\[\s*["'](.+?)["'][,;:\s]*H?(\d*)\s*\]/i]
  470.        @mamc_silhouette_battler.push($2.to_i)
  471.        @mamc_silhouette_battler.unshift($1.gsub(/[\r\n]/, ""))
  472.      end
  473.    end
  474.    @mamc_silhouette_battler
  475.  end
  476. end
  477.  
  478. #==============================================================================
  479. # ** Game_System
  480. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  481. #  Summary of Changes:
  482. #    new methods - mamc_encounter_ary; mamc_analyze_ary; mamc_hide_ary;
  483. #      mamc_encounter_monster; mamc_analyze_monster; mamc_data_conditions_met?
  484. #==============================================================================
  485.  
  486. class Game_System
  487.  [:encounter, :analyze].each { |method|
  488.    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  489.    # * Encounter/Analyze Array
  490.    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  491.    define_method(:"mamc_#{method}_ary") do
  492.      instance_variable_set(:"@mamc_#{method}_ary", []) if instance_variable_get(:"@mamc_#{method}_ary").nil?
  493.      instance_variable_get(:"@mamc_#{method}_ary")
  494.    end
  495.    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  496.    # * Encounter/Analyze Monster
  497.    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  498.    define_method(:"mamc_#{method}_monster") do |*args|
  499.      ary = send(:"mamc_#{method}_ary")
  500.      instance_variable_set(:"@mamc_#{method}_ary", ary | args)
  501.    end
  502.  }
  503.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  504.  # * Hidden Array
  505.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  506.  def mamc_hide_ary
  507.    if !@mamc_hide_ary
  508.      @mamc_hide_ary = []
  509.      $data_enemies.compact.each { |enemy| @mamc_hide_ary.push(enemy.id) if enemy.mamc_hide? }
  510.    end
  511.    @mamc_hide_ary
  512.  end
  513.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  514.  # * Data Conditions Met?
  515.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  516.  def mamc_data_conditions_met?(condition, monster_id = 0)
  517.    return case condition
  518.    when :always then true
  519.    when :encounter then mamc_encounter_ary.include?(monster_id)
  520.    when :analyze then mamc_analyze_ary.include?(monster_id)
  521.    else
  522.      false
  523.    end
  524.  end
  525. end
  526.  
  527. #==============================================================================
  528. # ** Game_Enemy
  529. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  530. #  Summary of Changes:
  531. #    new public instance variable - mamc_analyze_now
  532. #    aliased method - on_battle_start; item_user_effect
  533. #==============================================================================
  534.  
  535. class Game_Enemy
  536.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  537.  # * Public Instance Variables
  538.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  539.  attr_accessor :mamc_analyze_now
  540.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  541.  # * Die/Transform
  542.  #``````````````````````````````````````````````````````````````````````````
  543.  # Add to encounter array whenever the enemy dies or is transformed
  544.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  545.  [:die, :transform].each { |meth|
  546.    alias_method(:"mamc_enem#{meth}_2aw1", meth)
  547.    define_method(meth) do |*args|
  548.      $game_system.mamc_encounter_monster(enemy.id) if exist? && enemy
  549.      send(:"mamc_enem#{meth}_2aw1", *args)
  550.    end
  551.  }
  552.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  553.  # * Item User Effect
  554.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  555.  alias mamc_itmusreffect_2dw9 item_user_effect
  556.  def item_user_effect(user, item, *args, &block)
  557.    mamc_itmusreffect_2dw9(user, item, *args, &block)
  558.    if item.mamc_analyze?
  559.      $game_system.mamc_analyze_monster(enemy.id)
  560.      @mamc_analyze_now = true
  561.      @result.success = true
  562.    end
  563.  end
  564. end
  565.  
  566. #==============================================================================
  567. # ** Game_Interpreter
  568. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  569. #  Summary of Changes:
  570. #    new methods - encounter_monster; analyze_monster; hide_monster;
  571. #      reveal_monster; call_monster_catalogue
  572. #==============================================================================
  573.  
  574. class Game_Interpreter
  575.  [:encounter, :analyze].each { |method|
  576.    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  577.    # * Encounter/Analyze Monster
  578.    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  579.    define_method(:"#{method}_monster") do |*args|
  580.      $game_system.send(:"mamc_#{method}_monster", *args)
  581.    end
  582.  }
  583.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  584.  # * Hide/Reveal Monster
  585.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  586.  def hide_monster(monster_id)
  587.    $game_system.mamc_hide_ary.push(monster_id) unless $game_system.mamc_hide_ary.include?(monster_id)
  588.  end
  589.  def reveal_monster(monster_id)
  590.    $game_system.mamc_hide_ary.delete(monster_id)
  591.  end
  592.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  593.  # * Call Monster Catalogue
  594.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  595.  def call_monster_catalogue
  596.    return if $game_party.in_battle
  597.    SceneManager.call(Scene_MonsterCatalogue)
  598.    Fiber.yield
  599.  end
  600. end
  601.  
  602. #==============================================================================
  603. # *** MAMC_WindowAdditions
  604. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  605. #  This module adds a few methods to MAMC windows
  606. #==============================================================================
  607.  
  608. module MAMC_WindowAdditions
  609.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  610.  # * Object Initialization
  611.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  612.  def initialize(*args, &block)
  613.    super(*args, &block)
  614.    self.windowskin = Cache.system(MAMC_CONFIG[:windowskin]) if MAMC_CONFIG[:windowskin]
  615.  end
  616.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  617.  # * Reset Font Settings / Create Contents
  618.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  619.  [:reset_font_settings, :create_contents].each { |method|
  620.    define_method(method) do |*args|
  621.      super(*args)
  622.      contents.font.name = MAMC_CONFIG[:font_name] if MAMC_CONFIG[:font_name]
  623.    end
  624.  }
  625.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  626.  # * MA Text Color
  627.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  628.  def text_color(param)
  629.    begin
  630.      colour = case param
  631.      when Integer then super(param) rescue normal_color
  632.      when Symbol then send(param) rescue normal_color
  633.      when Array then Color.new(*param) rescue normal_color
  634.      else
  635.        normal_color
  636.      end
  637.    end
  638.    colour.is_a?(Color) ? colour : normal_color
  639.  end
  640.  def normal_color
  641.    c = MAMC_CONFIG[:normal_colour]
  642.    c == :normal_color ? super : text_color(c)
  643.  end
  644.  def system_color
  645.    c = MAMC_CONFIG[:system_colour]
  646.    c == :system_color ? super : text_color(c)
  647.  end
  648. end
  649.  
  650. #==============================================================================
  651. # ** Window_MonsterCategory
  652. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  653. #  This window is a horizontal command window using icons to represent species
  654. #==============================================================================
  655.  
  656. class Window_MonsterCategory < Window_HorzCommand
  657.  include MAMC_WindowAdditions
  658.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  659.  # * Public Instance Variable
  660.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  661.  attr_reader :monsterlist_window
  662.  attr_reader :label_window
  663.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  664.  # * Window Width
  665.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  666.  def window_width
  667.    MAMC_CONFIG[:list_window_width]
  668.  end
  669.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  670.  # * Column Max
  671.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  672.  def col_max
  673.    [(width - standard_padding) / (24 + spacing), item_max].min
  674.  end
  675.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  676.  # * Current Item Enabled?
  677.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  678.  def current_item_enabled?
  679.    !current_data.nil?
  680.  end
  681.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  682.  # * Make Command List
  683.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  684.  def make_command_list
  685.    MAMC_CONFIG[:shown_categories].each { |cat|
  686.      ary = MAMC_CONFIG[:categories][cat]
  687.      add_command(ary[1], :"#{cat}", false, ary[0])
  688.    }
  689.  end
  690.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  691.  # * Draw Item
  692.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  693.  def draw_item(index)
  694.    rect = item_rect(index)
  695.    contents.clear_rect(rect)
  696.    draw_icon(@list[index][:ext], rect.x + ((rect.width - 24) / 2), rect.y, enable?(index))
  697.  end
  698.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  699.  # * Enabled?
  700.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  701.  def enable?(index)
  702.    self.index == index
  703.  end
  704.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  705.  # * Set Index
  706.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  707.  def index=(index)
  708.    old_index = self.index
  709.    super(index)
  710.    draw_item(old_index)
  711.    draw_item(self.index)
  712.  end
  713.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  714.  # * Frame Update
  715.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  716.  def update
  717.    super
  718.    @monsterlist_window.category = MAMC_CONFIG[:shown_categories][index] if @monsterlist_window
  719.    @label_window.category = MAMC_CONFIG[:shown_categories][index] if @label_window
  720.  end
  721.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  722.  # * Set Monster Window
  723.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  724.  def monsterlist_window=(monsterlist_window)
  725.    @monsterlist_window = monsterlist_window
  726.    update
  727.  end
  728.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  729.  # * Set Monster Window
  730.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  731.  def label_window=(label_window)
  732.    @label_window = label_window
  733.    update
  734.  end
  735.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  736.  # * Update Cursor
  737.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  738.  def update_cursor
  739.    super
  740.    cursor_rect.empty if MAMC_CONFIG[:hide_category_cursor]
  741.  end
  742. end
  743.  
  744. #==============================================================================
  745. # ** Window_MonsterCategoryLabel
  746. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  747. #  This window shows the name of the species
  748. #==============================================================================
  749.  
  750. class Window_MonsterCategoryLabel < Window_Base
  751.  include MAMC_WindowAdditions
  752.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  753.  # * Object Initialization
  754.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  755.  def initialize(x, y)
  756.    super(x, y, window_width, window_height)
  757.  end
  758.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  759.  # * Refresh
  760.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  761.  def refresh(category_id = @category)
  762.    contents.clear
  763.    change_color(system_color)
  764.    contents.font.bold = true
  765.    draw_text(0, 0, contents_width, line_height, MAMC_CONFIG[:categories][category_id][1], 1)
  766.    contents.font.bold = false
  767.    draw_completion(0, line_height) unless MAMC_CONFIG[:show_completion] == :none
  768.  end
  769.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  770.  # * Draw Completion
  771.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  772.  def draw_completion(x, y)
  773.    if !MAMC_CONFIG[:completion_label].empty?
  774.      change_color(system_color)
  775.      draw_text(x, y, contents_width, line_height, MAMC_CONFIG[:completion_label])
  776.      align = 2
  777.    else
  778.      align = 1
  779.    end
  780.    a, b = get_completion
  781.    colour = a == b ? text_color(MAMC_CONFIG[:complete_colour]) : normal_color
  782.    change_color(colour)
  783.    draw_text(x, y, contents_width, line_height, completion_to_s(a, b), align)
  784.  end
  785.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  786.  # * Get Completion
  787.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  788.  def get_completion
  789.    a, b = 0, 0
  790.    $data_enemies.compact.each { |enemy|
  791.      if enemy.category_ids.include?(@category) && !$game_system.mamc_hide_ary.include?(enemy.id)
  792.        b += 1
  793.        a += 1 if $game_system.mamc_data_conditions_met?(MAMC_CONFIG[:complete_when], enemy.id)
  794.      end
  795.    }
  796.    return a, b
  797.  end
  798.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  799.  # * Completion String
  800.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  801.  def completion_to_s(x, y)
  802.    return "" if y == 0
  803.    case MAMC_CONFIG[:show_completion]
  804.    when :fraction then sprintf(MAMC_CONFIG[:fraction_format], x, y)
  805.    when :percent then sprintf(MAMC_CONFIG[:percent_format], (x.to_f / y)*100)
  806.    else
  807.      ""
  808.    end
  809.  end
  810.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  811.  # * Set Category
  812.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  813.  def category=(category)
  814.    return if @category == category
  815.    @category = category
  816.    refresh
  817.  end
  818.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  819.  # * Window Width
  820.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  821.  def window_width
  822.    MAMC_CONFIG[:list_window_width]
  823.  end
  824.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  825.  # * Window Height
  826.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  827.  def window_height
  828.    hght = (standard_padding*2) + line_height
  829.    hght += line_height unless MAMC_CONFIG[:show_completion] == :none
  830.    hght
  831.  end
  832. end
  833.  
  834. #==============================================================================
  835. # ** Window_MonsterList
  836. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  837. #  This window shows all monsters in a selected category.
  838. #==============================================================================
  839.  
  840. class Window_MonsterList < Window_Selectable
  841.  include MAMC_WindowAdditions
  842.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  843.  # * Object Initialization
  844.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  845.  def initialize(x, y, width, height)
  846.    super
  847.    @data = []
  848.    self.index = 0
  849.    activate
  850.  end
  851.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  852.  # * Set Category
  853.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  854.  def category=(category)
  855.    return if @category == category
  856.    @category = category
  857.    refresh
  858.    self.index = 0
  859.    self.oy = 0
  860.  end
  861.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  862.  # * Column Max
  863.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  864.  def col_max
  865.    1
  866.  end
  867.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  868.  # * Item Maximum
  869.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  870.  def item_max
  871.    @data ? @data.size : 1
  872.  end
  873.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  874.  # * Get monster
  875.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  876.  def item
  877.    @data && index >= 0 ? @data[index] : nil
  878.  end
  879.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  880.  # * Current Item Enabled?
  881.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  882.  def current_item_enabled?
  883.    enable?(@data[index])
  884.  end
  885.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  886.  # * Whether to include an item in Data
  887.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  888.  def include?(item)
  889.    return false unless item != nil && item.category_ids.include?(@category)
  890.    return false if $game_system.mamc_hide_ary.include?(item.id)
  891.    $game_system.mamc_data_conditions_met?(MAMC_CONFIG[:show_entry_when], item.id)
  892.  end
  893.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  894.  # * Whether it should be drawn enabled
  895.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  896.  def enable?(item)
  897.    return false if item.nil?
  898.    $game_system.mamc_data_conditions_met?(MAMC_CONFIG[:show_battler_when], item.id) ||
  899.      $game_system.mamc_data_conditions_met?(MAMC_CONFIG[:show_data_when], item.id)
  900.  end
  901.  alias show_name? enable?  
  902.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  903.  # * Make Item List
  904.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  905.  def make_item_list
  906.    @data = $data_enemies.select {|item| include?(item) }
  907.    case MAMC_CONFIG[:sort_by]
  908.    when :alphabet
  909.      @data.sort! { |a, b| a.name <=> b.name }
  910.    when :encounter
  911.      encounter_order = $game_system.mamc_encounter_ary.reverse
  912.      encounter_order.each { |id|
  913.        a = @data.delete($data_enemies[id])
  914.        @data.unshift($data_enemies[id]) if a != nil
  915.      }
  916.    end
  917.  end
  918.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  919.  # * Draw Item
  920.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  921.  def draw_item(index)
  922.    item = @data[index]
  923.    if item
  924.      rect = item_rect_for_text(index)
  925.      enable = enable?(item)
  926.      change_color(normal_color, enable)
  927.      draw_number(index, rect) unless !MAMC_CONFIG[:number_by] || MAMC_CONFIG[:number_by] == :none
  928.      if show_name?(item)
  929.        if MAMC_CONFIG[:show_monster_icon]
  930.          draw_item_name(item, rect.x, rect.y, enable, rect.width)
  931.        else
  932.          draw_text(rect, item.name)
  933.        end
  934.      else
  935.        if MAMC_CONFIG[:show_monster_icon]
  936.          rect.x += 24
  937.          rect.width -= 24
  938.        end
  939.        draw_text(rect, sprintf(MAMC_CONFIG[:absent_monster_name], item.name))
  940.      end
  941.    end
  942.  end
  943.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  944.  # * Draw Number
  945.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  946.  def draw_number(index, rect)
  947.    num = case MAMC_CONFIG[:number_by]
  948.    when :id then @data[index].id
  949.    when :index then index + 1
  950.    end
  951.    string = sprintf(MAMC_CONFIG[:number_format], num)
  952.    tw = contents.text_size(string).width
  953.    draw_text(rect, string)
  954.    rect.x += tw
  955.    rect.width -= tw
  956.  end
  957.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  958.  # * Refresh
  959.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  960.  def refresh
  961.    make_item_list
  962.    create_contents
  963.    draw_all_items
  964.  end
  965.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  966.  # * Update Help
  967.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  968.  def update_help
  969.    @help_window.monster_id = item ? item.id : 0
  970.  end
  971. end
  972.  
  973. #==============================================================================
  974. # ** Window_MonsterCard
  975. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  976. #  This window shows data on a monster
  977. #==============================================================================
  978.  
  979. class Window_MonsterCard < Window_Selectable
  980.  include MAMC_WindowAdditions
  981.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  982.  # * Public Instance Variables
  983.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  984.  attr_reader :monster_id
  985.  attr_reader :monster
  986.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  987.  # * Object Initialization
  988.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  989.  def initialize(x, y, width, height)
  990.    super(x, y, width, height)
  991.    refresh(0)
  992.  end
  993.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  994.  # * Refresh
  995.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  996.  def refresh(monster_id = @monster_id)
  997.    monster_id = 0 if monster_id == nil
  998.    if monster_id.is_a?(Game_Enemy)
  999.      @monster = monster_id
  1000.      @monster_id = @monster.enemy.id
  1001.    else
  1002.      @monster_id = monster_id
  1003.      @monster = monster_id > 0 ? Game_Enemy.new(0, @monster_id) : nil
  1004.    end
  1005.    contents.clear
  1006.    reset_font_settings
  1007.    w = MAMC_CONFIG[:frame_width]
  1008.    if @monster_id > 0 && (show_battler? || MAMC_CONFIG[:silhouette])
  1009.      draw_battler(1 + w*2, 4 + w*4 + line_height, !show_battler?)
  1010.    end
  1011.    draw_frame
  1012.    draw_stats_label if show_data? && !shown_stats.empty?
  1013.    draw_name(6 + w*2, 2 + w*2) if @monster
  1014.    if show_data?
  1015.      # Draw Species
  1016.      draw_species(6 + w*2, 4 + w*4 + line_height)
  1017.      # Draw Stats
  1018.      draw_stats
  1019.    end
  1020.    update_help
  1021.  end
  1022.  alias monster_id= refresh
  1023.  alias monster= refresh
  1024.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1025.  # * Draw Frame
  1026.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1027.  def draw_frame
  1028.    w = MAMC_CONFIG[:frame_width]
  1029.    wdth = contents_width - 2 - w
  1030.    hght = contents_height - 2 - w
  1031.    draw_basic_frame(1 + w, 1 + w, wdth, hght, text_color(MAMC_CONFIG[:frame_shadow_colour]))
  1032.    draw_basic_frame(1, 1, wdth, hght, text_color(MAMC_CONFIG[:frame_colour]))
  1033.  end
  1034.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1035.  # * Draw Basic Frame
  1036.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1037.  def draw_basic_frame(x, y, width, height, colour)
  1038.    w = MAMC_CONFIG[:frame_width]
  1039.    # Draw Horizontal Lines
  1040.    contents.fill_rect(x, y, width, w, colour)
  1041.    contents.fill_rect(x, y + line_height + (w + 1)*2, width, w, colour)
  1042.    contents.fill_rect(x, y + height - w, width, w, colour)
  1043.    # Draw Vertical Lines
  1044.    contents.fill_rect(x, y, w, height, colour)
  1045.    contents.fill_rect(x + width - w, y, w, height, colour)
  1046.  end
  1047.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1048.  # * Draw Stat Divider
  1049.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1050.  def draw_stat_divider(x, y, width, label_x, tw, colour)
  1051.    w = MAMC_CONFIG[:frame_width]
  1052.    contents.fill_rect(x, y, label_x - x, w, colour)
  1053.    contents.fill_rect(label_x + tw, y, width - ((label_x - x) + tw), w, colour)
  1054.  end
  1055.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1056.  # * Draw Stats Label
  1057.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1058.  def draw_stats_label
  1059.    w = MAMC_CONFIG[:frame_width]
  1060.    contents.font.bold = true
  1061.    stw = text_size(MAMC_CONFIG[:stats_label]).width + 8
  1062.    lx = 34
  1063.    y = stat_y + (line_height / 2)
  1064.    draw_stat_divider(1 + w, y + w, contents_width - 2 - 3*w, lx, stw, text_color(MAMC_CONFIG[:frame_shadow_colour]))
  1065.    draw_stat_divider(1, y, contents_width - 2 - w, lx, stw, text_color(MAMC_CONFIG[:frame_colour]))
  1066.    change_color(text_color(MAMC_CONFIG[:frame_colour]))
  1067.    draw_text(lx, stat_y, stw, line_height, MAMC_CONFIG[:stats_label], 1)
  1068.    reset_font_settings
  1069.  end
  1070.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1071.  # * Draw Monster Battler
  1072.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1073.  def draw_battler(x, y, silhouette = false)
  1074.    bmp = setup_battler_graphic(x, y, silhouette)
  1075.    # Draw in two parts: full opacity and less opacity
  1076.    clear_hght = stat_y + (line_height / 2) - y
  1077.    src_rect = Rect.new(0, 0, bmp.rect.width, [clear_hght, bmp.rect.height].min)
  1078.    contents.blt(x, y, bmp, src_rect, MAMC_CONFIG[:battler_opacity])
  1079.    if bmp.rect.height > clear_hght
  1080.      src_rect.y = clear_hght
  1081.      src_rect.height = bmp.rect.height - clear_hght
  1082.      contents.blt(x, y + clear_hght, bmp, src_rect, MAMC_CONFIG[:battler_opacity_under_stats])
  1083.    end
  1084.    bmp.dispose
  1085.  end
  1086.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1087.  # * Draw Name
  1088.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1089.  def draw_name(x, y)
  1090.    change_color(normal_color)
  1091.    draw_text(x, y, contents_width - 2*x, line_height, monster_name)
  1092.  end
  1093.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1094.  # * Draw Species
  1095.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1096.  def draw_species(x, y)
  1097.    return if monster.enemy.species_id < 1
  1098.    return if MAMC_CONFIG[:species][monster.enemy.species_id - 1].nil?
  1099.    icon_index, species_name = *MAMC_CONFIG[:species][monster.enemy.species_id - 1]
  1100.    draw_icon(icon_index, x, y)
  1101.    change_color(text_color(MAMC_CONFIG[:species_colour]))
  1102.    draw_text(x + 24, y, contents_width - x*2, line_height, species_name)
  1103.  end
  1104.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1105.  # * Draw Stats
  1106.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1107.  def draw_stats
  1108.    x = 6 + MAMC_CONFIG[:frame_width]*2
  1109.    y = stat_y + line_height
  1110.    width = ((contents_width - x*2) / 2) - 8
  1111.    stats = shown_stats
  1112.    for i in 0...stats.size
  1113.      draw_stat(x + ((i % 2)*(width + 16)), y + ((i / 2)*line_height), width, stats[i])
  1114.    end
  1115.  end
  1116.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1117.  # * Draw Stat
  1118.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1119.  def draw_stat(x, y, width, stat)
  1120.    stat_val = stat_value(stat)
  1121.    label = MAMC_CONFIG[:shown_stats][stat]
  1122.    stat_label = label.is_a?(Symbol) ? eval(label.to_s) : label
  1123.    tw = text_size(stat_val).width + 4
  1124.    change_color(system_color)
  1125.    draw_text(x, y, width - tw, line_height, stat_label)
  1126.    change_color(normal_color)
  1127.    draw_text(x, y, width, line_height, stat_val, 2)
  1128.  end
  1129.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1130.  # * Show Data?
  1131.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1132.  def show_data?(monster_id = @monster_id)
  1133.    return false unless monster_id.between?(1, $data_enemies.size - 1)
  1134.    $game_system.mamc_data_conditions_met?(MAMC_CONFIG[:show_data_when], monster_id)
  1135.  end
  1136.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1137.  # * Show Battler and Name?
  1138.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1139.  def show_battler?(monster_id = @monster_id)
  1140.    return false unless monster_id.between?(1, $data_enemies.size - 1)
  1141.    show_data?(monster_id) || $game_system.mamc_data_conditions_met?(MAMC_CONFIG[:show_battler_when], monster_id)
  1142.  end
  1143.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1144.  # * Get Battler Graphic
  1145.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1146.  def setup_battler_graphic(x, y, silhouette = false)
  1147.    bmp = get_battler(silhouette)
  1148.    # Maximum Parameters
  1149.    max_width = contents_width - 2*x
  1150.    max_height = contents_height - y - (1 + MAMC_CONFIG[:frame_width]*2)
  1151.    # Make dummy Bitmap
  1152.    rect = Rect.new(x, y, max_width, max_height)
  1153.    dest_rect, fits = battler_rect(bmp, rect)
  1154.    dummy_bmp = Bitmap.new(max_width, max_height)
  1155.    # Draw Battler
  1156.    if fits
  1157.      dummy_bmp.blt(dest_rect.x, dest_rect.y, bmp, bmp.rect)
  1158.    else
  1159.      src_rect = Rect.new((bmp.rect.width - dest_rect.width) / 2,
  1160.        (bmp.rect.height - dest_rect.height) / 2, dest_rect.width, dest_rect.height)
  1161.      dummy_bmp.blt(dest_rect.x, dest_rect.y, bmp, src_rect)
  1162.    end
  1163.    dummy_bmp
  1164.  end
  1165.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1166.  # * Get Battler
  1167.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1168.  def get_battler(silhouette = false)
  1169.    if silhouette
  1170.      if !monster.enemy.silhouette_battler.empty?
  1171.        begin
  1172.          return Cache.battler(*monster.enemy.silhouette_battler)
  1173.        rescue
  1174.          p "Error: Monster Catalogue\nSilhouette Battler set for Monster #{monster.id}: #{monster.name} does not exist."
  1175.        end
  1176.      end
  1177.      bmp_to_silhouette(Cache.battler(monster.battler_name, monster.battler_hue).dup)
  1178.    else
  1179.      Cache.battler(monster.battler_name, monster.battler_hue)
  1180.    end
  1181.  end
  1182.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1183.  # * Convert Bitmap to Silhouette
  1184.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1185.  def bmp_to_silhouette(bmp)
  1186.    colour = text_color(MAMC_CONFIG[:silhouette_colour])
  1187.    for i in 0...bmp.width
  1188.      for j in 0...bmp.height
  1189.        pa = bmp.get_pixel(i, j).alpha
  1190.        if pa != 0
  1191.          colour.alpha = pa
  1192.          bmp.set_pixel(i, j, colour)
  1193.        end
  1194.      end
  1195.    end
  1196.    bmp
  1197.  end
  1198.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1199.  # * Battler Rect
  1200.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1201.  def battler_rect(bmp, rect)
  1202.    # Get the size
  1203.    dest_rect = bmp.rect.dup
  1204.    # If need to stretch, find the correct proportion
  1205.    fits = dest_rect.width <= rect.width && dest_rect.height <= rect.height
  1206.    if !fits
  1207.      dest_rect.width = rect.width if dest_rect.width > rect.width
  1208.      dest_rect.height = rect.height if dest_rect.height > rect.height
  1209.    end
  1210.    # Centre Battler
  1211.    dest_rect.x = ((rect.width - dest_rect.width) / 2)
  1212.    if dest_rect.height < (stat_y - rect.y - 16)
  1213.      dest_rect.y = ((stat_y - rect.y - dest_rect.height) / 2)
  1214.    elsif dest_rect.height > ((rect.height*3) / 4)
  1215.      dest_rect.y = ((rect.height - dest_rect.height) / 2)
  1216.    else
  1217.      dest_rect.y = 8
  1218.    end
  1219.    return dest_rect, fits
  1220.  end
  1221.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1222.  # * Showable Stats
  1223.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1224.  def shown_stats
  1225.    stats = (monster.nil? || !show_data?) ? [] : MAMC_CONFIG[:shown_stats].keys
  1226.    stats.keep_if { |stat| monster.class.method_defined?(stat) }
  1227.    stats
  1228.  end
  1229.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1230.  # * Monster Name
  1231.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1232.  def monster_name
  1233.    (monster && (show_battler? || show_data?)) ? monster.enemy.name :
  1234.      sprintf(MAMC_CONFIG[:absent_monster_name], monster.enemy.name)
  1235.  end
  1236.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1237.  # * Stat Value
  1238.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1239.  def stat_value(stat)
  1240.    if $imported[:MA_EnemyStatVariance]
  1241.      param_id = [:mhp, :mmp, :atk, :def, :mat, :mdf, :agi, :luk].index(stat)
  1242.      if param_id != nil
  1243.        stat_val = monster.enemy.params[param_id]
  1244.        plus = 0
  1245.        monster.enemy.maesv_add_params.each { |param_var|
  1246.          if param_var[0] == param_id
  1247.            if param_var[2]
  1248.              plus += ((param_var[1].to_f / 100.0)*(stat_val + plus)).to_i
  1249.            else
  1250.              plus += (param_var[1] - 1)
  1251.            end
  1252.          end
  1253.        }
  1254.        return "#{stat_val}-#{stat_val + plus}" if plus > 0
  1255.      end
  1256.    end
  1257.    stat_val = monster.send(stat)
  1258.    stat_val.is_a?(Float) ? "#{(stat_val*100).to_i}%" : stat_val.to_s
  1259.  end
  1260.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1261.  # * Stat Y
  1262.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1263.  def stat_y
  1264.    y = contents_height - (1 + MAMC_CONFIG[:frame_width]*2)
  1265.    y -= (((shown_stats.size + 1) / 2) + 1)*line_height unless shown_stats.empty?
  1266.    y
  1267.  end
  1268.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1269.  # * Update Help
  1270.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1271.  def update_help
  1272.    @help_window.set_item((monster && show_data?) ? monster.enemy : nil) if @help_window
  1273.  end
  1274. end
  1275.  
  1276. #==============================================================================
  1277. # *** MAMC Battle Monster Card
  1278. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1279. #  This module alters a couple of methods in Window_MonsterCard
  1280. #==============================================================================
  1281.  
  1282. module MAMC_BattleMonsterCard
  1283.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1284.  # * Draw Stat
  1285.  #    Change draw_stat method to draw gauge for HP and MP
  1286.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1287.  def draw_stat(x, y, width, stat)
  1288.    case stat
  1289.    when :mhp, :hp then draw_actor_hp(monster, x, y, width)
  1290.    when :mmp, :mp then draw_actor_mp(monster, x, y, width)
  1291.    else
  1292.      super(x, y, width, stat)
  1293.    end
  1294.  end
  1295.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1296.  # * Stat Value
  1297.  #    Change stat_value method to not show range if Enemy Stat Variance
  1298.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1299.  def stat_value(stat)
  1300.    stat_val = monster.send(stat)
  1301.    stat_val.is_a?(Float) ? "#{(stat_val*100).to_i}%" : stat_val.to_s
  1302.  end
  1303. end
  1304.  
  1305. #==============================================================================
  1306. # ** Scene_Battle
  1307. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1308. #  Summary of Changes:
  1309. #    aliased methods - create_all_windows; invoke_item
  1310. #    new method - mamc_analyze_monster; create_monstercard_window;
  1311. #      close_monstercard_window
  1312. #==============================================================================
  1313.  
  1314. class Scene_Battle
  1315.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1316.  # * Create All Windows
  1317.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1318.  alias mamc_createallwindows_2sj5 create_all_windows
  1319.  def create_all_windows(*args, &block)
  1320.    mamc_createallwindows_2sj5(*args, &block) # Call Original Methods
  1321.    create_monstercard_window
  1322.  end
  1323.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1324.  # * Create Monster Card Window
  1325.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1326.  def create_monstercard_window
  1327.    x = (Graphics.width - @status_window.width) / 2
  1328.    @monstercard_window = Window_MonsterCard.new(x, 0, @status_window.width, Graphics.height - @status_window.height)
  1329.    @monstercard_window.z = [@log_window.z + 1, 200].max
  1330.    @monstercard_window.openness = 0
  1331.    # Include the BattleMonsterCard module in the singleton class
  1332.    @monstercard_window.send(:extend, MAMC_BattleMonsterCard)
  1333.    @monstercard_window.set_handler(:cancel, lambda { close_monster_card_window })
  1334.    @monstercard_window.set_handler(:ok, lambda { close_monster_card_window })
  1335.  end
  1336.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1337.  # * Analyze Monster
  1338.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1339.  def mamc_analyze_monster(target)
  1340.    target.mamc_analyze_now = false
  1341.    @monstercard_window.monster = target
  1342.    @monstercard_window.open
  1343.    @monstercard_window.activate
  1344.  end
  1345.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1346.  # * Frame Update
  1347.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1348.  alias mamc_update_3sk9 update
  1349.  def update(*args, &block)
  1350.    if @monstercard_window.active
  1351.      update_basic
  1352.    else
  1353.      $game_troop.members.each { |enemy|
  1354.        if enemy.class.method_defined?(:mamc_analyze_now) && enemy.mamc_analyze_now
  1355.          mamc_analyze_monster(enemy)
  1356.          return
  1357.        end
  1358.      }
  1359.      mamc_update_3sk9(*args, &block) # Call Original Method
  1360.    end
  1361.  end
  1362.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1363.  # * Close Monster Card Window
  1364.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1365.  def close_monster_card_window
  1366.    $imported["YEA-BattleEngine"] ? @monstercard_window.openness = 0 : @monstercard_window.close
  1367.  end
  1368. end
  1369.  
  1370. #==============================================================================
  1371. # ** Scene_Map
  1372. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1373. #  Summary of Changes:
  1374. #    aliased method - update_scene
  1375. #    new methods - update_call_monster_catalogue; call_monster_catalogue
  1376. #==============================================================================
  1377.  
  1378. class Scene_Map
  1379.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1380.  # * Update Scene
  1381.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1382.  alias mamc_updatscen_2wh5 update_scene
  1383.  def update_scene(*args, &block)
  1384.    mamc_updatscen_2wh5(*args, &block)
  1385.    update_call_monster_catalogue unless scene_changing?
  1386.  end
  1387.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1388.  # * Update Call Monster Catalogue
  1389.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1390.  def update_call_monster_catalogue
  1391.    if $game_map.interpreter.running?
  1392.      @monster_catalogue_calling = false
  1393.    else
  1394.      @monster_catalogue_calling ||= Input.trigger?(MAMC_CONFIG[:map_button])
  1395.      call_monster_catalogue if @monster_catalogue_calling && !$game_player.moving?
  1396.    end
  1397.  end
  1398.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1399.  # * Call Monster Catalogue
  1400.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1401.  def call_monster_catalogue
  1402.    @monster_catalogue_calling = false
  1403.    Sound.play_ok
  1404.    SceneManager.call(Scene_MonsterCatalogue)
  1405.  end
  1406. end if MAMC_CONFIG[:map_access]
  1407.  
  1408. # Menu Access
  1409. if !$imported[:MA_InsertCommand] && MAMC_CONFIG[:menu_access]
  1410. # Initialize the Insertion Hash
  1411. MA_COMMAND_INSERTS = {}
  1412. MA_InsertableMenuCommand = Struct.new(:name, :index, :enable, :scene, :other)
  1413.  
  1414. #==============================================================================
  1415. # ** Game_System
  1416. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1417. #  Summary of Changes:
  1418. #    new public instance variable - maic_menu_commands
  1419. #    aliased method - initialize
  1420. #==============================================================================
  1421.  
  1422. class Game_System
  1423.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1424.  # * Inserted Menu Commands
  1425.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1426.  def maic_inserted_menu_commands
  1427.    # Lazy Instantiation so that old save files are not corrupted
  1428.    if !@maic_inserted_menu_commands
  1429.      @maic_inserted_menu_commands = MA_COMMAND_INSERTS.keys
  1430.      # Sort by index
  1431.      @maic_inserted_menu_commands.sort! { |a, b| MA_COMMAND_INSERTS[a].index <=> MA_COMMAND_INSERTS[b].index }
  1432.    end
  1433.    @maic_inserted_menu_commands
  1434.  end
  1435. end
  1436.  
  1437. #==============================================================================
  1438. # ** Window_MenuCommand
  1439. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1440. #  Summary of Changes:
  1441. #    aliased method - make_command_list; maic_insert_command
  1442. #==============================================================================
  1443.  
  1444. class Window_MenuCommand
  1445.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1446.  # * Make Command List
  1447.  #``````````````````````````````````````````````````````````````````````````
  1448.  #  I alias this method instead of add_original_commands because I need to
  1449.  # have all commands created before I can insert at the correct index
  1450.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1451.  alias maic_mkcmmndl_6yd2 make_command_list
  1452.  def make_command_list(*args, &block)
  1453.    maic_mkcmmndl_6yd2(*args, &block) # Run Original Method
  1454.    # Insert new commands
  1455.    $game_system.maic_inserted_menu_commands.each { |sym| maic_insert_command(sym) }
  1456.  end
  1457.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1458.  # * Insert Command
  1459.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1460.  def maic_insert_command(symbol)
  1461.    command = MA_COMMAND_INSERTS[symbol]
  1462.    # Get the command name
  1463.    name = command.name.is_a?(Symbol) ? eval(command.name.to_s) : command.name
  1464.    # Check whether enabled
  1465.    enabled = case command.enable
  1466.    when Integer then command.enable == 0 ? true : $game_switches[command.enable]
  1467.    when String then eval(command.enable)
  1468.    when Symbol then self.send(command.enable)
  1469.    else
  1470.      enabled = true
  1471.    end
  1472.    # Add the command to the list
  1473.    add_command(name, symbol, enabled)
  1474.    added = @list.pop
  1475.    @list.insert([command.index, @list.size].min, added) # Insert at specific index
  1476.  end
  1477. end
  1478.  
  1479. #==============================================================================
  1480. # ** Scene_Menu
  1481. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1482. #  Summary of Changes:
  1483. #    aliased method - create_command_window; on_personal_ok
  1484. #    new methods - maic_set_insert_handler; maic_command_insert
  1485. #==============================================================================
  1486.  
  1487. class Scene_Menu
  1488.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1489.  # * Create Command Window
  1490.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1491.  alias maic_createcndwin_3ey7 create_command_window
  1492.  def create_command_window(*args, &block)
  1493.    maic_createcndwin_3ey7(*args, &block) # Run Original Method
  1494.    # Add handlers for all custom commands
  1495.    $game_system.maic_inserted_menu_commands.each { |symbol| maic_set_insert_handler(symbol) }
  1496.  end
  1497.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1498.  # * Set Inserted Handler
  1499.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1500.  def maic_set_insert_handler(symbol)
  1501.    other = MA_COMMAND_INSERTS[symbol].other
  1502.    handler = case other
  1503.    when Symbol then method(other)
  1504.    when String then lambda { eval(other) }
  1505.    when TrueClass then method(:command_personal)
  1506.    else
  1507.      handler = method(:maic_command_insert)
  1508.    end
  1509.    @command_window.set_handler(symbol, handler)
  1510.  end
  1511.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1512.  # * Custom Command
  1513.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1514.  def maic_command_insert
  1515.    SceneManager.call(Kernel.const_get(MA_COMMAND_INSERTS[@command_window.current_symbol].scene))
  1516.  end
  1517.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1518.  # * Personal OK
  1519.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1520.  alias maic_onpok_3ek9 on_personal_ok
  1521.  def on_personal_ok(*args, &block)
  1522.    if $game_system.maic_inserted_menu_commands.include?(@command_window.current_symbol)
  1523.      maic_command_insert
  1524.    else
  1525.      maic_onpok_3ek9(*args, &block) # Run Original Method
  1526.    end
  1527.  end
  1528. end
  1529.  
  1530. $imported[:MA_InsertCommand] = true
  1531. end
  1532.  
  1533. if MAMC_CONFIG[:menu_access]
  1534.  MA_COMMAND_INSERTS[:monster_catalogue] = MA_InsertableMenuCommand.new(MAMC_CONFIG[:menu_label],
  1535.    MAMC_CONFIG[:menu_index], true, :Scene_MonsterCatalogue, false)
  1536. end
  1537.  
  1538. #==============================================================================
  1539. # ** Scene Monster Catalogue
  1540. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1541. #  This processes the Monster Catalogue Scene
  1542. #==============================================================================
  1543.  
  1544. class Scene_MonsterCatalogue < Scene_MenuBase
  1545.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1546.  # * Start
  1547.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1548.  def start
  1549.    super
  1550.    create_help_window
  1551.    create_categorylabel_window
  1552.    create_category_window
  1553.    create_monstercard_window
  1554.    create_monsterlist_window
  1555.  end
  1556.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1557.  # * Create Help Window
  1558.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1559.  def create_help_window
  1560.    if MAMC_CONFIG[:desc_window_lines] > 0
  1561.      @help_window = Window_Help.new(MAMC_CONFIG[:desc_window_lines])
  1562.      @help_window.send(:extend, MAMC_WindowAdditions)
  1563.      @help_window.windowskin = Cache.system(MAMC_CONFIG[:windowskin]) if MAMC_CONFIG[:windowskin]
  1564.      @help_window.reset_font_settings
  1565.      @help_window.y = Graphics.height - @help_window.height
  1566.    end
  1567.  end
  1568.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1569.  # * Create Category Label Window
  1570.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1571.  def create_categorylabel_window
  1572.    @categorylabel_window = Window_MonsterCategoryLabel.new(0, 0)
  1573.    @categorylabel_window.category = MAMC_CONFIG[:shown_categories][0]
  1574.  end
  1575.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1576.  # * Create Category Window
  1577.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1578.  def create_category_window
  1579.    unless MAMC_CONFIG[:shown_categories].size < 2
  1580.      @category_window = Window_MonsterCategory.new(0, @categorylabel_window.height)
  1581.      @category_window.label_window = @categorylabel_window
  1582.    end
  1583.  end
  1584.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1585.  # * Create Monster Card
  1586.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1587.  def create_monstercard_window
  1588.    x = MAMC_CONFIG[:list_window_width]
  1589.    hght = @help_window ? @help_window.y : Graphics.height
  1590.    @monstercard_window = Window_MonsterCard.new(x, 0, Graphics.width - x, hght)
  1591.    @monstercard_window.set_handler(:cancel,   method(:return_scene))
  1592.    @monstercard_window.activate
  1593.    @monstercard_window.help_window = @help_window if @help_window
  1594.  end
  1595.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1596.  # * Create Monster List Window
  1597.  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1598.  def create_monsterlist_window
  1599.    y = @category_window ? @category_window.y + @category_window.height : @categorylabel_window.height
  1600.    hght = @help_window ? @help_window.y - y : Graphics.height - y
  1601.    @monsterlist_window = Window_MonsterList.new(0, y, MAMC_CONFIG[:list_window_width], hght)
  1602.    @monsterlist_window.category = MAMC_CONFIG[:shown_categories][0]
  1603.    @monsterlist_window.help_window = @monstercard_window
  1604.    @category_window.monsterlist_window = @monsterlist_window if @category_window
  1605.  end
  1606. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top