设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 478|回复: 4
打印 上一主题 下一主题

[已经解决] 怪物图鉴的文本描述如何扩充

[复制链接]

Lv1.梦旅人

梦石
0
星屑
181
在线时间
81 小时
注册时间
2024-1-8
帖子
19
跳转到指定楼层
1
发表于 2024-6-8 13:20:47 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
80星屑
本帖最后由 神隐的主犯 于 2024-6-13 18:58 编辑

直接先上工程
链接:https://pan.baidu.com/s/1eNCbfkKZXYAKcvH24MwLFA?pwd=1111
提取码:1111


如上图,我搞到的这个图鉴脚本,它关于描述这块只能塞下四行文本。
我又不好调整排版大小。

所以悬赏一下有没有大佬能做个条,
就是查看怪物描述文本的时候它可以通过按某个按键移动显示部分呢?。


附上对应脚本【ps,这个是我修改了一下显示文本的范例。如果有佬嫌弃,可以直接下网盘的】
————
RUBY 代码复制
  1. # ----------------------------------------------------------------------------
  2. # ■ 作者注释 -
  3. # ----------------------------------------------------------------------------
  4. # 这是一个快速说明。这个脚本是为在以下网址找到的代码挑战赛编写的:
  5. # http://forums.rpgmakerweb.com/index.php?/forum/102-code-off-challenge/
  6. # ----------------------------------------------------------------------------
  7. # ■ 术语 -
  8. # ----------------------------------------------------------------------------
  9. # 本脚本可以商业或非商业使用。如果商业使用,我希望您能通过论坛私信我一个游戏链接,
  10. # 这样我可以跟进它的进度..但这不是必须的;) 这只是一个我想看看的类型的事情 :)
  11. # ----------------------------------------------------------------------------
  12. # ■ 介绍 -
  13. # ----------------------------------------------------------------------------
  14. # 这个脚本会给您一个场景,您可以在其中跟踪您已经发现和/或杀死的敌人。
  15. # 它将跟踪敌人的统计数据、技能、掉落物品、对元素和状态效果的抗性,
  16. # 同时显示敌人的描述和图像。
  17. # ----------------------------------------------------------------------------
  18. # ■ 使用说明 -
  19. # ----------------------------------------------------------------------------
  20. # 如果您将此脚本放入您的游戏项目中,它将起作用。了解注释标签的知识将有助于利用所有功能。
  21. # ----------------------------------------------------------------------------
  22. # ■ 敌人注释标签 -
  23. # ----------------------------------------------------------------------------
  24. # 您可以为每个敌人设置自定义描述。如果您跳过此注释标签,
  25. # 那么它将使用在 Default_Description 中设置的描述。文本将采用您在消息窗口中使用的相同代码,
  26. # 但您需要在每个代码前添加一个额外的 \ 。因此,\C[1] 将需要是 \\\C[1] 。
  27. # 您可以使用 KilloZapit 的单词包装器自动将文本适应框,或者如果您不想使用 KilloZapit 的单词包装器,
  28. # 则可以使用 | 来开始新的文本行。
  29. # 请参阅演示敌人注释标签框中的示例。
  30. #    <description1: 你的文本在这里>
  31. #
  32. # 当在 Bestiary 场景中时,敌人将出现在看起来像战斗背景图像的背景上。
  33. # 您可以设置默认图像的使用,并为每个设置的类别设置图像。
  34. # 但是,如果您希望某些敌人拥有非常自己的图像,与默认或类别图像不同,
  35. # 那么请使用以下标签:
  36. #    <bg_floor: 文件>   - 它将在 Battlebacks1 中查找文件,如果没有找到,
  37. #                         那么它将在 Pictures 文件夹中查找。
  38. #    <bg_wall: 文件>    - 它将在 Battlebacks2 中查找文件,如果没有找到,
  39. #                         那么它将在 Pictures 文件夹中查找。
  40. # 注意:不要在文件名周围放置 "" 的引号。如果您想使用单个文件,
  41. # 那么请将 bg_floor 或 bg_wall 设置为您想要使用的图像,并将另一个设置为 nil。
  42. #
  43. # 有时有些敌人您不想跟踪,或者如果您像我一样,您喜欢按部分对数据库进行排序并使用标签。
  44. # 为了确保这些数据库条目不会出现在 bestiary 场景中,请使用此标签:
  45. #    <skip>             - 当使用此标签时,将不会产生任何条目
  46. #
  47. # 有些游戏有同一个敌人的多个数据库条目,但它们稍微改变了统计数据以进行变化,
  48. # 或者改变了图形以进行变化。但它们仍然被认为是同一个敌人。在这种情况下,
  49. # 您可以使用此标签,以便无论您遇到哪一个,它都只会显示一个条目。
  50. #    <shown_id: x>      - x 是在 Bestiary 中使用的数据库 ID
  51. #
  52. # 类别标签将是使用最多的标签。您可以在自定义部分设置类别。
  53. # 您可以以任何您喜欢的方式对 Bestiary 场景进行排序。
  54. # 例如,可以按 Common Enemies, Rare Enemies, Boss Enemies, Elite 等进行分类,
  55. # 或按此演示中的地点分类。一个敌人可以出现在多个类别中。
  56. # 使用以下标签设置敌人的类别:
  57. #    <category: x>     - x 是下面定义的类别 ID
  58. #
  59. # 要使敌人对扫描免疫,请使用以下代码
  60. #    <no_scan>         - 敌人对扫描技能免疫
  61. #
  62. # ----------------------------------------------------------------------------
  63.  
  64. # ----------------------------------------------------------------------------
  65. # ■ 物品/技能注释标签 -
  66. # ----------------------------------------------------------------------------
  67. # 最后一个注释标签可以放在技能或物品的注释标签中。它允许您扫描敌人以了解有关它的信息。
  68. #    <scan>            - 当对敌人使用时,它会解锁信息
  69. #
  70. # ----------------------------------------------------------------------------
  71.  
  72. # ----------------------------------------------------------------------------
  73. # ■ 脚本调用 -
  74. # ----------------------------------------------------------------------------
  75. #                      - 手动添加 Bestiary 条目 -
  76. # 以防您需要手动添加 bestiary 条目,请使用以下内容:
  77. #     add_enemy_entry(enemy_id)   - enemy_id 是数据库中的 ID
  78. #
  79. #              - 通过脚本调用更改敌人的描述 -
  80. # 您可以通过脚本调用更改敌人的描述。当您通过脚本调用设置描述时,
  81. # 它将覆盖找到的任何其他描述文本(默认描述或按击杀自定义的描述)。
  82. # 要通过脚本调用设置描述,请使用以下格式:
  83. #     set_enemy_description(enemy_id, text)    - enemy_id 是数据库 ID
  84. #                                              - text 是显示的文本。
  85. # 文本遵循与其他所有描述文本相同的规则。您可以使用消息代码更改文本颜色、大小、使用图标等。使用 | 形成换行。如果您希望描述为空,则将文本设置为 ""。
  86. #
  87. # 要将描述文本重置为通常的内容,请使用:
  88. #     reset_enemy_description(enemy_id)        - enemy_id 是数据库 ID
  89. #
  90. #              - 获取敌人的击杀次数 -
  91. # 如果您需要进行条件检查或其他任何原因,可以获取您给定敌人的击杀次数。使用:
  92. #     enemy_kill_count(enemy_id)               - enemy_id 是数据库 ID
  93. # 注意:如果给定的 enemy_id 有 <shown_id: x>,在其中,则将转到注释标签指向的敌人 ID。
  94. # ==============================================================================
  95. # ■ 配置
  96. # ==============================================================================$imported ||= {}; $imported[:Venka_Bestiary] = true
  97. module Venka; module Bestiary
  98.  
  99. # 通用设置
  100. #----------------------------------------------------------------------------------------------------------------------
  101. Windowskin = "Window"    # 设置为 nil 以使用默认皮肤。
  102. Window_Opacity = 255        # 窗口的整体透明度。数字 0 - 255
  103. Window_BGOpacity = 180       # 窗口背景透明度(默认 192)
  104. Use_Dividers = true         # 是否绘制分隔线来分隔信息?
  105. Line_Color = [150, 150, 250, 225] # 分隔线的颜色,格式为 [红色, 蓝色, 绿色, Alpha]
  106. Frame_Image = false         # 是否绘制敌人图像周围的窗口边框?
  107. Menu_Access = true          # 是否可以从菜单访问 Bestiary?
  108. BG_Image = "Book"           # 在 Title1 或 Pictures 文件夹中找到
  109. Bestiary_BGM = ["Theme2", 80, 100] # ["文件", 音量, 音高]. 可以设置为 nil
  110. Scroll_Speed = 6            # 按 ↑↓ 时信息移动的速度
  111. Track_Progress = true       # 显示每个类别的完成度
  112. Track_Kills = true          # 跟踪杀死敌人的次数
  113. Show_Debuff_Info = true     # 显示减益信息部分
  114. Use_Wordwrapper = true      # 使用 KilloZapit 的自动换行脚本来处理文本
  115.  
  116. # 默认设置
  117. #----------------------------------------------------------------------------------------------------------------------
  118. # 您可以为每个敌人设置默认的背景图像和描述信息,如果您没有为每个敌人制作自定义信息。
  119. # 如果您只想使用一个背景图像,那么请在它的 Battleback 文件夹或 Pictures 文件夹中设置一个图像,
  120. # 并将另一个设置为 nil。
  121. #----------------------------------------------------------------------------------------------------------------------
  122. Default_BGFloor = "Dirt1"     # 默认使用的地面图像(Battlebacks1)
  123. Default_BGWall = "Forest1"     # 默认使用的墙面图像(Battlebacks2)
  124. # 描述文本可以使用消息代码(例如:\c[1] - 更改文本颜色)。
  125. # 使用 | 强制换行。
  126. Default_Description = "关于这个 | 敌人知之甚少。"
  127. # 随着击杀更多敌人,描述可以发展。这些描述必须通过注释标签设置。
  128. # 如果没有设置描述,则将跳过描述并显示较低的消息或默认消息。
  129. # 在此处设置击杀目标:
  130. Description1 = 0              # 0次击杀时显示此消息
  131. Description2 = 3              # 击杀3次后显示此消息
  132. Description3 = 8              # 击杀8次后显示此消息
  133.  
  134. # 按击杀显示设置
  135. #----------------------------------------------------------------------------------------------------------------------
  136. # 您可以设置根据击杀次数显示敌人的哪些信息。使用扫描技能也将解锁以下所有信息,
  137. # 无论给定敌人的击杀次数如何。
  138. #----------------------------------------------------------------------------------------------------------------------
  139. Show_BaseStats = 1          # 显示基础统计数据:攻击力、防御力、魔法攻击力等
  140. Show_Elements = 1            # 显示元素抗性
  141. Show_States = 1              # 显示状态抗性
  142. Show_DebuffStats = 1         # 显示减益比率
  143. Show_Abilities = 1          # 显示可以使用的能力列表
  144. Show_Loot = 1                # 显示敌人的掉落列表
  145.  
  146. # 文本设置
  147. #----------------------------------------------------------------------------------------------------------------------
  148. # 您可以设置在 Bestiary 场景中出现的所有文本。
  149. #----------------------------------------------------------------------------------------------------------------------
  150. Bestiary_Command = "境界图鉴"      # 菜单中场景的文本
  151. Category_Select = "选择一个类别"    # 选择类别的帮助文本
  152. Enemy_Select = "选择一个敌人"      # 选择敌人的帮助文本
  153. Discovered_Text = "已发现的敌人"    # 底部显示的文本
  154. Percent_Finished = "已完成"         # 完成百分比的文本
  155. Unknown_Loot = "未知掉落"           # 掉落未知时显示的文本
  156. Unknown_Skills = "未知能力"         # 技能未知时显示的文本
  157. View_Stats = "统计数据"             # 统计数据按钮文本
  158. View_More = "其他信息"             # 其他信息按钮文本
  159. View_Element = "元素"               # 元素信息按钮文本
  160. View_States = "状态"                # 状态信息按钮文本
  161. View_Debuff = "减益"                # 减益信息按钮文本
  162. Stats_Text = "基础统计"             # 基本统计数据的标题文本
  163. Element_Text = "元素抗性"           # 元素抗性的标题文本
  164. Status_Text = "状态抗性"            # 状态抗性的标题文本
  165. Debuff_Text = "减益比率"           # 减益比率的标题文本
  166. Loot_Text = "奖励"                  # 可获得物品的列表
  167. Skill_Text = "能力"                # 敌人使用的技能文本
  168. Immune_Text = "免疫"               # 敌人对状态免疫时出现的文本
  169. Absorb_Text = "吸收"               # 元素吸收(Yanfly 元素吸收脚本)的文本
  170. Unknown_Stat = "??"                # 未知抗性/统计数据的文本
  171. # 对于接下来的两个设置,如果您不想使用图标或文本,可以将其设置为 nil
  172. Exp_Text = ["经验:", 117]          # 经验和图标的文本和图标
  173. Gold_Text = ["金币:", 361]          # 金币和图标的文本和图标
  174. Kills_Text = "击杀次数"              # 显示敌人击杀数的文本
  175. Instructions_Text = "使用 PageUp 和 PageDown 更换敌人。"
  176. Battle_Instructions = "按 Shift 查看目标的更多信息。"
  177.  
  178. # 扫描技能设置
  179. #----------------------------------------------------------------------------------------------------------------------
  180. # 您可以在此处设置扫描技能的相关内容。这主要是设置在游戏中出现的文本。
  181. # 您还可以设置在敌人窗口中选择敌人时弹出窗口显示的按键。
  182. # 注意:窗口也会在成功扫描时弹出
  183. #
  184. # 按键选项为:                   :A  - 这是 Shift 键
  185. #   :X   - 这是 A 键         :Y  - 这是 S 键
  186. #   :Z   - 这是 D 键         :L  - 这是 PageUp/Q 键
  187. #   :R   - 这是 PageDw/W 键     :SHIFT, :CTRL, :ATL - shift, cntl, atl 键
  188. #----------------------------------------------------------------------------------------------------------------------
  189. Target_Scanned = "%s 已扫描!"   # 成功扫描时的战斗信息
  190. No_Scan = "%s 无法被扫描!"     # 目标无法被扫描时的战斗信息
  191. No_Info = "未找到信息"         # 当目标对扫描免疫时的文本。
  192. Scan_PopUp = :SHIFT             # 使窗口弹出的输入键
  193.  
  194. # 列表排序设置
  195. #----------------------------------------------------------------------------------------------------------------------
  196. # 您可以设置列表的排序方式。您可以按发现顺序(发现顺序应该是默认的)、按它们的数据库 ID 或名称进行排序。
  197. #----------------------------------------------------------------------------------------------------------------------
  198. Sort_Type = :id      # 选择有 :id, :name, 或 :default
  199.  
  200. # 字体设置
  201. #----------------------------------------------------------------------------------------------------------------------
  202. # :help_font    = 出现在顶部和底部窗口的字体
  203. # :list_font    = 列表窗口中的字体
  204. # :header_font  = 用于统计类型的字体
  205. # :stat_font    = 用于统计数据的字体
  206. # :description  = 敌人描述文本的字体。
  207. #
  208. # 对于每种文本类型,您需要设置字体、大小、粗体和颜色。
  209. # 使用以下格式:
  210. #   [["字体名称, 字体名称, 等"], 字体大小, 粗体?, 颜色]],
  211. #      字体名称 = 一个数组,保存字体选择。第一个是您首先使用的选择,
  212. #        但如果玩家的计算机上没有该字体,它将通过列表继续寻找可以使用的字体
  213. #      字体大小 = 您想使用的字体大小
  214. #      粗体? = 这应该是 true 用于粗体,false 关闭粗体
  215. #      颜色 = 这是与设置 Gauge Color 的颜色相同的格式。
  216. #        使用 [红色, 蓝色, 绿色, 不透明度] 或窗口皮肤颜色编号。
  217. #      轮廓? = 这将打开或关闭字体的轮廓
  218. #----------------------------------------------------------------------------------------------------------------------
  219. Fonts = {       # [["字体"]],           大小, 粗体?, 颜色, 轮廓?
  220.   :normal_font => [["Calibri", "Sylfaen"], 24, false,  0,      true],
  221.   :list_font   => [["Calibri", "Sylfaen"], 24, false,  0,      true],
  222.   :header_font => [["Calibri", "Sylfaen"], 23,  true,  1,      true],
  223.   :stat_name   => [["Calibri", "Sylfaen"], 20,  true,  0,      true],
  224.   :stats_font  => [["Calibri", "Sylfaen"], 20, false,  0,      true],
  225.   :description => [["Calibri", "Sylfaen"], 18, false,  0,      true],
  226. } # <—— 不要删除
  227. # 下面两个颜色设置可以是窗口皮肤颜色或 [红色, 蓝色, 绿色]
  228. High_Resist = 3       # 高抗性使用的颜色
  229. Low_Resist = 18       # 低抗性(弱点)使用的颜色
  230. Immunity_Color = 17   # 免疫/吸收文本使用的颜色
  231. # 战斗字体设置
  232. #----------------------------------------------------------------------------------------------------------------------
  233. # 战斗中的字体与窗口中出现的字体略有不同。
  234. # 对于这一个,颜色必须以 [红色, 蓝色, 绿色] 的格式。
  235. #----------------------------------------------------------------------------------------------------------------------
  236. #                   字体族,      大小, 粗体?,    颜色,     轮廓?
  237. Battle_Font = [["Calibri", "Sylfaen"], 24,  true, [255,255,255],   true]
  238.  
  239. # 基础统计设置
  240. #----------------------------------------------------------------------------------------------------------------------
  241. # 设置用于基础统计(HP, MP, 攻击, 等等)的文本和/或图标
  242. # 您可以将文本或图标设置为 nil 以省略它们。
  243. #----------------------------------------------------------------------------------------------------------------------
  244. Base_Stats = [] #["文本", 图标索引]
  245. Base_Stats[0] = ["生命",   122]  # 最大生命值
  246. Base_Stats[1] = ["灵力",   112]  # 最大魔法值
  247. Base_Stats[2] = ["攻击力",  116]  # 攻击
  248. Base_Stats[3] = ["防御",  161]  # 防御
  249. Base_Stats[4] = ["魔力", 113]  # 魔法攻击
  250. Base_Stats[5] = ["魔抗",  15]  # 魔法防御
  251. Base_Stats[6] = ["速度",   12]  # 敏捷
  252. Base_Stats[7] = ["幸运", 202]  # 幸运
  253.  
  254. # 元素设置
  255. #----------------------------------------------------------------------------------------------------------------------
  256. # 您想要跟踪的元素。按优先顺序列出元素。在默认游戏分辨率下,大约会显示 9 个图标。
  257. # 如果您使屏幕变宽,那么可能会显示更多。因此,按重要性顺序列出您想要显示的图标。
  258. #----------------------------------------------------------------------------------------------------------------------
  259. Elements = [
  260.   # [ID, 图标索引],金木水火土日月灵
  261.   [2,  858],   
  262.   [3,  859],   
  263.   [4,  860],   
  264.   [5,  861],   
  265.   [6,  862],  
  266.   [7,  863],   
  267.   [8,  864],
  268.   [9,  865],   
  269.  
  270.   ] # <-— 不要删除!!
  271.  
  272. # 状态设置
  273. #----------------------------------------------------------------------------------------------------------------------
  274. # 这就像设置元素一样,但是不需要定义图标,因为所有状态/状态在数据库中都设置了图标。
  275. # 所以对于这个,只需按优先顺序设置您想要跟踪的状态 ID。
  276. #----------------------------------------------------------------------------------------------------------------------
  277. States = [1, 2, 3, 4, 5, 6, 7, 10]
  278.  
  279. # 状态设置
  280. #----------------------------------------------------------------------------------------------------------------------
  281. # 这就像设置元素一样,但是不需要定义图标,因为所有状态/状态在数据库中都设置了图标。
  282. # 所以对于这个,只需按优先顺序设置您想要跟踪的状态 ID。
  283. #----------------------------------------------------------------------------------------------------------------------
  284. States = [1, 2, 3, 4, 5, 6, 7, 10]
  285.  
  286. # 类别设置
  287. #----------------------------------------------------------------------------------------------------------------------
  288. # 您可以设置敌人将被分类到的类别。这可以是您喜欢的任何方式。例如,您可以按种类(哺乳动物、
  289. # 鸟类、恶魔等)或按地区(森林、河流、山脉等)进行分类。您必须在此处设置所有类别,然后使用数据库的
  290. # 敌人标签页来设置它。
  291. #
  292. #   Category[ID] = {               # ID 必须是唯一的数字。
  293. #     :name => "Miscellaneous",     # 类别的名称,正如它在场景中出现的那样
  294. #     :bg_floor => "file",          # 如果不是默认的,使用此图像(可以省略)
  295. #     :bg_wall  => "file",          # 如果不是默认的,使用此图像(可以省略)
  296. #           文件 = 如果您想使用默认图像之外的图像,请使用此文件。如果您想使用
  297. #                 不使用图像,请将其设置为 ""。
  298. #   }
  299. #
  300. # 注意:地板和墙壁图像都可以省略以使用默认图像。如果使用单个图像,则将其中一个或另一个设置为您想要使用的图像
  301. # (在相应的战斗背景文件夹或图片文件夹中找到),然后将另一个设置为 ""(一个空文件)。不要将另一个图像设置为 nil,
  302. # 因为这将选择默认图像。
  303. #----------------------------------------------------------------------------------------------------------------------  Category ||= {}
  304.   Category ||= {}
  305. #----------------------------------------------------------------------------
  306.   Category[0] = {  # This is the default category. Enemies appear in this
  307.       # category if they don't have one assigned or there was a typo in the tag.
  308.       :name => "人类",
  309.       } # <-DO NOT REMOVE
  310.   #----------------------------------------------------------------------------
  311.   Category[1] = {  # Enemies found in the Forsaken Forest area
  312.       :name => "魔物",  # Name of Category
  313.       }
  314.   #----------------------------------------------------------------------------
  315.   Category[2] = {  # Enemies found in the Abandoned Mines area
  316.       :name => "机械",  # Name of Category
  317.       }
  318.   #----------------------------------------------------------------------------
  319.   Category[3] = {  # Enemies found in the Deep Space area
  320.       :name => "神明",       # Name of Category
  321.       }
  322.   #----------------------------------------------------------------------------
  323.   Category[4] = {  # Enemies found in the Nocturnal Plains area
  324.       :name => "亡魂",     # Name of Category
  325.       }
  326.   #----------------------------------------------------------------------------
  327.   Category[5] = {  # Undead Enemies
  328.       :name => "精英",               # Name of Category
  329.       }
  330.   #----------------------------------------------------------------------------
  331.   Category[6] = {  # Enemies found in the Nocturnal Plains area
  332.       :name => "首领",            # Name of Category
  333.       }
  334.   #----------------------------------------------------------------------------
  335.   Category[7] = {  # Enemies found in the Nocturnal Plains area
  336.       :name => "EXTRA",            # Name of Category
  337.       }
  338. #==============================================================================
  339. # ■ Edits should stop here unless you know what you're doing :)
  340. #==============================================================================
  341.   end
  342.   module Notetag
  343.     Skip_Enemy = /<skip>/i
  344.     Enemy_Category = /<category:\s*(\d+(?:\s*,\s*\d+)*)>/i
  345.     BG_Floor   = /<bg_floor:\s*(\w+)>/i
  346.     BG_Wall    = /<bg_wall:\s*(\w+)>/i
  347.     Enemy_Desc1 = /<description1:\s*(.*)>/i
  348.     Enemy_Desc2 = /<description2:\s*(.*)>/i
  349.     Enemy_Desc3 = /<description3:\s*(.*)>/i
  350.     Shown_ID   = /<shown_id:\s*(\d+)>/i
  351.     Scan_Skill = /<scan>/i
  352.     No_Scan    = /<no_scan>/i
  353.   end
  354. end
  355. #------------------------------------------------------------------------------
  356. # ○ Creating a way to store discovered info about the enemy with Struct.
  357. #------------------------------------------------------------------------------
  358. Bestiary_Entry = Struct.new(:enemy_id, :category, :elements, :states, :kills,
  359.     :quotes, :scanned)
  360. #==============================================================================
  361. # ■ Vocab
  362. #==============================================================================
  363. module Vocab
  364.   # Scan Skill
  365.   Scanned = Venka::Bestiary::Target_Scanned
  366.   No_Scan = Venka::Bestiary::No_Scan
  367. end
  368. #==============================================================================
  369. # ■ DataManager
  370. #==============================================================================
  371. module DataManager
  372.   #----------------------------------------------------------------------------
  373.   # ● alias method: load_database
  374.   #----------------------------------------------------------------------------
  375.   class << self;  alias bestiary_db_notetags load_database;   end
  376.   def self.load_database
  377.     bestiary_db_notetags
  378.     load_bestiary_notetags
  379.   end
  380.   #----------------------------------------------------------------------------
  381.   # ○ new method: load_bestiary_notetags
  382.   #----------------------------------------------------------------------------
  383.   def self.load_bestiary_notetags
  384.     ($data_enemies + $data_skills + $data_items).compact.each do |item|
  385.       item.load_bestiary_notetags
  386.     end
  387.   end
  388. end
  389. #==============================================================================
  390. # ■ RPG::UsableItem
  391. #==============================================================================
  392. class RPG::UsableItem
  393.   #----------------------------------------------------------------------------
  394.   # ♦ Public Instance Variables
  395.   #----------------------------------------------------------------------------
  396.   attr_accessor :scan
  397.   #----------------------------------------------------------------------------
  398.   # ○ new method: load_bestiary_notetags
  399.   #----------------------------------------------------------------------------
  400.   def load_bestiary_notetags
  401.     @scan = false
  402.     self.note.split(/[\r\n]+/).each do |line|
  403.       info = []
  404.       case line
  405.       when Venka::Notetag::Scan_Skill;        @scan = true
  406.       end
  407.     end
  408.   end
  409. end
  410. #==============================================================================
  411. # ■ RPG::Enemy
  412. #==============================================================================
  413. class RPG::Enemy
  414.   #----------------------------------------------------------------------------
  415.   # ♦ Public Instance Variables
  416.   #----------------------------------------------------------------------------
  417.   attr_accessor :skip, :category, :bg_floor, :bg_wall, :description, :shown_id
  418.   attr_accessor :no_scan, :descript1, :descript2, :descript3
  419.   #----------------------------------------------------------------------------
  420.   # ○ new method: load_bestiary_notetags
  421.   #----------------------------------------------------------------------------
  422.   def load_bestiary_notetags
  423.     @skip = false
  424.     @category = [0]
  425.     @bg_floor = @bg_wall = ""
  426.     @shown_id = @id
  427.     @no_scan = false
  428.     @description = nil
  429.     @descript1 = @descript2 = @descript3 = nil
  430.     self.note.split(/[\r\n]+/).each do |line|
  431.       info = []
  432.       case line
  433.       when Venka::Notetag::Skip_Enemy;        @skip = true
  434.       when Venka::Notetag::No_Scan;           @no_scan = true
  435.       when Venka::Notetag::Enemy_Category
  436.         $1.scan(/\d+/).each { |num| info.push(num.to_i) }
  437.         @category = info ? info : 0
  438.       when Venka::Notetag::BG_Floor;          @bg_floor = $1.to_s
  439.       when Venka::Notetag::BG_Wall;           @bg_wall = $1.to_s
  440.       when Venka::Notetag::Enemy_Desc1;       @descript1 = $1.to_s
  441.       when Venka::Notetag::Enemy_Desc2;       @descript2 = $1.to_s
  442.       when Venka::Notetag::Enemy_Desc3;       @descript3 = $1.to_s
  443.       when Venka::Notetag::Shown_ID;          @shown_id = $1.to_i
  444.       end
  445.     end
  446.   end
  447. end
  448. #==============================================================================
  449. # ■ BattleManager
  450. #==============================================================================
  451. module BattleManager
  452.   #----------------------------------------------------------------------------
  453.   # ● alias method: battle_start
  454.   #----------------------------------------------------------------------------
  455.   class << self;  alias bestiary_battle_start battle_start;   end
  456.   def self.battle_start
  457.     bestiary_battle_start
  458.     add_bestiary_enemies
  459.   end
  460.   #----------------------------------------------------------------------------
  461.   # ○ new method: add_bestiary_enemies
  462.   #----------------------------------------------------------------------------
  463.   def self.add_bestiary_enemies
  464.     $game_troop.members.each do |enemy|
  465.       rpg_enemy = $data_enemies[enemy.enemy_id]
  466.       next if rpg_enemy.nil? || rpg_enemy.skip
  467.       unless $game_party.bestiary_include?(rpg_enemy.shown_id)
  468.         $game_party.add_enemy($data_enemies[rpg_enemy.shown_id])
  469.       end
  470.     end
  471.   end
  472. end
  473. #==============================================================================
  474. # ■ Game_Enemy
  475. #==============================================================================
  476. class Game_Enemy < Game_Battler
  477.   #----------------------------------------------------------------------------
  478.   # ● upgraded method: add_state
  479.   #----------------------------------------------------------------------------
  480.   def add_state(state_id)
  481.     Venka::Bestiary::States.each_with_index do |id, i|
  482.       next unless state_id == id
  483.       $game_party.bestiary.each do |enemy|
  484.         next unless enemy.enemy_id == $data_enemies[@enemy_id].shown_id
  485.         enemy.states[i] = true
  486.       end
  487.     end
  488.     super
  489.   end
  490. end
  491. #==============================================================================
  492. # ■ Game_Troop
  493. #==============================================================================
  494. class Game_Troop < Game_Unit
  495.   #----------------------------------------------------------------------------
  496.   # ● alias method: battle_start
  497.   #----------------------------------------------------------------------------
  498.   alias bestiary_kill_count make_drop_items
  499.   def make_drop_items
  500.     add_encounter_count
  501.     bestiary_kill_count
  502.   end
  503.   #----------------------------------------------------------------------------
  504.   # ○ new method: add_encounter_count
  505.   #----------------------------------------------------------------------------
  506.   def add_encounter_count
  507.     dead_members.each do |enemy|
  508.       rpg_enemy = $data_enemies[enemy.enemy_id]
  509.       next if rpg_enemy.nil? || rpg_enemy.skip
  510.       $game_party.bestiary.each do |entry|
  511.         next unless entry.enemy_id == rpg_enemy.shown_id
  512.         entry.kills += 1
  513.         case entry.kills
  514.         when Venka::Bestiary::Show_Elements
  515.           entry.elements.size.times {|i| entry.elements[i] = true}
  516.         when Venka::Bestiary::Show_States
  517.           entry.states.size.times {|i| entry.states[i] = true}
  518.         end
  519.       end
  520.     end
  521.   end
  522. end
  523. #==============================================================================
  524. # ■ Game_Party
  525. #==============================================================================
  526. class Game_Party < Game_Unit
  527.   #----------------------------------------------------------------------------
  528.   # ♦ Public Instance Variables
  529.   #----------------------------------------------------------------------------
  530.   attr_accessor   :bestiary
  531.   #----------------------------------------------------------------------------
  532.   # ● alias method: initialize
  533.   #----------------------------------------------------------------------------
  534.   alias venka_bestiary_enounters_ini initialize
  535.   def initialize
  536.     venka_bestiary_enounters_ini
  537.     @bestiary = []
  538.   end
  539.   #----------------------------------------------------------------------------
  540.   # ○ new method: add_enemy
  541.   #----------------------------------------------------------------------------
  542.   # The entries are: EnemyID, BestiaryCategory, Array for Element info,
  543.   #   Array for State info, Kill Counter, Actor Quotes, and Scanned?
  544.   #----------------------------------------------------------------------------
  545.   def add_enemy(enemy)
  546.     @bestiary << Bestiary_Entry.new(enemy.id, enemy.category,
  547.         Array.new(Venka::Bestiary::Elements.size, false),
  548.         Array.new(Venka::Bestiary::States.size, false), 0, [], false)
  549.   end
  550.   #----------------------------------------------------------------------------
  551.   # ○ new method: reveal_resist
  552.   #----------------------------------------------------------------------------
  553.   def reveal_resist(enemy_id, reveal = true)
  554.     rpg_enemy = $data_enemies[enemy_id]
  555.     return if rpg_enemy.nil? || rpg_enemy.skip
  556.     @bestiary.each do |entry|
  557.       next unless entry.enemy_id == rpg_enemy.shown_id
  558.       next if rpg_enemy.no_scan && !reveal
  559.       entry.elements.size.times {|i| entry.elements[i] = true}
  560.       entry.states.size.times {|i| entry.states[i] = true}
  561.     end
  562.   end
  563.   #----------------------------------------------------------------------------
  564.   # ○ new method: bestiary_include?
  565.   #----------------------------------------------------------------------------
  566.   def bestiary_include?(id)
  567.     @bestiary.each do |entry|
  568.       return true if entry.enemy_id == id
  569.     end
  570.     return false
  571.   end
  572. end
  573. #==============================================================================
  574. # ■ Game_Interpreter
  575. #==============================================================================
  576. class Game_Interpreter
  577.   #----------------------------------------------------------------------------
  578.   # ○ new method: add_enemy_entry
  579.   #----------------------------------------------------------------------------
  580.   def add_enemy_entry(enemy_id)
  581.     rpg_enemy = $data_enemies[enemy_id]
  582.     return if rpg_enemy.nil? || rpg_enemy.skip
  583.     if $game_party.bestiary == []
  584.       $game_party.add_enemy($data_enemies[rpg_enemy.shown_id])
  585.     elsif !$game_party.bestiary_include?(rpg_enemy.shown_id)
  586.       $game_party.add_enemy($data_enemies[rpg_enemy.shown_id])
  587.     end
  588.   end
  589.   #----------------------------------------------------------------------------
  590.   # ○ new method: set_enemy_description
  591.   #----------------------------------------------------------------------------
  592.   def set_enemy_description(enemy_id, text)
  593.     id = $data_enemies[enemy_id].shown_id
  594.     $data_enemies[id].description = text
  595.   end
  596.   #----------------------------------------------------------------------------
  597.   # ○ new method: reset_enemy_description
  598.   #----------------------------------------------------------------------------
  599.   def reset_enemy_description(enemy_id)
  600.     id = $data_enemies[enemy_id].shown_id
  601.     $data_enemies[id].description = nil
  602.   end
  603.   #----------------------------------------------------------------------------
  604.   # ○ new method: enemy_kill_count(enemy_id)
  605.   #----------------------------------------------------------------------------
  606.   def enemy_kill_count(enemy_id)
  607.     kills = 0
  608.     $game_party.bestiary.each do |entry|
  609.       next unless entry.enemy_id == $data_enemies[enemy_id].shown_id
  610.       kills = entry.kills
  611.       case kills
  612.       when Venka::Bestiary::Show_Elements
  613.         entry.elements.size.times {|i| entry.elements[i] = true}
  614.       when Venka::Bestiary::Show_States
  615.         entry.states.size.times {|i| entry.states[i] = true}
  616.       end
  617.     end
  618.     return kills
  619.   end
  620. end
  621. #==============================================================================
  622. # ■ Window_Base
  623. #==============================================================================
  624. class Window_Base < Window
  625.   #----------------------------------------------------------------------------
  626.   # ○ new method: set_windowskin
  627.   #----------------------------------------------------------------------------
  628.   def set_windowskin
  629.     return unless Venka::Bestiary::Windowskin
  630.     self.windowskin = Cache.system(Venka::Bestiary::Windowskin)
  631.     self.opacity = Venka::Bestiary::Window_Opacity
  632.     self.back_opacity = Venka::Bestiary::Window_BGOpacity
  633.   end
  634.   #----------------------------------------------------------------------------
  635.   # ○ new method: get_color - method determines if text color or new color
  636.   #----------------------------------------------------------------------------
  637.   def get_color(input)
  638.     input.is_a?(Integer) ? text_color([[input, 0].max, 31].min) : Color.new(*input)
  639.   end
  640.   #----------------------------------------------------------------------------
  641.   # ○ new method: font_color
  642.   #----------------------------------------------------------------------------
  643.   def font_color(text_type)
  644.     f_color = Venka::Bestiary::Fonts[text_type][3]
  645.     color = f_color.is_a?(Integer) ? text_color(f_color) : Color.new(*f_color)
  646.   end
  647.   #----------------------------------------------------------------------------
  648.   # ○ new method: set_bestiary_font
  649.   #----------------------------------------------------------------------------
  650.   def set_bestiary_font(text_type, enabled = true)
  651.     font = Venka::Bestiary::Fonts[text_type]
  652.     contents.font.name = font[0]
  653.     contents.font.size = font[1]
  654.     contents.font.bold = font[2]
  655.     contents.font.outline = font[4]
  656.     change_color(font_color(text_type), enabled)
  657.   end
  658.   #----------------------------------------------------------------------------
  659.   # ○ new method: font_height
  660.   #----------------------------------------------------------------------------
  661.   def font_height
  662.     [contents.font.size, 24].max
  663.   end
  664.   #----------------------------------------------------------------------------
  665.   # ○ new method: draw_line
  666.   #----------------------------------------------------------------------------
  667.   def draw_line(y)
  668.     return unless Venka::Bestiary::Use_Dividers
  669.     color = get_color(Venka::Bestiary::Line_Color)
  670.     contents.fill_rect(4, y, contents_width - 8, 2, color)
  671.     contents.fill_rect(4, y + 2, contents_width - 8, 1, Color.new(16,16,16,100))
  672.   end
  673. end
  674. #==============================================================================
  675. # ■ Window_Message
  676. #==============================================================================
  677. class Window_Message
  678.   #----------------------------------------------------------------------------
  679.   # ♦ Public Instance Variables
  680.   #----------------------------------------------------------------------------
  681.   attr_accessor :wordwrap
  682. end
  683. #==============================================================================
  684. # ■ Window_MenuCommand
  685. #==============================================================================
  686. class Window_MenuCommand < Window_Command
  687.   #----------------------------------------------------------------------------
  688.   # ● alias method: add_original_commands
  689.   #----------------------------------------------------------------------------
  690.   alias bestiary_menu_access_aoc       add_original_commands
  691.   def add_original_commands
  692.     bestiary_menu_access_aoc
  693.     add_command(Venka::Bestiary::Bestiary_Command, :bestiary) if Venka::Bestiary::Menu_Access
  694.   end
  695. end
  696. #==============================================================================
  697. # ■ Window_BattleLog
  698. #==============================================================================
  699. class Window_BattleLog < Window_Selectable
  700.   #----------------------------------------------------------------------------
  701.   # ● alias method: display_failure
  702.   #----------------------------------------------------------------------------
  703.   alias bestiary_scan_fail_msg display_failure
  704.   def display_failure(target, item)
  705.     if item.scan && target.result.hit? && !target.result.success
  706.       text = $data_enemies[target.enemy_id].no_scan ? Vocab::No_Scan : Vocab::Scanned
  707.       add_text(sprintf(text, target.name))
  708.       wait
  709.     else
  710.       bestiary_scan_fail_msg(target, item)
  711.     end
  712.   end
  713. end
  714. #==============================================================================
  715. # ■ Window_BestiaryHelp
  716. #==============================================================================
  717. class Window_BestiaryHelp < Window_Base
  718.   #----------------------------------------------------------------------------
  719.   # ● upgraded method: initialize
  720.   #----------------------------------------------------------------------------
  721.   def initialize(x, y)
  722.     height = [Venka::Bestiary::Fonts[:normal_font][1], 24].max + 24
  723.     super(x, y, Graphics.width, height)
  724.     set_windowskin
  725.   end
  726.   #----------------------------------------------------------------------------
  727.   # ○ new method: set_text
  728.   #----------------------------------------------------------------------------
  729.   def set_text(text)
  730.     contents.clear
  731.     set_bestiary_font(:normal_font)
  732.     draw_text(0, 0, contents.width, font_height, text, 1)
  733.   end
  734.   #----------------------------------------------------------------------------
  735.   # ○ new method: draw_completion
  736.   #----------------------------------------------------------------------------
  737.   def draw_completion
  738.     contents.clear
  739.     draw_enemies_discovered
  740.   end
  741.   #----------------------------------------------------------------------------
  742.   # ○ new method: draw_enemies_discovered
  743.   #----------------------------------------------------------------------------
  744.   def draw_enemies_discovered
  745.     set_bestiary_font(:normal_font)
  746.     enemies_discovered = $game_party.bestiary.size
  747.     total = total_enemies
  748.     text = "#{enemies_discovered}/#{total} #{Venka::Bestiary::Discovered_Text}"
  749.     draw_text(0, 0, contents.width, font_height, text)
  750.     discovered = (enemies_discovered.to_f / total) * 100
  751.     text = "#{discovered.round(1)}% #{Venka::Bestiary::Percent_Finished}"
  752.     draw_text(0, 0, contents.width, font_height, text, 2)
  753.   end
  754.   #----------------------------------------------------------------------------
  755.   # ○ new method: total_enemies
  756.   #----------------------------------------------------------------------------
  757.   def total_enemies
  758.     total = 0
  759.     for i in 1...$data_enemies.size
  760.       next if $data_enemies[i].shown_id != $data_enemies[i].id
  761.       total += 1 unless $data_enemies[i].skip
  762.     end
  763.     total
  764.   end
  765.   #----------------------------------------------------------------------------
  766.   # ○ new method: draw_instructions
  767.   #----------------------------------------------------------------------------
  768.   def draw_instructions
  769.     contents.clear
  770.     set_bestiary_font(:normal_font)
  771.     text = Venka::Bestiary::Instructions_Text
  772.     draw_text(0, 0, contents.width, font_height, text, 1)
  773.   end
  774.   #----------------------------------------------------------------------------
  775.   # ○ new method: set_description
  776.   #----------------------------------------------------------------------------
  777.   def set_description(enemy)
  778.     contents.clear
  779.     create_contents             # Remake contents since the window size changed
  780.     get_description_text(enemy)
  781.     text = get_description_text(enemy)
  782.     if Venka::Bestiary::Use_Wordwrapper
  783.       wrapping = @wordwrap
  784.       @wordwrap = true
  785.       draw_text_ex(0, 0, text.gsub(/[|]/, ""))
  786.       @wordwrap = wrapping
  787.     else
  788.       draw_text_ex(0, 0, text.gsub(/[|]/, "\n"))
  789.     end
  790.   end
  791.   #----------------------------------------------------------------------------
  792.   # ○ new method: get_description_text
  793.   #----------------------------------------------------------------------------
  794.   def get_description_text(enemy)
  795.     if enemy.description
  796.       text = enemy.description
  797.     else
  798.       text = Venka::Bestiary::Default_Description
  799.       kills = 0
  800.       $game_party.bestiary.each do |foe|
  801.         kills = foe.kills if foe.enemy_id == enemy.shown_id
  802.       end
  803.       if kills >= Venka::Bestiary::Description3 && enemy.descript3
  804.         text = enemy.descript3
  805.       elsif kills >= Venka::Bestiary::Description2 && enemy.descript2
  806.         text = enemy.descript2
  807.       elsif kills >= Venka::Bestiary::Description1 && enemy.descript1
  808.         text = enemy.descript1
  809.       end
  810.     end
  811.     text
  812.   end
  813.   #----------------------------------------------------------------------------
  814.   # ● upgraded method: draw_text_ex
  815.   #----------------------------------------------------------------------------
  816.   def draw_text_ex(x, y, text)
  817.     set_bestiary_font(:description)
  818.     text = convert_escape_characters(text)
  819.     pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
  820.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  821.   end
  822. end
  823. #==============================================================================
  824. # ■ Window_BestiaryCategory
  825. #==============================================================================
  826. class Window_BestiaryCategory < Window_Command
  827.   #----------------------------------------------------------------------------
  828.   # ● upgraded method: initialize
  829.   #----------------------------------------------------------------------------
  830.   def initialize(x, y)
  831.     @wy = y
  832.     @categories = Venka::Bestiary::Category
  833.     super(x, @wy)
  834.     set_windowskin
  835.   end
  836.   #----------------------------------------------------------------------------
  837.   # ● window settings
  838.   #----------------------------------------------------------------------------
  839.   def window_width;  Graphics.width * 0.5;                                end
  840.   def window_height; Graphics.height - (@wy * 2);                         end
  841.   def item_height;   [Venka::Bestiary::Fonts[:list_font][1], 24].max;     end
  842.   #----------------------------------------------------------------------------
  843.   # ● upgraded method: make_command_list
  844.   #----------------------------------------------------------------------------
  845.   def make_command_list
  846.     @categories.each{|key, info| add_command(info[:name], key)}
  847.   end
  848.   #----------------------------------------------------------------------------
  849.   # ● upgraded method: draw_item
  850.   #----------------------------------------------------------------------------
  851.   def draw_item(index)
  852.     set_bestiary_font(:normal_font)
  853.     @width = Venka::Bestiary::Track_Progress ? text_size("99.9%").width + 5 : 0
  854.     rect = item_rect_for_text(index)
  855.     set_bestiary_font(:list_font)
  856.     draw_text(rect.x, rect.y, rect.width - @width, rect.height, command_name(index))
  857.     found_text(index,  rect) if Venka::Bestiary::Track_Progress
  858.   end
  859.   #----------------------------------------------------------------------------
  860.   # ○ new method: found_text
  861.   #----------------------------------------------------------------------------
  862.   def found_text(index,  rect)
  863.     set_bestiary_font(:normal_font)
  864.     total = total_enemies(index)
  865.     discovered = total_found(index)
  866.     value = (total > 0) ? (discovered.to_f / total) * 100 : 0.0
  867.     text = (value > 0 && value < 100) ? value.round(1) : value.round
  868.     draw_text(rect.width - @width, rect.y, @width, rect.height, "#{text}%", 2)
  869.   end
  870.   #----------------------------------------------------------------------------
  871.   # ○ new method: total_enemies
  872.   #----------------------------------------------------------------------------
  873.   def total_enemies(index)
  874.     total = 0
  875.     for i in 1...$data_enemies.size
  876.       next unless $data_enemies[i].category.include?(index)
  877.       next if $data_enemies[i].shown_id != $data_enemies[i].id
  878.       total += 1 unless $data_enemies[i].skip
  879.     end
  880.     return total
  881.   end
  882.   #----------------------------------------------------------------------------
  883.   # ○ new method: total_found
  884.   #----------------------------------------------------------------------------
  885.   def total_found(index)
  886.     total = 0
  887.     $game_party.bestiary.each {|e| total += 1 if e.category.include?(index)}
  888.     return total
  889.   end
  890. end
  891. #==============================================================================
  892. # ■ Window_BestiaryEnemyList
  893. #==============================================================================
  894. class Window_BestiaryEnemyList < Window_Command
  895.   #----------------------------------------------------------------------------
  896.   # ♦ Public Instance Variables
  897.   #----------------------------------------------------------------------------
  898.   attr_reader   :category_window,    :stats_window
  899.   #----------------------------------------------------------------------------
  900.   # ● upgraded method: initialize
  901.   #----------------------------------------------------------------------------
  902.   def initialize(x, y)
  903.     @category = 0
  904.     @wy = y
  905.     super(x, @wy)
  906.     set_windowskin
  907.   end
  908.   #----------------------------------------------------------------------------
  909.   # ● window settings
  910.   #----------------------------------------------------------------------------
  911.   def window_width;  Graphics.width * 0.5;                                end
  912.   def window_height; Graphics.height - (@wy * 2);                         end
  913.   def item_height;   [Venka::Bestiary::Fonts[:list_font][1], 24].max;     end
  914.   #----------------------------------------------------------------------------
  915.   # ○ new method: category_window
  916.   #----------------------------------------------------------------------------
  917.   def category_window=(category_window)
  918.     if @category_window != category_window
  919.       @category_window = category_window
  920.       @category = category_window.current_symbol.to_s.to_i
  921.       refresh
  922.     end
  923.   end
  924.   #----------------------------------------------------------------------------
  925.   # ○ new method: stats_window
  926.   #----------------------------------------------------------------------------
  927.   def stats_window=(stats_window)
  928.     if @stats_window != stats_window
  929.       @stats_window = stats_window
  930.     end
  931.   end
  932.   #----------------------------------------------------------------------------
  933.   # ● upgraded method: make_command_list
  934.   #----------------------------------------------------------------------------
  935.   def make_command_list
  936.     @enemies = []
  937.     sort_list
  938.     @bestiary_list.each do |enemy|
  939.       next if enemy.nil?
  940.       next unless enemy.category.include?(@category)
  941.       @enemies << enemy
  942.       add_command($data_enemies[enemy.enemy_id].name, :ok, true, enemy.enemy_id)
  943.     end
  944.   end
  945.   #----------------------------------------------------------------------------
  946.   # ○ new method: sort_list
  947.   #----------------------------------------------------------------------------
  948.   def sort_list
  949.     @bestiary_list = $game_party.bestiary.clone
  950.     if Venka::Bestiary::Sort_Type == :id                # Sort by enemy id
  951.       @bestiary_list.sort!{|a, b| a.enemy_id <=> b.enemy_id}
  952.     elsif Venka::Bestiary::Sort_Type == :name           # Sort by name
  953.       @bestiary_list.sort!{|a, b|
  954.         $data_enemies[a.enemy_id].name <=> $data_enemies[b.enemy_id].name}
  955.     end
  956.   end
  957.   #----------------------------------------------------------------------------
  958.   # ● upgraded method: draw_item
  959.   #----------------------------------------------------------------------------
  960.   def draw_item(index)
  961.     set_bestiary_font(:normal_font)
  962.     @width = contents_width * 0.33
  963.     @width = 0 unless Venka::Bestiary::Track_Kills
  964.     rect = item_rect_for_text(index)
  965.     set_bestiary_font(:list_font)
  966.     draw_text(rect.x, rect.y, rect.width - @width, rect.height, command_name(index))
  967.     draw_kills(index) if Venka::Bestiary::Track_Kills
  968.   end
  969.   #----------------------------------------------------------------------------
  970.   # ○ new method: draw_kills
  971.   #----------------------------------------------------------------------------
  972.   def draw_kills(index)
  973.     set_bestiary_font(:normal_font)
  974.     text = "#{@enemies[index].kills} #{Venka::Bestiary::Kills_Text}"
  975.     draw_text(item_rect_for_text(index), text, 2)
  976.   end
  977.   #----------------------------------------------------------------------------
  978.   # ● upgraded method: update
  979.   #----------------------------------------------------------------------------
  980.   def update
  981.     super
  982.     if @category_window && @category != @category_window.current_symbol.to_s.to_i
  983.       @category = @category_window.current_symbol.to_s.to_i
  984.       refresh
  985.     end
  986.   end
  987. end
  988. #==============================================================================
  989. # ■ Window_BestiaryStatSelection
  990. #==============================================================================
  991. class Window_BestiaryStatSelection < Window_Selectable
  992.   #----------------------------------------------------------------------------
  993.   # ● upgraded method: initialize
  994.   #----------------------------------------------------------------------------
  995.   def initialize(x, y, width, height)
  996.     super(x, y, width, height)
  997.     set_windowskin
  998.     select(0)
  999.     hide
  1000.     refresh
  1001.   end
  1002.   #----------------------------------------------------------------------------
  1003.   # ● window settings;
  1004.   #----------------------------------------------------------------------------
  1005.   def col_max;     return item_max;                                         end
  1006.   def spacing;     return 5;                                                end
  1007.   def item_height; [Venka::Bestiary::Fonts[:normal_font][1].size, 24].max;  end
  1008.   #----------------------------------------------------------------------------
  1009.   # ● upgraded method: item_max
  1010.   #----------------------------------------------------------------------------
  1011.   def item_max
  1012.     if SceneManager.scene_is?(Scene_Battle)
  1013.       Venka::Bestiary::Show_Debuff_Info ? 4 : 3
  1014.     else
  1015.       return 2
  1016.     end
  1017.   end
  1018.   #----------------------------------------------------------------------------
  1019.   # ○ new method: enemy_id
  1020.   #----------------------------------------------------------------------------
  1021.   def enemy_id=(enemy_id)
  1022.     return @enemy = nil if enemy_id == 0
  1023.     if @enemy != $data_enemies[enemy_id]
  1024.       @enemy = $data_enemies[enemy_id]
  1025.       refresh
  1026.     end
  1027.   end
  1028.   #----------------------------------------------------------------------------
  1029.   # ● upgraded method: item_rect
  1030.   #----------------------------------------------------------------------------
  1031.   def item_rect(index)
  1032.     rect = super
  1033.     if SceneManager.scene_is?(Scene_Battle)
  1034.       rect.y += [Venka::Bestiary::Fonts[:normal_font][1], 24].max + 6
  1035.     end
  1036.     rect
  1037.   end
  1038.   #----------------------------------------------------------------------------
  1039.   # ● upgraded method: draw_item
  1040.   #----------------------------------------------------------------------------
  1041.   def draw_item(index)
  1042.     rect = item_rect_for_text(index)
  1043.     if SceneManager.scene_is?(Scene_Battle)
  1044.       text = [Venka::Bestiary::View_Stats, Venka::Bestiary::View_Element,
  1045.               Venka::Bestiary::View_States, Venka::Bestiary::View_Debuff]
  1046.     else
  1047.       text = [Venka::Bestiary::View_Stats, Venka::Bestiary::View_More]
  1048.     end
  1049.     set_bestiary_font(:normal_font)
  1050.     draw_text(rect, text[index], 1)
  1051.   end
  1052.   #----------------------------------------------------------------------------
  1053.   # ● upgraded method: refresh
  1054.   #----------------------------------------------------------------------------
  1055.   def refresh
  1056.     contents.clear
  1057.     if SceneManager.scene_is?(Scene_Battle)
  1058.       set_bestiary_font(:normal_font)
  1059.       @y = font_height
  1060.       draw_enemy_name if @enemy
  1061.     end
  1062.     draw_all_items
  1063.   end
  1064.   #----------------------------------------------------------------------------
  1065.   # ○ new method: draw_enemy_name
  1066.   #----------------------------------------------------------------------------
  1067.   def draw_enemy_name
  1068.     draw_text(0, 0, contents.width, font_height, @enemy.name, 1)
  1069.     draw_line(@y + 2)
  1070.     @y += 6
  1071.     draw_line(@y + item_height + 3)
  1072.   end
  1073.   #----------------------------------------------------------------------------
  1074.   # ● upgraded method: update_help
  1075.   #----------------------------------------------------------------------------
  1076.   def update_help
  1077.     @help_window.set_index(@index)
  1078.   end
  1079.   #----------------------------------------------------------------------------
  1080.   # ● upgraded method: select
  1081.   #----------------------------------------------------------------------------
  1082.   def select(index)
  1083.     super
  1084.     @help_window.oy = 0 if @help_window
  1085.   end
  1086.   #----------------------------------------------------------------------------
  1087.   # ● upgraded method: cursor_down
  1088.   #----------------------------------------------------------------------------
  1089.   def cursor_down(wrap = false)
  1090.     super
  1091.     if @help_window && display_window_oy < @help_window.total_height
  1092.       @help_window.oy += Venka::Bestiary::Scroll_Speed
  1093.     end
  1094.   end
  1095.   #----------------------------------------------------------------------------
  1096.   # ○ new method: display_window_oy
  1097.   #----------------------------------------------------------------------------
  1098.   def display_window_oy
  1099.     @help_window.oy + @help_window.height - (@help_window.standard_padding * 2)
  1100.   end
  1101.   #----------------------------------------------------------------------------
  1102.   # ● upgraded method: cursor_up
  1103.   #----------------------------------------------------------------------------
  1104.   def cursor_up(wrap = false)
  1105.     super
  1106.     @help_window.oy -= Venka::Bestiary::Scroll_Speed if @help_window && @help_window.oy > 0
  1107.   end
  1108.   #----------------------------------------------------------------------------
  1109.   # ○ new method: wait_to_close
  1110.   #----------------------------------------------------------------------------
  1111.   def wait_to_close
  1112.     loop do
  1113.       Graphics.update
  1114.       Input.update
  1115.       update
  1116.       break if Input.trigger?(:C) || Input.trigger?(:B)
  1117.     end
  1118.     @help_window.hide
  1119.     deactivate
  1120.     self.hide
  1121.   end
  1122. end
  1123. #==============================================================================
  1124. # ■ Window_BestiaryStats
  1125. #==============================================================================
  1126. class Window_BestiaryStats < Window_Base
  1127.   #----------------------------------------------------------------------------
  1128.   # ♦ Public Instance Variables
  1129.   #----------------------------------------------------------------------------
  1130.   attr_accessor   :enemy, :total_height
  1131.   #----------------------------------------------------------------------------
  1132.   # ● upgraded method: initialize
  1133.   #----------------------------------------------------------------------------
  1134.   def initialize(x, y, width, height)
  1135.     @win_height = height
  1136.     super(x, y, width, height)
  1137.     self.opacity = 0
  1138.     @enemy = nil
  1139.     hide
  1140.   end
  1141.   #----------------------------------------------------------------------------
  1142.   # ○ new method: enemy_id
  1143.   #----------------------------------------------------------------------------
  1144.   def enemy_id=(enemy_id)
  1145.     return @enemy = nil if enemy_id == 0
  1146.     if @enemy != $data_enemies[enemy_id]
  1147.       @enemy = $data_enemies[enemy_id]
  1148.       refresh
  1149.     end
  1150.   end
  1151.   #----------------------------------------------------------------------------
  1152.   # ○ new method: set_index
  1153.   #----------------------------------------------------------------------------
  1154.   def set_index(index)
  1155.     if @index != index
  1156.       @index = index
  1157.       refresh
  1158.     end
  1159.   end
  1160.   #----------------------------------------------------------------------------
  1161.   # ● upgraded method: contents_height
  1162.   #----------------------------------------------------------------------------
  1163.   def contents_height
  1164.     @total_height ? @total_height : super
  1165.   end
  1166.   #----------------------------------------------------------------------------
  1167.   # ● upgraded method: refresh
  1168.   #----------------------------------------------------------------------------
  1169.   def refresh
  1170.     contents.clear
  1171.     return if @enemy.nil?
  1172.     if SceneManager.scene_is?(Scene_Bestiary)
  1173.       @index == 0 ? draw_basic_stats : draw_other_info
  1174.     end
  1175.   end
  1176.   #----------------------------------------------------------------------------
  1177.   # ○ new method: determine_window_height
  1178.   #----------------------------------------------------------------------------
  1179.   def determine_window_height(text_lines)
  1180.     set_bestiary_font(:header_font)
  1181.     @total_height = font_height * text_lines
  1182.     self.height = ([(@total_height + standard_padding * 2), @win_height].min)
  1183.     create_contents
  1184.   end
  1185.   #----------------------------------------------------------------------------
  1186.   # ○ new method: info_rect
  1187.   #----------------------------------------------------------------------------
  1188.   def info_rect(index)
  1189.     rect = Rect.new
  1190.     rect.width = contents.width * 0.5 - 3
  1191.     rect.height = [Venka::Bestiary::Fonts[:stat_name][1], 24].max
  1192.     rect.x = index % 2 * (rect.width + 3)
  1193.     rect.y = index / 2 * font_height
  1194.     rect
  1195.   end
  1196.   #----------------------------------------------------------------------------
  1197.   # ○ new method: draw_basic_stats
  1198.   #----------------------------------------------------------------------------
  1199.   def draw_basic_stats
  1200.     elements = Venka::Bestiary::Elements.size
  1201.     states = Venka::Bestiary::States.size
  1202.     # Get the total text lines to show
  1203.     height = (elements / 2 + elements % 2) + (states / 2 + states % 2) + 10
  1204.     height += 6 if Venka::Bestiary::Show_Debuff_Info
  1205.     determine_window_height(height)
  1206.     draw_line(5)
  1207.     @y = 12
  1208.     draw_main_stats
  1209.     draw_line(@y + 5)
  1210.     @y += 12
  1211.     get_revealed_resists
  1212.     draw_elements
  1213.     draw_line(@y + 5)
  1214.     @y += 12
  1215.     draw_states
  1216.     return unless Venka::Bestiary::Show_Debuff_Info
  1217.     draw_line(@y + 5)
  1218.     @y += 12
  1219.     draw_debuffs
  1220.   end
  1221.   #----------------------------------------------------------------------------
  1222.   # ○ new method: draw_main_stats
  1223.   #----------------------------------------------------------------------------
  1224.   def draw_main_stats
  1225.     set_bestiary_font(:header_font)
  1226.     draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Stats_Text, 1)
  1227.     @y += font_height
  1228.     8.times {|stat| draw_stat(stat, :stat)}
  1229.     @y += info_rect(0).height * 4
  1230.   end
  1231.   #----------------------------------------------------------------------------
  1232.   # ○ new method: draw_stat
  1233.   #----------------------------------------------------------------------------
  1234.   def draw_stat(stat, stat_type)
  1235.     rect = info_rect(stat)
  1236.     rect.y += @y
  1237.     stat_info = Venka::Bestiary::Base_Stats[stat]
  1238.     if stat_info[1]
  1239.       draw_icon(stat_info[1], rect.x, rect.y)
  1240.       rect.x += 25;            rect.width -= 25
  1241.     end
  1242.     if stat_info[0]
  1243.       set_bestiary_font(:stat_name)
  1244.       draw_text(rect, stat_info[0])
  1245.       text_width = text_size(stat_info[0]).width + 5
  1246.       rect.x += text_width;    rect.width -= text_width
  1247.     end
  1248.     set_bestiary_font(:stats_font)
  1249.     text = Venka::Bestiary::Unknown_Stat
  1250.     $game_party.bestiary.each do |entry|
  1251.       next unless entry.enemy_id == @enemy.shown_id
  1252.       if stat_type == :stat && (entry.scanned ||
  1253.             entry.kills >= Venka::Bestiary::Show_BaseStats)
  1254.         text = Game_Enemy.new(0, @enemy.shown_id).param(stat)
  1255.       elsif stat_type == :debuff && (entry.scanned ||
  1256.             entry.kills >= Venka::Bestiary::Show_DebuffStats)
  1257.         rate = Game_Enemy.new(0, @enemy.shown_id).debuff_rate(stat)
  1258.         text = get_resist_info(stat, rate)
  1259.       end
  1260.     end
  1261.     draw_text(rect, text, 2)
  1262.   end
  1263.   #----------------------------------------------------------------------------
  1264.   # ○ new method: get_revealed_resists
  1265.   #----------------------------------------------------------------------------
  1266.   def get_revealed_resists
  1267.     $game_party.bestiary.each do |entry|
  1268.       @eles = entry.elements if entry.enemy_id == @enemy.shown_id
  1269.       @states = entry.states if entry.enemy_id == @enemy.shown_id
  1270.     end
  1271.   end
  1272.   #----------------------------------------------------------------------------
  1273.   # ○ new method: draw_elements
  1274.   #----------------------------------------------------------------------------
  1275.   def draw_elements
  1276.     set_bestiary_font(:header_font)
  1277.     draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Element_Text, 1)
  1278.     @y += font_height
  1279.     elements = Venka::Bestiary::Elements
  1280.     (elements.size).times {|i| draw_ele_info(i, elements[i], info_rect(i))}
  1281.     @y += (info_rect(0).height) * (elements.size * 0.5 + elements.size % 2)
  1282.   end
  1283.   #----------------------------------------------------------------------------
  1284.   # ○ new method: draw_ele_info
  1285.   #----------------------------------------------------------------------------
  1286.   def draw_ele_info(i, element, rect)
  1287.     rect.y += @y
  1288.     if element[1]
  1289.       draw_icon(element[1], rect.x, rect.y)
  1290.       rect.x += 25;            rect.width -= 25
  1291.     end
  1292.     set_bestiary_font(:stat_name)
  1293.     tw = text_size(99).width + 5
  1294.     draw_text(rect, $data_system.elements[element[0]])
  1295.     text_width = text_size(element[0]).width + 5
  1296.     # Scale text so the value will fit as well in small resolutions
  1297.     rect.x = [(rect.x + text_width), (rect.x + rect.width - tw)].min
  1298.     rect.width = [(rect.width - text_width), tw].max
  1299.     set_bestiary_font(:stats_font)
  1300.     text = @eles[i] ? get_resist_info(element[0], 11) : Venka::Bestiary::Unknown_Stat
  1301.     draw_text(rect, text, 2)
  1302.   end
  1303.   #----------------------------------------------------------------------------
  1304.   # ○ new method: get_resist_info
  1305.   #----------------------------------------------------------------------------
  1306.   def get_resist_info(stat_id, code_id)
  1307.     case code_id
  1308.     when 11   # Element
  1309.       resist = Game_Enemy.new(0, @enemy.shown_id).element_rate(stat_id)
  1310.       if $imported["YEA-Element Absorb"] && Game_Enemy.new(0, @enemy.shown_id).element_absorb?(stat_id)
  1311.         set_resist_style(resist, Venka::Bestiary::Absorb_Text)
  1312.       else
  1313.         set_resist_style(resist)
  1314.       end
  1315.     when 13
  1316.       enemy = Game_Enemy.new(0, @enemy.shown_id)
  1317.       if enemy.features_with_id(14, stat_id).empty?
  1318.         resist = enemy.state_rate(stat_id)
  1319.         set_resist_style(resist)
  1320.       else
  1321.         set_resist_style(1.0, Venka::Bestiary::Immune_Text)
  1322.       end
  1323.     else
  1324.       set_resist_style(code_id)
  1325.     end
  1326.   end
  1327.   #----------------------------------------------------------------------------
  1328.   # ○ new method: set_resist_style
  1329.   #----------------------------------------------------------------------------
  1330.   def set_resist_style(resist, text = "")
  1331.     if text != ""
  1332.       color = Venka::Bestiary::Immunity_Color
  1333.     else
  1334.       color = Venka::Bestiary::Fonts[:stats_font][3]
  1335.       color = Venka::Bestiary::High_Resist if resist > 1.0
  1336.       color = Venka::Bestiary::Low_Resist  if resist < 1.0
  1337.       resist -= 1.0 if resist >= 1.0
  1338.       text = (resist * 100).round
  1339.     end
  1340.     new_color = color.is_a?(Integer) ? text_color(color) : Color.new(*color)
  1341.     change_color(new_color)
  1342.     return text
  1343.   end
  1344.   #----------------------------------------------------------------------------
  1345.   # ○ new method: draw_states
  1346.   #----------------------------------------------------------------------------
  1347.   def draw_states
  1348.     set_bestiary_font(:header_font)
  1349.     draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Status_Text, 1)
  1350.     @y += font_height
  1351.     states = Venka::Bestiary::States
  1352.     (states.size).times {|i| draw_state_info(i, states[i], info_rect(i))}
  1353.     @y += (info_rect(0).height) * (states.size / 2).round
  1354.   end
  1355.   #----------------------------------------------------------------------------
  1356.   # ○ new method: draw_state_info
  1357.   #----------------------------------------------------------------------------
  1358.   def draw_state_info(i, state_id, rect)
  1359.     state = $data_states[state_id]
  1360.     rect.y += @y
  1361.     draw_icon(state.icon_index, rect.x, rect.y)
  1362.     rect.x += 25;            rect.width -= 25
  1363.     set_bestiary_font(:stat_name)
  1364.     tw = text_size(99).width + 5
  1365.     draw_text(rect.x, rect.y, rect.width - tw, rect.height, state.name)
  1366.     text_width = text_size(state.name).width + 5
  1367.     # Scale text so the value will fit as well in small resolutions
  1368.     rect.x = [(rect.x + text_width), (rect.x + rect.width - tw)].min
  1369.     rect.width = [(rect.width - text_width), tw].max
  1370.     set_bestiary_font(:stats_font)
  1371.     text = @states[i] ? get_resist_info(state_id, 13) : Venka::Bestiary::Unknown_Stat
  1372.     draw_text(rect, text, 2)
  1373.   end
  1374.   #----------------------------------------------------------------------------
  1375.   # ○ new method: draw_debuffs
  1376.   #----------------------------------------------------------------------------
  1377.   def draw_debuffs
  1378.     set_bestiary_font(:header_font)
  1379.     draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Debuff_Text, 1)
  1380.     @y += font_height
  1381.     8.times do |stat|
  1382.       draw_stat(stat, :debuff)
  1383.     end
  1384.   end
  1385.   #----------------------------------------------------------------------------
  1386.   # ○ new method: draw_other_info
  1387.   #----------------------------------------------------------------------------
  1388.   def draw_other_info
  1389.     # Get the number of lines to display loot
  1390.     drops = @enemy.drop_items.select {|d| d.kind > 0 }
  1391.     # Get the number of lines to display enemy skills
  1392.     ids = []
  1393.     @enemy.actions.each do |action|
  1394.       ids << action.skill_id unless ids.include?(action.skill_id)
  1395.     end
  1396.     # Total number of lines to display with skills, loot, headers, etc
  1397.     height = 5 + drops.size + ids.size
  1398.     determine_window_height(height)
  1399.     draw_line(5)
  1400.     @y = 12
  1401.     set_bestiary_font(:header_font)
  1402.     draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Loot_Text, 1)
  1403.     @y += font_height
  1404.     draw_exp_and_gold
  1405.     draw_drops
  1406.     draw_skills
  1407.   end
  1408.   #----------------------------------------------------------------------------
  1409.   # ○ new method: draw_exp
  1410.   #----------------------------------------------------------------------------
  1411.   def draw_exp_and_gold
  1412.     exp  = Venka::Bestiary::Exp_Text
  1413.     gold = Venka::Bestiary::Gold_Text
  1414.     width = contents.width
  1415.     width = ((@enemy.exp > 0 || @enemy.gold > 0) ? width * 0.5 : width).to_i
  1416.     draw_icon_text(exp, 0, width, @enemy.exp)   if @enemy.exp > 0
  1417.     x = @enemy.exp > 0 ? width : 0
  1418.     draw_icon_text(gold, x, width, @enemy.gold) if @enemy.gold > 0
  1419.     @y += font_height
  1420.   end
  1421.   #----------------------------------------------------------------------------
  1422.   # ○ new method: draw_icon_and_text
  1423.   #----------------------------------------------------------------------------
  1424.   def draw_icon_text(info, x, width, amount)
  1425.     draw_icon(info[1], x, @y) if info[1]
  1426.     dx = info[1] ? 25 : 0
  1427.     set_bestiary_font(:stat_name)
  1428.     draw_text(x + dx, @y, width - dx, font_height, info[0])
  1429.     set_bestiary_font(:stats_font)
  1430.     dx += text_size(info[0]).width + 10
  1431.     draw_text(x + dx, @y, width - dx, font_height, amount)
  1432.   end
  1433.   #----------------------------------------------------------------------------
  1434.   # ○ new method: draw_drops
  1435.   #----------------------------------------------------------------------------
  1436.   def draw_drops
  1437.     drops_revealed = false
  1438.     $game_party.bestiary.each do |entry|
  1439.       next unless entry.enemy_id == @enemy.shown_id
  1440.       if entry.scanned || entry.kills >= Venka::Bestiary::Show_Loot
  1441.         drops_revealed = true
  1442.       end
  1443.     end
  1444.     if drops_revealed
  1445.       @enemy.drop_items.each do |drop_info|
  1446.         next if drop_info.kind == 0
  1447.         item = $data_items[drop_info.data_id]   if drop_info.kind == 1
  1448.         item = $data_weapons[drop_info.data_id] if drop_info.kind == 2
  1449.         item = $data_armors[drop_info.data_id]  if drop_info.kind == 3
  1450.         set_bestiary_font(:stat_name)
  1451.         tw = text_size("100%").width + 5
  1452.         draw_item_name(item, 0, @y, contents.width - tw)
  1453.         chance = (1.to_f / drop_info.denominator) * 100
  1454.         chance = (chance > 0.9) ? chance.round : chance.round(1)
  1455.         set_bestiary_font(:stats_font)
  1456.         draw_text(0, @y, contents.width, font_height, "#{chance}%", 2)
  1457.         @y += font_height
  1458.       end
  1459.     else
  1460.       set_bestiary_font(:stat_name)
  1461.       draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Unknown_Loot)
  1462.       @y += font_height
  1463.     end
  1464.     draw_line(@y + 5)
  1465.     @y += 12
  1466.   end
  1467.   #----------------------------------------------------------------------------
  1468.   # ○ new method: draw_skills
  1469.   #----------------------------------------------------------------------------
  1470.   def draw_skills
  1471.     set_bestiary_font(:header_font)
  1472.     draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Skill_Text, 1)
  1473.     @y += font_height
  1474.     set_bestiary_font(:stat_name)
  1475.     skills_revealed = false
  1476.     $game_party.bestiary.each do |entry|
  1477.       next unless entry.enemy_id == @enemy.shown_id
  1478.       if entry.scanned || entry.kills >= Venka::Bestiary::Show_Abilities
  1479.         skills_revealed = true
  1480.       end
  1481.     end
  1482.     if skills_revealed
  1483.       skills.each do |id|
  1484.         draw_item_name($data_skills[id], 0, @y, contents.width)
  1485.         @y += font_height
  1486.       end
  1487.     else
  1488.       draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Unknown_Skills)
  1489.     end
  1490.   end
  1491.   #----------------------------------------------------------------------------
  1492.   # ○ new method: skills
  1493.   #----------------------------------------------------------------------------
  1494.   def skills
  1495.     ids = []
  1496.     @enemy.actions.each do |action|
  1497.       ids << action.skill_id unless ids.include?(action.skill_id)
  1498.     end
  1499.     return ids
  1500.   end
  1501. end
  1502. #==============================================================================
  1503. # ■ Window_BattleScan
  1504. #==============================================================================
  1505. class Window_BattleScan < Window_BestiaryStats
  1506.   #----------------------------------------------------------------------------
  1507.   # ♦ Public Instance Variables
  1508.   #----------------------------------------------------------------------------
  1509.   attr_accessor    :show_stats
  1510.   #----------------------------------------------------------------------------
  1511.   # ● upgraded method: initialize
  1512.   #----------------------------------------------------------------------------
  1513.   def initialize(x, y, width, height)
  1514.     super(x, y, width, height)
  1515.   end
  1516.   #----------------------------------------------------------------------------
  1517.   # ● upgraded method: refresh
  1518.   #----------------------------------------------------------------------------
  1519.   def refresh
  1520.     contents.clear
  1521.     return if @enemy.nil?
  1522.     if $game_party.bestiary_include?(@enemy.shown_id)
  1523.       @y = 0
  1524.       case @index
  1525.       when 0; draw_basic_stats
  1526.       when 1; draw_enemy_resists
  1527.       when 2; draw_enemy_states
  1528.       when 3; draw_debuff_rates
  1529.       end
  1530.     else
  1531.       set_bestiary_font(:stat_name)
  1532.       text = Venka::Bestiary::No_Info
  1533.       draw_text(0, 0, contents.width, contents.height, text, 1)
  1534.     end
  1535.   end
  1536.   #----------------------------------------------------------------------------
  1537.   # ○ new method: draw_basic_stats
  1538.   #----------------------------------------------------------------------------
  1539.   def draw_basic_stats
  1540.     determine_window_height(4)
  1541.     8.times {|stat| draw_stat(stat, :stat)}
  1542.   end
  1543.   #----------------------------------------------------------------------------
  1544.   # ○ new method: draw_enemy_resists
  1545.   #----------------------------------------------------------------------------
  1546.   def draw_enemy_resists
  1547.     elements = Venka::Bestiary::Elements
  1548.     height = (elements.size / 2) + (elements.size % 2)
  1549.     determine_window_height(height)
  1550.     get_revealed_resists
  1551.     (elements.size).times {|i| draw_ele_info(i, elements[i], info_rect(i))}
  1552.   end
  1553.   #----------------------------------------------------------------------------
  1554.   # ○ new method: draw_enemy_states
  1555.   #----------------------------------------------------------------------------
  1556.   def draw_enemy_states
  1557.     states = Venka::Bestiary::States
  1558.     height = (states.size / 2) + (states.size % 2)
  1559.     determine_window_height(height)
  1560.     (states.size).times {|i| draw_state_info(i, states[i], info_rect(i))}
  1561.   end
  1562.   #----------------------------------------------------------------------------
  1563.   # ○ new method: draw_debuff_rates
  1564.   #----------------------------------------------------------------------------
  1565.   def draw_debuff_rates
  1566.     determine_window_height(4)
  1567.     8.times {|stat| draw_stat(stat, :debuff)}
  1568.   end
  1569. end
  1570. #==============================================================================
  1571. # ■ Scene_Menu
  1572. #==============================================================================
  1573. class Scene_Menu < Scene_MenuBase
  1574.   #----------------------------------------------------------------------------
  1575.   # ● alias method: create_command_window
  1576.   #----------------------------------------------------------------------------
  1577.   alias bestiary_menu_access_ccw       create_command_window
  1578.   def create_command_window
  1579.     bestiary_menu_access_ccw
  1580.     @command_window.set_handler(:bestiary,  method(:command_bestiary))
  1581.   end
  1582.   #----------------------------------------------------------------------------
  1583.   # ○ new method: command_bestiary
  1584.   #----------------------------------------------------------------------------
  1585.   def command_bestiary
  1586.     SceneManager.call(Scene_Bestiary)
  1587.   end
  1588. end
  1589. #==============================================================================
  1590. # ■ Scene_Battle
  1591. #==============================================================================
  1592. class Scene_Battle < Scene_Base
  1593.   #----------------------------------------------------------------------------
  1594.   # ● alias method: create_all_windows
  1595.   #----------------------------------------------------------------------------
  1596.   alias scan_window_caw create_all_windows
  1597.   def create_all_windows
  1598.     scan_window_caw
  1599.     create_info_instructions
  1600.     create_stats_selection
  1601.     create_stats_window
  1602.   end
  1603.   #----------------------------------------------------------------------------
  1604.   # ○ new method: create_stats_selection
  1605.   #----------------------------------------------------------------------------
  1606.   def create_stats_selection
  1607.     width = [Graphics.width * 0.6, 420].max
  1608.     x = (Graphics.width - width) * 0.5
  1609.     # Get total height of the window since it can change based on fonts used.
  1610.     height = 40 + ([Venka::Bestiary::Fonts[:normal_font][1], 24].max * 2) +
  1611.          ([Venka::Bestiary::Fonts[:stat_name][1], 24].max * 4)
  1612.     y = (Graphics.height - @status_window.height - height) * 0.5
  1613.     @stats_selection = Window_BestiaryStatSelection.new(x, y, width, height)
  1614.   end
  1615.   #----------------------------------------------------------------------------
  1616.   # ○ new method: create_stats_window
  1617.   #----------------------------------------------------------------------------
  1618.   def create_stats_window
  1619.     y = @stats_selection.y + @stats_selection.item_height + 15 +
  1620.         Venka::Bestiary::Fonts[:normal_font][1]
  1621.     # Make the info window the same height as the selection window minus the
  1622.     # header info and selection area.
  1623.     height = @stats_selection.height - @stats_selection.item_height - 15 -
  1624.         Venka::Bestiary::Fonts[:normal_font][1]
  1625.     @stats_window = Window_BattleScan.new(@stats_selection.x, y,
  1626.         @stats_selection.width, height)
  1627.     @stats_selection.help_window = @stats_window
  1628.   end
  1629.   #----------------------------------------------------------------------------
  1630.   # ○ new method: create_scan_window
  1631.   #----------------------------------------------------------------------------
  1632.   def create_info_instructions
  1633.     @info_instructions = Sprite.new
  1634.     @info_instructions.visible = false
  1635.     font = Venka::Bestiary::Battle_Font
  1636.     @info_instructions.bitmap = Bitmap.new(Graphics.width, font[1])
  1637.     @info_instructions.bitmap.font.name  = font[0]
  1638.     @info_instructions.bitmap.font.size  = font[1]
  1639.     @info_instructions.bitmap.font.bold  = font[2]
  1640.     @info_instructions.bitmap.font.color = Color.new(*font[3])
  1641.     @info_instructions.bitmap.font.outline = font[4]
  1642.     text = Venka::Bestiary::Battle_Instructions
  1643.     @info_instructions.bitmap.draw_text(0, 0, Graphics.width, font[1], text, 1)
  1644.     @info_instructions.y = @enemy_window.y - font[1]
  1645.   end
  1646.   #----------------------------------------------------------------------------
  1647.   # ● alias method: select_enemy_selection
  1648.   #----------------------------------------------------------------------------
  1649.   alias bestiary_info_enemy_select select_enemy_selection
  1650.   def select_enemy_selection
  1651.     @info_instructions.visible = true
  1652.     bestiary_info_enemy_select
  1653.   end
  1654.   #----------------------------------------------------------------------------
  1655.   # ● alias method: on_enemy_ok
  1656.   #----------------------------------------------------------------------------
  1657.   alias bestiary_info_enemy_ok on_enemy_ok
  1658.   def on_enemy_ok
  1659.     @info_instructions.visible = false
  1660.     bestiary_info_enemy_ok
  1661.   end
  1662.   #----------------------------------------------------------------------------
  1663.   # ● alias method: on_enemy_cancel
  1664.   #----------------------------------------------------------------------------
  1665.   alias bestiary_info_enemy_cancel on_enemy_cancel
  1666.   def on_enemy_cancel
  1667.     @info_instructions.visible = false
  1668.     bestiary_info_enemy_cancel
  1669.   end
  1670.   #----------------------------------------------------------------------------
  1671.   # ○ new method: show_enemy_info
  1672.   #----------------------------------------------------------------------------
  1673.   def show_enemy_info(enemy_id)
  1674.     @stats_window.show
  1675.     @stats_selection.enemy_id = enemy_id
  1676.     @stats_window.enemy_id = enemy_id
  1677.     @stats_selection.show.activate
  1678.     @stats_selection.wait_to_close
  1679.   end
  1680.   #----------------------------------------------------------------------------
  1681.   # ● alias method: update
  1682.   #----------------------------------------------------------------------------
  1683.   alias show_enemy_info_update update
  1684.   def update
  1685.     show_enemy_info_update
  1686.     if @enemy_window.active && Input.trigger?(Venka::Bestiary::Scan_PopUp)
  1687.       show_enemy_info(@enemy_window.enemy.enemy_id)
  1688.     end
  1689.   end
  1690.   #----------------------------------------------------------------------------
  1691.   # ● alias method: item_apply
  1692.   #----------------------------------------------------------------------------
  1693.   alias venka_scan_skill_used apply_item_effects
  1694.   def apply_item_effects(target, item)
  1695.     if target.is_a?(Game_Enemy)
  1696.       enemy = $data_enemies[target.enemy_id]
  1697.       $game_party.reveal_resist(enemy.id, false) if item.scan
  1698.       attack_element = item.damage.element_id
  1699.       Venka::Bestiary::Elements.size.times do |i|
  1700.         if Venka::Bestiary::Elements[i][0] == attack_element
  1701.           $game_party.bestiary.each do |entry|
  1702.             entry.elements[i] = true if entry.enemy_id == enemy.shown_id
  1703.           end
  1704.         end
  1705.       end
  1706.       if item.scan
  1707.         $game_party.bestiary.each do |entry|
  1708.           entry.scanned = true if entry.enemy_id == enemy.shown_id
  1709.         end
  1710.         show_enemy_info(target.enemy_id)
  1711.       end
  1712.     end
  1713.     venka_scan_skill_used(target, item)
  1714.   end
  1715.   #----------------------------------------------------------------------------
  1716.   # ● alias method: terminate
  1717.   #----------------------------------------------------------------------------
  1718.   alias :dispose_instructions_on_term :terminate
  1719.   def terminate
  1720.     dispose_instructions_on_term
  1721.     dispose_instructions
  1722.   end
  1723.   #----------------------------------------------------------------------------
  1724.   # ○ new method: dispose_instructions
  1725.   #----------------------------------------------------------------------------
  1726.   def dispose_instructions
  1727.     return if @info_instructions
  1728.     @info_instructions.bitmap.dispose
  1729.     @info_instructions.dispose
  1730.     @info_instructions = nil
  1731.   end
  1732. end
  1733. #==============================================================================
  1734. # ■ Scene_Bestiary
  1735. #==============================================================================
  1736. class Scene_Bestiary < Scene_MenuBase
  1737.   #----------------------------------------------------------------------------
  1738.   # ● upgraded method: start
  1739.   #----------------------------------------------------------------------------
  1740.   def start
  1741.     stop_music if Venka::Bestiary::Bestiary_BGM
  1742.     super
  1743.     bestiary_music if Venka::Bestiary::Bestiary_BGM
  1744.     @enemy = nil
  1745.     create_all_windows
  1746.   end
  1747.   #----------------------------------------------------------------------------
  1748.   # ○ new method: stop_music
  1749.   #----------------------------------------------------------------------------
  1750.   def stop_music
  1751.     @map_bgm = RPG::BGM.last
  1752.     fadeout_all(60)
  1753.   end
  1754.   #----------------------------------------------------------------------------
  1755.   # ○ new method: bestiary_music
  1756.   #----------------------------------------------------------------------------
  1757.   def bestiary_music
  1758.     RPG::BGM.new(*Venka::Bestiary::Bestiary_BGM).play
  1759.   end
  1760.   #----------------------------------------------------------------------------
  1761.   # ● upgraded method: create_background
  1762.   #----------------------------------------------------------------------------
  1763.   def create_background
  1764.     if Venka::Bestiary::BG_Image
  1765.       @background_sprite = Sprite.new
  1766.       @background_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  1767.       bitmap = bestiary_bgimage
  1768.       dest_rect = Rect.new(0, 0, Graphics.width, Graphics.height)
  1769.       @background_sprite.bitmap.stretch_blt(dest_rect, bitmap, bitmap.rect)
  1770.       @background_sprite.color.set(16, 16, 16, 128)
  1771.     else
  1772.       super
  1773.     end
  1774.   end
  1775.   #----------------------------------------------------------------------------
  1776.   # ○ new method: bestiary_bgimage
  1777.   #----------------------------------------------------------------------------
  1778.   def bestiary_bgimage
  1779.     file_info = Venka::Bestiary::BG_Image
  1780.     begin;      Cache.title1(file_info)
  1781.     rescue;     Cache.picture(file_info)
  1782.     end
  1783.   end
  1784.   #----------------------------------------------------------------------------
  1785.   # ○ new method: create_all_windows
  1786.   #----------------------------------------------------------------------------
  1787.   def create_all_windows
  1788.     create_help_window
  1789.     create_bottom_window
  1790.     create_category_window
  1791.     create_bestiary_list
  1792.     create_enemy_image
  1793.     create_stats_selection
  1794.     create_stats_window
  1795.     create_description_window
  1796.     create_image_frame if Venka::Bestiary::Frame_Image
  1797.   end
  1798.   #----------------------------------------------------------------------------
  1799.   # ● upgraded method: create_help_window
  1800.   #----------------------------------------------------------------------------
  1801.   def create_help_window
  1802.     @help_window = Window_BestiaryHelp.new(0, 0)
  1803.     @help_window.viewport = @viewport
  1804.     @help_window.y = 0
  1805.     @help_window.set_text(Venka::Bestiary::Category_Select)
  1806.   end
  1807.   #----------------------------------------------------------------------------
  1808.   # ○ new method: create_bottom_window
  1809.   #----------------------------------------------------------------------------
  1810.   def create_bottom_window
  1811.     y = Graphics.height - @help_window.height
  1812.     @bottom_window = Window_BestiaryHelp.new(0, y)
  1813.     @bottom_window.draw_completion
  1814.   end
  1815.   #----------------------------------------------------------------------------
  1816.   # ○ new method: create_category_window
  1817.   #----------------------------------------------------------------------------
  1818.   def create_category_window
  1819.     @category_window = Window_BestiaryCategory.new(0, @help_window.height)
  1820.     @category_window.viewport = @viewport
  1821.     @category_window.set_handler(:ok,     method(:command_list))
  1822.     @category_window.set_handler(:cancel, method(:return_scene))
  1823.   end
  1824.   #----------------------------------------------------------------------------
  1825.   # ○ new method: command_list
  1826.   #----------------------------------------------------------------------------
  1827.   def command_list
  1828.     @list_window.show.activate
  1829.     @help_window.set_text(Venka::Bestiary::Enemy_Select)
  1830.   end
  1831.   #----------------------------------------------------------------------------
  1832.   # ○ new method: create_bestiary_list
  1833.   #----------------------------------------------------------------------------
  1834.   def create_bestiary_list
  1835.     @list_window = Window_BestiaryEnemyList.new(@category_window.width,
  1836.           @help_window.height)
  1837.     @list_window.viewport = @viewport
  1838.     @list_window.category_window = @category_window
  1839.     @list_window.deactivate
  1840.     @list_window.set_handler(:ok,     method(:command_bestiary))
  1841.     @list_window.set_handler(:cancel, method(:command_category))
  1842.   end
  1843.   #----------------------------------------------------------------------------
  1844.   # ○ new method: command_category
  1845.   #----------------------------------------------------------------------------
  1846.   def command_category
  1847.     @category_window.activate
  1848.     @help_window.set_text(Venka::Bestiary::Category_Select)
  1849.   end
  1850.   #----------------------------------------------------------------------------
  1851.   # ○ new method: command_bestiary
  1852.   #----------------------------------------------------------------------------
  1853.   def command_bestiary
  1854.     @list_window.hide
  1855.     @category_window.hide
  1856.     @stats_selection.show.activate
  1857.     @stats_window.show
  1858.     @descript_window.show
  1859.     @frame_window.show if @frame_window
  1860.     @enemy_bg.visible = true
  1861.     update_enemy_info
  1862.   end
  1863.   #----------------------------------------------------------------------------
  1864.   # ○ new method: create_enemy_image
  1865.   #----------------------------------------------------------------------------
  1866.   def create_enemy_image
  1867.     width = (Graphics.width * 0.55).round;     height = Graphics.height * 0.55
  1868.     @enemy_bg = Sprite.new(@viewport)
  1869.     @enemy_bg.visible = false
  1870.     @enemy_bg.x = Graphics.width - (Graphics.width * 0.55).round
  1871.     @enemy_bg.y = @help_window.height
  1872.     @enemy_bg.bitmap = Bitmap.new(width, height)
  1873.   end
  1874.   #----------------------------------------------------------------------------
  1875.   # ○ new method: create_stats_selection
  1876.   #----------------------------------------------------------------------------
  1877.   def create_stats_selection
  1878.     height = Graphics.height - (@help_window.height * 2)
  1879.     @stats_selection = Window_BestiaryStatSelection.new(0, @help_window.height,
  1880.           Graphics.width - @enemy_bg.width, height)
  1881.     @stats_selection.viewport = @viewport
  1882.     @stats_selection.set_handler(:pageup,     method(:prev_enemy))
  1883.     @stats_selection.set_handler(:pagedown,   method(:next_enemy))
  1884.     @stats_selection.set_handler(:cancel,     method(:to_enemy_list))
  1885.   end
  1886.   #----------------------------------------------------------------------------
  1887.   # ○ new method: create_stats_window
  1888.   #----------------------------------------------------------------------------
  1889.   def create_stats_window
  1890.     y = @stats_selection.y + @stats_selection.item_height
  1891.     height = @stats_selection.height - @stats_selection.item_height
  1892.     @stats_window = Window_BestiaryStats.new(0, y, @stats_selection.width, height)
  1893.     @stats_window.viewport = @viewport
  1894.     @stats_selection.help_window = @stats_window
  1895.     @list_window.stats_window = @stats_window
  1896.   end
  1897.   #----------------------------------------------------------------------------
  1898.   # ○ new method: prev_enemy
  1899.   #----------------------------------------------------------------------------
  1900.   def prev_enemy
  1901.     if @list_window.index == 0
  1902.       @list_window.index = @list_window.item_max - 1
  1903.     else
  1904.       @list_window.index -= 1
  1905.     end
  1906.     update_enemy_info
  1907.     @stats_selection.activate
  1908.   end
  1909.   #----------------------------------------------------------------------------
  1910.   # ○ new method: next_enemy
  1911.   #----------------------------------------------------------------------------
  1912.   def next_enemy
  1913.     if @list_window.index == @list_window.item_max - 1
  1914.       @list_window.index = 0
  1915.     else
  1916.       @list_window.index += 1
  1917.     end
  1918.     update_enemy_info
  1919.     @stats_selection.activate
  1920.   end
  1921.   #----------------------------------------------------------------------------
  1922.   # ○ new method: to_enemy_list
  1923.   #----------------------------------------------------------------------------
  1924.   def to_enemy_list
  1925.     @help_window.set_text(Venka::Bestiary::Category_Select)
  1926.     @bottom_window.draw_completion
  1927.     @category_window.show
  1928.     @stats_selection.hide.deactivate
  1929.     @stats_window.hide
  1930.     @descript_window.hide
  1931.     @frame_window.hide if @frame_window
  1932.     @enemy_bg.visible = false
  1933.     command_list
  1934.   end
  1935.   #----------------------------------------------------------------------------
  1936.   # ○ new method: create_description_window
  1937.   #----------------------------------------------------------------------------
  1938.   def create_description_window
  1939.     y = (@help_window.height + @enemy_bg.height).to_i
  1940.     @descript_window = Window_BestiaryHelp.new(@stats_window.width, y)
  1941.     @descript_window.viewport = @viewport
  1942.     @descript_window.width = Graphics.width - @stats_window.width
  1943.     @descript_window.height = Graphics.height - y - @bottom_window.height
  1944.     @descript_window.hide
  1945.   end
  1946.   #----------------------------------------------------------------------------
  1947.   # ○ new method: create_image_frame
  1948.   #----------------------------------------------------------------------------
  1949.   def create_image_frame
  1950.     @frame_window = Window_Base.new(@enemy_bg.x, @enemy_bg.y, @enemy_bg.width,
  1951.         @enemy_bg.height)
  1952.     @frame_window.viewport = @viewport
  1953.     @frame_window.set_windowskin
  1954.     @frame_window.back_opacity = 0
  1955.     @frame_window.hide
  1956.   end
  1957.   #----------------------------------------------------------------------------
  1958.   # ○ new method: update_enemy_info
  1959.   #----------------------------------------------------------------------------
  1960.   def update_enemy_info
  1961.     enemy = $data_enemies[@list_window.current_ext]
  1962.     @help_window.set_text(enemy.name)
  1963. #    @bottom_window.draw_instructions
  1964.     @stats_window.enemy_id = @list_window.current_ext
  1965.     @descript_window.set_description(enemy)
  1966.     update_enemy_image(enemy)
  1967.   end
  1968.   #----------------------------------------------------------------------------
  1969.   # ○ new method: update_enemy_image
  1970.   #----------------------------------------------------------------------------
  1971.   def update_enemy_image(enemy)
  1972.     @enemy_bg.bitmap.clear
  1973.     enemy = $data_enemies[@list_window.current_ext]
  1974.     if floor_image(enemy)
  1975.       bg_floor = enemy_image(:floor, floor_image(enemy))
  1976.       draw_image(bg_floor, @enemy_bg.width, @enemy_bg.height)
  1977.     end
  1978.     if wall_image(enemy)
  1979.       bg_wall = enemy_image(:wall, wall_image(enemy))
  1980.       draw_image(bg_wall, @enemy_bg.width, @enemy_bg.height)
  1981.     end
  1982.     enemy = enemy_image(:battler, enemy.battler_name, enemy.battler_hue)
  1983.     draw_image(enemy, @enemy_bg.width, @enemy_bg.height)
  1984.   end
  1985.   #----------------------------------------------------------------------------
  1986.   # ○ new method: floor_image
  1987.   #----------------------------------------------------------------------------
  1988.   def floor_image(enemy)
  1989.     floor = enemy.bg_floor      # Get the enemie's wall image (high priority)
  1990.     if floor == ""              # If it's not set, then get category image
  1991.       floor = Venka::Bestiary::Category[@category_window.index][:bg_floor]
  1992.       # If the category image wasn't set, then use the default image
  1993.       floor = Venka::Bestiary::Default_BGFloor if floor.nil?
  1994.     end
  1995.     floor = nil if floor == ""  # Set to no image if category was set to ""
  1996.     return floor
  1997.   end
  1998.   #----------------------------------------------------------------------------
  1999.   # ○ new method: wall_image
  2000.   #----------------------------------------------------------------------------
  2001.   def wall_image(enemy)
  2002.     wall = enemy.bg_wall      # Get the enemie's wall image (high priority)
  2003.     if wall == ""             # If it's not set, then get category image
  2004.       wall = Venka::Bestiary::Category[@category_window.index][:bg_wall]
  2005.       # If the category image wasn't set, then use the default image
  2006.       wall = Venka::Bestiary::Default_BGWall if wall.nil?
  2007.     end
  2008.     wall = nil if wall == "" # Set to no image if category was set to ""
  2009.     return wall
  2010.   end
  2011.   #----------------------------------------------------------------------------
  2012.   # ○ new method: enemy_image
  2013.   #----------------------------------------------------------------------------
  2014.   def enemy_image(type, file, hue = 0)
  2015.     begin
  2016.       case type
  2017.       when :floor;      Cache.battleback1(file)
  2018.       when :wall;       Cache.battleback2(file)
  2019.       when :battler;    Cache.battler(file, hue)
  2020.       end
  2021.     rescue;             Cache.picture(file)
  2022.     end
  2023.   end
  2024.   #----------------------------------------------------------------------------
  2025.   # ○ new method: draw_image
  2026.   #----------------------------------------------------------------------------
  2027.   def draw_image(bitmap, width, height)
  2028.     x = (bitmap.width - width) * 0.5
  2029.     y = (bitmap.height - height) * 0.5
  2030.     src_rect = Rect.new(x, y, width, height)
  2031.     @enemy_bg.bitmap.blt(0, 0, bitmap, src_rect)
  2032.   end
  2033.   #----------------------------------------------------------------------------
  2034.   # ● upgraded method: terminate
  2035.   #----------------------------------------------------------------------------
  2036.   def terminate
  2037.     super
  2038.     fadeout_all(60)
  2039.     @map_bgm.replay
  2040.     dispose_enemy_image
  2041.   end
  2042.   #----------------------------------------------------------------------------
  2043.   # ○ new method: dispose_enemy_image
  2044.   #----------------------------------------------------------------------------
  2045.   def dispose_enemy_image
  2046.     return unless @enemy_bg
  2047.     @enemy_bg.bitmap.dispose if @enemy_bg.bitmap
  2048.     @enemy_bg.dispose
  2049.   end
  2050. end



