dsiver144

DSI Bestiary

Mar 12th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 25.05 KB | None | 0 0
  1. #==============================================================================
  2. # DSI Bestiary
  3. # -- Last Updated: 2017.03.15
  4. # -- Author: dsiver144
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. # -- Conmission for: Luke / Golden Unicorn Gaming
  8. #==============================================================================
  9. $imported = {} if $imported.nil?
  10. $imported["DSI-Bestiary"] = true
  11. #==============================================================================
  12. # + Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2017.03.12 - Finish first version.
  15. # 2017.03.15 - Fix encounter issues & Add notetag to rearrange enemy in bestiary
  16. #==============================================================================
  17. # + Instructions
  18. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  19. # To install this script, open up your script editor and copy/paste this script
  20. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  21. # Put this below "Sixth Menu Add Ons"! <- IMPORTANT!
  22. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  23. # Script Call:
  24. #   SceneManager.call(Scene_DSI_Bestiary) -> Open Bestiary Scene
  25. #   reveal_beast(id) -> Reveal an enemy from Database.
  26. #   can_upgrade_bestiary? -> Use in conditional branches for checking if player
  27. #                            can upgrade bestiary
  28. #   upgrade_bestiary -> Upgrade bestiary.
  29. # -----------------------------------------------------------------------------
  30. # Notetags:
  31. #  <hide_from_list>    : Hide enemy from Bestiary List
  32. #  <bestiary_level: x> : This enemy will be in the list if x <= bestiary
  33. #                        level
  34. #  <bestiary_type: st> : Define enemy type. ex <bestiary_type: Rare>
  35. #  <bestiary_diff: st> : Define enemy difficulty. ex: <bestiary_diff: Hard>
  36. #  <bestiary_id: x>   : Manually Set bestiary ID for an enemy.
  37. #                       if you don't set. Bestiary ID will equal to its id from
  38. #                       database.
  39. #==============================================================================
  40.   module DSIVER144
  41.     module BESTIARY
  42.      
  43.       COMMAND_NAME        = "Bestiary"
  44.       NO_DATA_PIC         = "QuestionMark" # Located in Graphics/System Folder
  45.       NO_DATA_TEXT        = "NO DATA"
  46.       GENERAL_INFO_TEXT   = "General Info"
  47.       DEBUG_MODE          = true # Check duplicated bestiary ID
  48.      
  49.       TOKENS = {}
  50.       TOKENS[1] = /<hide_from_list>/i
  51.       TOKENS[2] = /<bestiary_level:\s*(\d+)>/i
  52.       TOKENS[3] = /<bestiary_type:\s*(\w+)>/i
  53.       TOKENS[4] = /<bestiary_diff:\s*(\w+)>/i
  54.       TOKENS[5] = /<bestiary_bg:\s*(.+)>/i
  55.       TOKENS[6] = /<add_bestiary_skill:\s*(.+)>/i
  56.       TOKENS[7] = /<bestiary_id:\s*(\d+)>/i
  57.       #------------------------------------------------------------------------
  58.       # * new method: count_bestiary_size
  59.       #------------------------------------------------------------------------
  60.       def self.count_bestiary_size
  61.         return get_bestiary_list.size - 1
  62.       end
  63.       #------------------------------------------------------------------------
  64.       # * new method: get_complete
  65.       #------------------------------------------------------------------------
  66.       def self.get_complete
  67.         list = get_bestiary_list
  68.         size = 0
  69.         list.each do |enemy|
  70.           next if enemy.nil?
  71.           if $game_system.bestiary_list.include?(enemy.id)
  72.             size += 1
  73.           end
  74.         end
  75.         return size
  76.       end
  77.       #------------------------------------------------------------------------
  78.       # * new method: reveal_beast
  79.       #------------------------------------------------------------------------
  80.       def self.reveal_beast(id)
  81.         return if $data_enemies[id].nil?
  82.         return if $game_system.bestiary_list.include?(id)
  83.         $game_system.bestiary_list << id
  84.       end
  85.       #------------------------------------------------------------------------
  86.       # * new method: get_bestiary_list
  87.       #------------------------------------------------------------------------
  88.       def self.get_bestiary_list
  89.         _list = []
  90.         $data_enemies.each do |enemy|
  91.           if enemy && enemy.bestiary_level <= $game_system.bestiary_level && !enemy.hideFromBestiaryList && enemy.name.size > 0
  92.             _list << enemy
  93.           end
  94.         end
  95.         _list.sort! {|a,b| a.bestiaryID <=> b.bestiaryID}
  96.         _list.unshift(nil)
  97.       end
  98.      
  99.     end # BESTIARY
  100.    
  101.   end # DSIVER144
  102.  
  103.   class Game_Interpreter
  104.     alias_method(:dsiver_battle_processing_alias, :command_301)
  105.     #--------------------------------------------------------------------------
  106.     # * new method: reveal_beast
  107.     #--------------------------------------------------------------------------
  108.     def reveal_beast(id)
  109.       DSIVER144::BESTIARY.reveal_beast(id)
  110.     end
  111.     #--------------------------------------------------------------------------
  112.     # * new method: can_upgrade_bestiary?
  113.     #--------------------------------------------------------------------------
  114.     def can_upgrade_bestiary?
  115.       return DSIVER144::BESTIARY.get_complete >= DSIVER144::BESTIARY.count_bestiary_size
  116.     end
  117.     #--------------------------------------------------------------------------
  118.     # * new method: upgrade_bestiary
  119.     #--------------------------------------------------------------------------
  120.     def upgrade_bestiary
  121.       $game_system.bestiary_level += 1 if can_upgrade_bestiary?
  122.     end
  123.     #--------------------------------------------------------------------------
  124.     # * Battle Processing
  125.     #--------------------------------------------------------------------------
  126.     def command_301
  127.       dsiver_battle_processing_alias
  128.       if @params[0] == 0                      # Direct designation
  129.         troop_id = @params[1]
  130.       elsif @params[0] == 1                   # Designation with variables
  131.         troop_id = $game_variables[@params[1]]
  132.       else                                    # Map-designated troop
  133.         troop_id = $game_player.make_encounter_troop_id
  134.       end
  135.       if $data_troops[troop_id]
  136.         $data_troops[troop_id].members.each do |member|
  137.           DSIVER144::BESTIARY.reveal_beast(member.enemy_id)
  138.         end
  139.       end
  140.     end
  141.   end # Game_Interpreter
  142.  
  143.   class Scene_DSI_Bestiary < Scene_Base
  144.     #--------------------------------------------------------------------------
  145.     # * Start Processing
  146.     #--------------------------------------------------------------------------
  147.     def start
  148.       super
  149.       create_background
  150.       create_main_windows
  151.       init_cursors
  152.     end
  153.     #--------------------------------------------------------------------------
  154.     # * Termination Processing
  155.     #--------------------------------------------------------------------------
  156.     def terminate
  157.       super
  158.       dispose_background
  159.     end
  160.     #--------------------------------------------------------------------------
  161.     # * Create Background
  162.     #--------------------------------------------------------------------------
  163.     def create_background
  164.       @background_sprite = Sprite.new
  165.       @background_sprite.bitmap = SceneManager.background_bitmap
  166.       @background_sprite.color.set(16, 16, 16, 128)
  167.     end
  168.     #--------------------------------------------------------------------------
  169.     # * Free Background
  170.     #--------------------------------------------------------------------------
  171.     def dispose_background
  172.       @background_sprite.dispose
  173.       @beast_sprite.bitmap.dispose
  174.       @beast_sprite.dispose
  175.     end
  176.     #--------------------------------------------------------------------------
  177.     # * new method: create_main_windows
  178.     #--------------------------------------------------------------------------
  179.     def create_main_windows
  180.       @bestiary_list = DSIVER144::BESTIARY.get_bestiary_list
  181.       @current_index = 1
  182.       @title_window = Bestiary_Title_Window.new(0,0,250,48)
  183.       @title_window.z = 10
  184.       @title_window.draw(@current_index)
  185.       ww = Graphics.width - @title_window.width
  186.       wh = Graphics.height
  187.       @info_window = Bestiary_Info_Window.new(@title_window.width,0,ww,wh)
  188.       @info_window.z = 10
  189.       wy = Graphics.height - 48
  190.       ww = Graphics.width - @info_window.width
  191.       @progress_window = Window_Base.new(0,wy,ww,48)
  192.       @progress_window.z = 10
  193.       cw = @progress_window.contents_width
  194.       progress = sprintf("Completed: %03d/%03d", DSIVER144::BESTIARY.get_complete, @bestiary_list.size - 1)
  195.       @progress_window.draw_text(0,0,cw,24,progress,1)
  196.       @beast_sprite = Sprite.new
  197.       @beast_sprite.z = 0
  198.       refresh_windows
  199.     end
  200.     #--------------------------------------------------------------------------
  201.     # * new method: refresh_background
  202.     #--------------------------------------------------------------------------
  203.     def refresh_background # Not use yet!
  204.       if is_revealed?
  205.         enemy = $data_enemies[@current_index]
  206.       end
  207.     end
  208.     #--------------------------------------------------------------------------
  209.     # * new method: refresh_background
  210.     #--------------------------------------------------------------------------
  211.     def is_revealed?
  212.       return false if @bestiary_list[@current_index].nil?
  213.       return $game_system.bestiary_list.include?(@bestiary_list[@current_index].id)
  214.     end
  215.     #--------------------------------------------------------------------------
  216.     # * new method: refresh_sprite
  217.     #--------------------------------------------------------------------------
  218.     def refresh_sprite
  219.       if is_revealed?
  220.         enemy = @bestiary_list[@current_index]
  221.         @beast_sprite.bitmap = Cache.battler(enemy.battler_name,enemy.battler_hue)
  222.         correct_sprite_xy
  223.       else
  224.         @beast_sprite.bitmap = Cache.system(DSIVER144::BESTIARY::NO_DATA_PIC)
  225.         correct_sprite_xy
  226.       end
  227.     end
  228.     #--------------------------------------------------------------------------
  229.     # * new method: init_cursors
  230.     #--------------------------------------------------------------------------
  231.     def init_cursors
  232.       @cursors = {}
  233.       pad = AstoriaMenuAddons::Misc[:eq_cursor][:padding]
  234.       yo = (Graphics.height - 24)*0.5#AstoriaMenuAddons::Misc[:eq_cursor][:y]
  235.       [:left,:right].each_with_index do |type,i|
  236.         @cursors[type] = WinCursor.new(@info_window.windowskin,@info_window.z,type)
  237.         case type
  238.         when :left
  239.           xx = pad
  240.         when :right
  241.           xx = @info_window.x + @info_window.width - @cursors[type].size[:w] - pad
  242.         end
  243.         yy = yo
  244.         @cursors[type].set_ori_pos(xx,yy)
  245.       end
  246.     end
  247.     #--------------------------------------------------------------------------
  248.     # * new method: correct_sprite_xy
  249.     #--------------------------------------------------------------------------
  250.     def correct_sprite_xy
  251.       @sprite_offset_x = @beast_sprite.bitmap.width / 2
  252.       @sprite_offset_y = @beast_sprite.bitmap.height / 2
  253.       @beast_sprite.ox = @sprite_offset_x
  254.       @beast_sprite.oy = @sprite_offset_y
  255.       @beast_sprite.x = (@title_window.width - @beast_sprite.bitmap.width) * 0.5
  256.       @beast_sprite.x += @sprite_offset_x
  257.       y = @title_window.height + ((Graphics.height - 48*2) - @beast_sprite.bitmap.height) * 0.5
  258.       @beast_sprite.y = y
  259.       @beast_sprite.y += @sprite_offset_y
  260.     end
  261.     #--------------------------------------------------------------------------
  262.     # * new method: refresh_windows
  263.     #--------------------------------------------------------------------------
  264.     def refresh_windows
  265.       @title_window.draw(@current_index)
  266.       @info_window.draw(@current_index,is_revealed?,@bestiary_list)
  267.       refresh_sprite
  268.     end
  269.     #--------------------------------------------------------------------------
  270.     # * new method: update_input
  271.     #--------------------------------------------------------------------------
  272.     def update_input
  273.       if Input.repeat?(:RIGHT)
  274.         Sound.play_cursor
  275.         @current_index += 1
  276.         if @current_index > @bestiary_list.size - 1
  277.           @current_index = 1
  278.         end
  279.         refresh_windows
  280.       end
  281.       if Input.repeat?(:LEFT)
  282.         Sound.play_cursor
  283.         @current_index -= 1
  284.         if @current_index < 1
  285.           @current_index = @bestiary_list.size - 1
  286.         end
  287.         refresh_windows
  288.       end
  289.     end
  290.     #--------------------------------------------------------------------------
  291.     # * new method: update
  292.     #--------------------------------------------------------------------------
  293.     def update
  294.       super
  295.       update_input
  296.       @cursors.each_value {|curs| curs.update} if @cursors
  297.       return_scene if Input.trigger?(:B)
  298.     end
  299.   end
  300.  
  301.   class Bestiary_Info_Window < Window_Base
  302.     attr_accessor :mode
  303.     attr_accessor :toggle_on
  304.     attr_accessor :current_index
  305.     #--------------------------------------------------------------------------
  306.     # * new method: draw
  307.     #--------------------------------------------------------------------------
  308.     def draw(index,revealed,list)
  309.       contents.clear
  310.       @toggle_on = revealed
  311.       @list = list
  312.       @mode = 0
  313.       @current_index = index
  314.       @drop_items = nil
  315.       draw_reveal(index) if revealed
  316.       draw_unreveal if !revealed
  317.     end
  318.     #--------------------------------------------------------------------------
  319.     # * new method: draw_reveal
  320.     #--------------------------------------------------------------------------
  321.     def draw_reveal(index)
  322.       contents.clear
  323.       enemy = @list[index]
  324.       battler = Game_Enemy.new(0,enemy.id)
  325.       cw = contents_width
  326.       change_color(text_color(2))
  327.       draw_text(0,0,cw,24,enemy.name,1)
  328.       x = 0; y = 24;
  329.       draw_param(Vocab.param(0),battler.param_base(0),x,y,cw/2)
  330.       draw_param(Vocab.param(1),battler.param_base(1),cw/2,y,cw/2)
  331.       y += 24
  332.       draw_param(Vocab.param(2),battler.param_base(2),x,y,cw/2)
  333.       draw_param(Vocab.param(3),battler.param_base(3),cw/2,y,cw/2)
  334.       y += 24
  335.       draw_param(Vocab.param(4),battler.param_base(4),x,y,cw/2)
  336.       draw_param(Vocab.param(5),battler.param_base(5),cw/2,y,cw/2)
  337.       y += 24
  338.       draw_param(Vocab.param(6),battler.param_base(6),x,y,cw/2)
  339.       draw_param(Vocab.param(7),battler.param_base(7),cw/2,y,cw/2)
  340.       y += 24
  341.       names = AstoriaMenuAddons::Vocab[:xparams]
  342.       xparam = [7,8,6,1]
  343.       draw_param(names[7],(battler.xparam(7)*100).to_i.to_s + "%",x,y,cw/2)
  344.       draw_param(names[8],(battler.xparam(8)*100).to_i.to_s + "%",cw/2,y,cw/2)
  345.       y += 24
  346.       draw_param(names[6],(battler.xparam(6)*100).to_i.to_s + "%",x,y,cw/2)
  347.       draw_param(names[1],(battler.xparam(1)*100).to_i.to_s + "%",cw/2,y,cw/2)
  348.       count_i = 0
  349.       AstoriaMenuAddons::Vocab[:elements].each_pair do |id,icon_index|
  350.         value = battler.element_rate(id)
  351.         if count_i % 2 == 0
  352.           y += 24
  353.           draw_elements(icon_index,value,x,y,cw/2)
  354.         else
  355.           draw_elements(icon_index,value,cw/2,y,cw/2)
  356.         end
  357.         count_i += 1
  358.       end
  359.       change_color(text_color(2))
  360.       y += 24
  361.       draw_text(x,y+2,cw,24,DSIVER144::BESTIARY::GENERAL_INFO_TEXT,1)
  362.       y += 26
  363.       draw_param("Type: ", enemy.enemyType, x, y, cw)
  364.       y += 24
  365.       draw_param("Difficulty: ", enemy.enemyDifficulty, x, y, cw); y += 24
  366.       if @drop_items
  367.         @drop_items.push(@drop_items.shift) if Graphics.frame_count % 2 == 0
  368.       else
  369.         @drop_items = make_drop_items(enemy,battler)
  370.       end
  371.       if @drop_items && @drop_items.size > 0 && @drop_items[0]
  372.         draw_param("Drops: ", "", x, y, cw)
  373.         x_plus = x + text_size("Drops: ").width
  374.         draw_item(@drop_items[0].icon_index,@drop_items[0].name,x,y,cw)
  375.       else
  376.         draw_param("Drops: ", "None", x, y, cw)
  377.       end
  378.       y += 24;
  379.       draw_param("Gold: ", enemy.gold, x, y, cw/2)
  380.       draw_param("EXP: ", enemy.exp, cw/2, y, cw/2)
  381.     end
  382.     #--------------------------------------------------------------------------
  383.     # * new method: draw_skill
  384.     #--------------------------------------------------------------------------
  385.     def draw_item(icon_index,name,x,y,width)
  386.       change_color(normal_color)
  387.       icon_x = width - text_size(name).width - 24 - 8
  388.       draw_icon(icon_index,icon_x,y)
  389.       draw_text(x+8,y,width - 12,24,name,2)
  390.     end
  391.     #--------------------------------------------------------------------------
  392.     # * Create Array of Dropped Items
  393.     #--------------------------------------------------------------------------
  394.     def make_drop_items(enemy,battler)
  395.       enemy.drop_items.inject([]) do |r, di|
  396.         if di.kind > 0
  397.           r.push(battler.item_object(di.kind, di.data_id))
  398.         else
  399.           r
  400.         end
  401.       end
  402.     end
  403.     #--------------------------------------------------------------------------
  404.     # * new method: update
  405.     #--------------------------------------------------------------------------
  406.     def update
  407.       super
  408.       if @toggle_on && Graphics.frame_count % 60 == 0
  409.         draw_reveal(@current_index)
  410.         @mode = mode == 0 ? 1 : 0
  411.       end
  412.     end
  413.     #--------------------------------------------------------------------------
  414.     # * new method: draw_skill
  415.     #--------------------------------------------------------------------------
  416.     def draw_skill(name,x,y,width,align)
  417.       change_color(normal_color)
  418.       draw_text(x+8,y,width - 12,24,name,align)
  419.     end
  420.     #--------------------------------------------------------------------------
  421.     # * new method: draw_elements
  422.     #--------------------------------------------------------------------------
  423.     def draw_elements(icon_index,value,x,y,width)
  424.       draw_icon(icon_index,x+8,y)
  425.       change_color(normal_color)
  426.       vtxt = sprintf("%1.0f%",(1.0-value)*100)
  427.       draw_text(x+8,y,width - 12,24,vtxt,2)
  428.     end
  429.     #--------------------------------------------------------------------------
  430.     # * new method: draw_param
  431.     #--------------------------------------------------------------------------
  432.     def draw_param(name,value,x,y,width)
  433.       change_color(system_color)
  434.       draw_text(x+8,y,width - 12,24,name,0)
  435.       change_color(normal_color)
  436.       draw_text(x+8,y,width - 12,24,value,2)
  437.     end
  438.     #--------------------------------------------------------------------------
  439.     # * new method: draw_unreveal
  440.     #--------------------------------------------------------------------------
  441.     def draw_unreveal
  442.       contents.clear
  443.       cw = contents_width
  444.       draw_text(0,0,cw,24,"???????",1)
  445.       draw_text(0,0,cw,contents_height,DSIVER144::BESTIARY::NO_DATA_TEXT,1)
  446.     end
  447.   end
  448.  
  449.   class Bestiary_Title_Window < Window_Base
  450.     #--------------------------------------------------------------------------
  451.     # * new method: draw
  452.     #--------------------------------------------------------------------------
  453.     def draw(index)
  454.       contents.clear
  455.       size = DSIVER144::BESTIARY.count_bestiary_size
  456.       draw_text(0,0,contents_width,24,sprintf("Bestiary %03d/%03d",index,size),1)
  457.     end
  458.   end # Bestiary_Title_Window
  459.   #==============================================================================
  460.   # DataManager
  461.   #==============================================================================
  462.   module DataManager
  463.     #--------------------------------------------------------------------------
  464.     # alias method: load_database
  465.     #--------------------------------------------------------------------------
  466.     class <<self; alias load_database_seal_item load_database; end
  467.     def self.load_database
  468.       load_database_seal_item
  469.       load_notetags_enemy_bestiary
  470.     end
  471.     #--------------------------------------------------------------------------
  472.     # Load Notetag Rental Weapons
  473.     #--------------------------------------------------------------------------
  474.     def self.load_notetags_enemy_bestiary
  475.         index = 0
  476.         if DSIVER144::BESTIARY::DEBUG_MODE && $TEST
  477.           @dup_ids = []
  478.         end
  479.         for enemy in $data_enemies
  480.           next if enemy.nil?
  481.           enemy.load_bestiary_notetags
  482.           next if enemy.bestiaryID < 0
  483.           @dup_ids[enemy.bestiaryID] ||= []
  484.           @dup_ids[enemy.bestiaryID].push([enemy.id,enemy.name])
  485.         end
  486.         if DSIVER144::BESTIARY::DEBUG_MODE && $TEST
  487.         @dup_ids.each do |pack|
  488.           next unless pack
  489.           if pack.size > 1
  490.             str = "[Need correction!] Has same bestiary ID: "
  491.             pack.each do |enemy_info|
  492.               str += "[#{enemy_info[0]} : #{enemy_info[1]}]   "
  493.             end
  494.             msgbox_p(str)
  495.           end
  496.         end
  497.       end
  498.     end
  499.   end # DataManager
  500.  
  501.   class RPG::Enemy
  502.     include DSIVER144
  503.     attr_accessor :hideFromBestiaryList
  504.     attr_accessor :specialSkills
  505.     attr_accessor :enemyType
  506.     attr_accessor :enemyDifficulty
  507.     attr_accessor :bestiary_level
  508.     attr_accessor :bestiary_skills
  509.     attr_accessor :bestiaryID
  510.     #--------------------------------------------------------------------------
  511.     # * new method: load_bestiary_notetags
  512.     #--------------------------------------------------------------------------
  513.     def load_bestiary_notetags
  514.       @hideFromBestiaryList = false
  515.       @specialSkills        = []
  516.       @enemyType            = "---"
  517.       @enemyDifficulty      = "---"
  518.       @bestiary_level       = 1
  519.       @bestiary_bg          = []
  520.       @bestiary_skills      = []
  521.       @bestiaryID           = self.name.size == 0 ? -self.id : self.id
  522.       self.note.split(/[\r\n]+/).each do |line|
  523.         case line
  524.           when BESTIARY::TOKENS[1]
  525.             @hideFromBestiaryList = true
  526.             @bestiaryID           = -self.id
  527.             break
  528.           when BESTIARY::TOKENS[2]
  529.             @bestiary_level = $1.to_i
  530.           when BESTIARY::TOKENS[3]
  531.             @enemyType = $1.to_s
  532.           when BESTIARY::TOKENS[4]
  533.             @enemyDifficulty = $1.to_s
  534.           when BESTIARY::TOKENS[5]
  535.             if $1.include?(",")
  536.               $1.split(",").each do |name|
  537.                 @bestiary_bg << name
  538.               end
  539.             else
  540.               @bestiary_bg[0] = $1
  541.             end
  542.           when BESTIARY::TOKENS[6]
  543.             name = $1.clone
  544.             if $1 =~ /(\d+)/
  545.               @bestiary_skills << $data_skills[$1.to_i].name
  546.             else
  547.               @bestiary_skills << name
  548.             end
  549.           when BESTIARY::TOKENS[7]
  550.             @bestiaryID = $1.to_i
  551.         end
  552.       end # loop end
  553.     end # load_bestiary_notetags
  554.   end # RPG::Enemy
  555.  
  556.   class Game_System
  557.     attr_accessor :bestiary_list
  558.     attr_accessor :bestiary_level
  559.     alias_method(:dsi_bestiary_init_z, :initialize)
  560.     #--------------------------------------------------------------------------
  561.     # * new method: initialize
  562.     #--------------------------------------------------------------------------
  563.     def initialize
  564.       @bestiary_list = []
  565.       @bestiary_level = 1
  566.       dsi_bestiary_init_z
  567.     end
  568.   end # Game_System
  569.  
  570.   class Game_Player
  571.     #--------------------------------------------------------------------------
  572.     # * overwrite method: encounter
  573.     #--------------------------------------------------------------------------
  574.     def encounter
  575.       return false if $game_map.interpreter.running?
  576.       return false if $game_system.encounter_disabled
  577.       return false if @encounter_count > 0
  578.       make_encounter_count
  579.       troop_id = make_encounter_troop_id
  580.       return false unless $data_troops[troop_id]
  581.       $data_troops[troop_id].members.each do |member|
  582.         DSIVER144::BESTIARY.reveal_beast(member.enemy_id)
  583.       end
  584.       BattleManager.setup(troop_id)
  585.       BattleManager.on_encounter
  586.       return true
  587.     end
  588.   end # Game_Player
  589.  
  590.   class Window_MenuCommand
  591.     alias_method(:dsi_bestiary_add_original_commands, :add_original_commands)
  592.     #--------------------------------------------------------------------------
  593.     # * For Adding Original Commands
  594.     #--------------------------------------------------------------------------
  595.     def add_original_commands
  596.       dsi_bestiary_add_original_commands
  597.       add_command(DSIVER144::BESTIARY::COMMAND_NAME, :bestiary)
  598.     end
  599.   end # Window_Command
  600.  
  601.   class Scene_Menu
  602.     alias_method(:dsi_bestiary_create_command_window, :create_command_window)
  603.     #--------------------------------------------------------------------------
  604.     # * alias method: create_command_window
  605.     #--------------------------------------------------------------------------
  606.     def create_command_window
  607.       dsi_bestiary_create_command_window
  608.       @command_window.set_handler(:bestiary,    method(:command_bestiary))
  609.     end
  610.     #--------------------------------------------------------------------------
  611.     # * new method: command_bestiary
  612.     #--------------------------------------------------------------------------
  613.     def command_bestiary
  614.       SceneManager.call(Scene_DSI_Bestiary)
  615.     end
  616.   end # Scene_Menu
  617. #===============================================================================
  618. # * END OF FILE
  619. #===============================================================================
Add Comment
Please, Sign In to add comment