↑佬佬脚本的进度条位置,这个应该在第几行修改啊

最佳答案

查看完整内容

放在相关的脚本下方使用,按键盘上的S和D键操作(Q和W被占用掉了),最上面3行可以修改的 PS:工程懒得下载...用的贴出来的脚本直接测试的,放工程里如果有问题再说吧 Schedule_Bitmap_Color = Color.new(255,255,255) #进度条边框颜色 Schedule_Index_Color = Color.new(255,255,255) #进度条光标颜色 Max_Show_Line = 3 #帮助窗口能够显示的行数 class Window_BestiaryHelp attr_reader :line_number attr_accessor :line_ ...

Lv4.逐梦者

梦石
0
星屑
6260
在线时间
1481 小时
注册时间
2015-7-25
帖子
652

开拓者

2
发表于 2024-6-8 13:20:48 | 只看该作者
放在相关的脚本下方使用,按键盘上的S和D键操作(Q和W被占用掉了),最上面3行可以修改的 PS:工程懒得下载...用的贴出来的脚本直接测试的,放工程里如果有问题再说吧

RUBY 代码复制
  1. Schedule_Bitmap_Color = Color.new(255,255,255) #进度条边框颜色
  2. Schedule_Index_Color = Color.new(255,255,255) #进度条光标颜色
  3. Max_Show_Line = 3 #帮助窗口能够显示的行数
  4.  
  5. class Window_BestiaryHelp
  6.   attr_reader :line_number
  7.   attr_accessor :line_index
  8.   alias mf240613initialize initialize
  9.   def initialize(x, y)
  10.     mf240613initialize(x, y)
  11.     @help_text = ""
  12.     @line_number = 0
  13.     @line_index = 0
  14.   end
  15.   def get_text_number_index
  16.     @line_number = @help_text.gsub(/[|]/, "\n").scan("\n").size + 1
  17.     @line_index = [@line_number,Max_Show_Line].min
  18.   end
  19.   def set_description(enemy)
  20.     contents.clear
  21.     contents.dispose
  22.     get_description_text(enemy)
  23.     self.contents = Bitmap.new(contents_width, @line_number*30)
  24.     text = get_description_text(enemy)
  25.     if Venka::Bestiary::Use_Wordwrapper
  26.       wrapping = @wordwrap
  27.       @wordwrap = true
  28.       draw_text_ex(0, 0, text.gsub(/[|]/, ""))
  29.       @wordwrap = wrapping
  30.     else
  31.       draw_text_ex(0, 0, text.gsub(/[|]/, "\n"))
  32.     end
  33.   end
  34.   alias mf240613get_description_text get_description_text
  35.   def get_description_text(enemy)
  36.     @help_text = mf240613get_description_text(enemy)
  37.     get_text_number_index
  38.     @help_text
  39.   end
  40.   def wave_size
  41.     @line_number > Max_Show_Line ? [Max_Show_Line,@line_number] : false
  42.   end
  43.   def update
  44.     super
  45.     return if @line_number <= Max_Show_Line
  46.     self.oy = (@line_index - Max_Show_Line) * 24
  47.   end
  48. end
  49. class Scene_Bestiary
  50.   def create_schedule(x,y,z=0)
  51.     create_schedule_bitmap(x,y,z)
  52.     create_schedule_index_sprite(x,y,z)
  53.   end
  54.   def create_schedule_bitmap(x,y,z=0)
  55.     @schedule_bitmap = Sprite.new
  56.     @schedule_bitmap.x = x
  57.     @schedule_bitmap.y = y
  58.     @schedule_bitmap.z = z
  59.     @schedule_bitmap.bitmap = Bitmap.new(24,80)
  60.     @schedule_bitmap.bitmap.fill_rect(6, 0, 12, 80, Schedule_Bitmap_Color)
  61.     @schedule_bitmap.bitmap.fill_rect(7, 1, 10, 78, Color.new(0,0,0))
  62.   end
  63.   def create_schedule_index_sprite(x,y,z=0)
  64.     @schedule_index = Sprite.new
  65.     @schedule_index.x = x
  66.     @schedule_index.y = y
  67.     @schedule_index.z = z
  68.     @schedule_index.bitmap = Bitmap.new(24,12)
  69.     @schedule_index.bitmap.fill_rect(6, 0, 12, 12, Schedule_Index_Color)
  70.   end
  71.   alias mf240613start start
  72.   def start
  73.     mf240613start
  74.     create_schedule(544-24,282,200)
  75.     @schedule_bitmap.visible = !@list_window.visible
  76.     @schedule_index.visible = @schedule_bitmap.visible
  77.   end
  78.   def update_schedule
  79.     @schedule_bitmap.visible = !@list_window.visible
  80.     @schedule_index.visible = @schedule_bitmap.visible
  81.     return unless @schedule_index
  82.     @schedule_index.update
  83.   end
  84.   def update_index_sprite
  85.     return unless @descript_window && @schedule_bitmap && @descript_window.line_number > Max_Show_Line
  86.     move_y = (@schedule_bitmap.bitmap.height - @schedule_index.bitmap.height).to_f / (@descript_window.line_number - Max_Show_Line)
  87.     move_h = (@descript_window.line_index - Max_Show_Line) * move_y
  88.     @schedule_index.y = @schedule_bitmap.y + move_h
  89.   end
  90.   def dispose_schedule
  91.     return unless @schedule_index && @schedule_bitmap
  92.     @schedule_index.dispose
  93.     @schedule_bitmap.dispose
  94.   end
  95.   def update_help_line
  96.     return unless @schedule_index.visible && @descript_window.line_number > Max_Show_Line
  97.     @descript_window.line_index -= 1 if Input.trigger?(:Y)
  98.     @descript_window.line_index += 1 if Input.trigger?(:Z)
  99.     wave_size = @descript_window.wave_size
  100.     if wave_size
  101.       @descript_window.line_index = wave_size.max if @descript_window.line_index > wave_size.max
  102.       @descript_window.line_index = wave_size.min if @descript_window.line_index < wave_size.min
  103.     end
  104.     @descript_window.update if Input.trigger?(:Y) || Input.trigger?(:Z)
  105.   end
  106.   alias mf240613update update
  107.   def update
  108.     mf240613update
  109.     update_help_line
  110.     update_schedule
  111.     update_index_sprite
  112.   end
  113.   alias mf240613terminate terminate
  114.   def terminate
  115.     mf240613terminate
  116.     dispose_schedule
  117.   end
  118. end
笨肉包的首款像素OC游戏《花城梦之心》尝试制作中~
目前的坑 【不可思议的迷宫】幽灵契约外传:歌莉娅
持续更新中~ 当前进度 v0.28
大版本更新时才会更新网盘文件,预计下次大版本更新:v0.30
完成度:
主线 15% 支线 0% 数据库 6% 系统 86% 美术 6%
两边同时填坑~
( 这里是笨肉包~专修魔法!目标是大魔法师!
( 坑太大啦,一个人填不完啦hhh 一定会填完的嗯...
( 每天都和bug们比试魔力~吾之魔法将扫平一切!
( 弱点是美术,魔法修行之余再补补课吧~
( 哼哼哼~这便是魔法的力量!
大家都离开啦,笨肉包也不知道还能坚持多久呀...
这是属于笨肉包一个人的旅行(再见了...蚊子湯,七重酱,笨肉包永远想你们!TwT
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
181
在线时间
81 小时
注册时间
2024-1-8
帖子
19
3
 楼主| 发表于 2024-6-13 18:57:11 | 只看该作者
魔法丶小肉包 发表于 2024-6-13 17:36
放在相关的脚本下方使用,按键盘上的S和D键操作(Q和W被占用掉了),最上面3行可以修改的 PS:工程懒得下载 ...

佬!!有效果!!!但唯一难绷的问题是。
进度条它大概在....嗯.....
我放主题图里边好了
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
181
在线时间
81 小时
注册时间
2024-1-8
帖子
19
4
 楼主| 发表于 2024-6-13 19:03:12 | 只看该作者
魔法丶小肉包 发表于 2024-6-13 17:36
放在相关的脚本下方使用,按键盘上的S和D键操作(Q和W被占用掉了),最上面3行可以修改的 PS:工程懒得下载 ...

回老师,我用了最笨蛋的一种办法解决。
我把你那个sd移动的进度条和按钮设成透明了。
所以不回复也没事的。谢谢佬佬

点评

在第74行的括号内前两个参数分别是x和y坐标,可以改这两个进行调整,另外你这边的窗口是4行所以别忘了把脚本第3行那个改成4  发表于 2024-6-13 19:45
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-21 19:51

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表