# ----------------------------------------------------------------------------
# ■ 作者注释 -
# ----------------------------------------------------------------------------
# 这是一个快速说明。这个脚本是为在以下网址找到的代码挑战赛编写的:
# http://forums.rpgmakerweb.com/index.php?/forum/102-code-off-challenge/
# ----------------------------------------------------------------------------
# ■ 术语 -
# ----------------------------------------------------------------------------
# 本脚本可以商业或非商业使用。如果商业使用,我希望您能通过论坛私信我一个游戏链接,
# 这样我可以跟进它的进度..但这不是必须的;) 这只是一个我想看看的类型的事情 :)
# ----------------------------------------------------------------------------
# ■ 介绍 -
# ----------------------------------------------------------------------------
# 这个脚本会给您一个场景,您可以在其中跟踪您已经发现和/或杀死的敌人。
# 它将跟踪敌人的统计数据、技能、掉落物品、对元素和状态效果的抗性,
# 同时显示敌人的描述和图像。
# ----------------------------------------------------------------------------
# ■ 使用说明 -
# ----------------------------------------------------------------------------
# 如果您将此脚本放入您的游戏项目中,它将起作用。了解注释标签的知识将有助于利用所有功能。
# ----------------------------------------------------------------------------
# ■ 敌人注释标签 -
# ----------------------------------------------------------------------------
# 您可以为每个敌人设置自定义描述。如果您跳过此注释标签,
# 那么它将使用在 Default_Description 中设置的描述。文本将采用您在消息窗口中使用的相同代码,
# 但您需要在每个代码前添加一个额外的 \ 。因此,\C[1] 将需要是 \\\C[1] 。
# 您可以使用 KilloZapit 的单词包装器自动将文本适应框,或者如果您不想使用 KilloZapit 的单词包装器,
# 则可以使用 | 来开始新的文本行。
# 请参阅演示敌人注释标签框中的示例。
# <description1: 你的文本在这里>
#
# 当在 Bestiary 场景中时,敌人将出现在看起来像战斗背景图像的背景上。
# 您可以设置默认图像的使用,并为每个设置的类别设置图像。
# 但是,如果您希望某些敌人拥有非常自己的图像,与默认或类别图像不同,
# 那么请使用以下标签:
# <bg_floor: 文件> - 它将在 Battlebacks1 中查找文件,如果没有找到,
# 那么它将在 Pictures 文件夹中查找。
# <bg_wall: 文件> - 它将在 Battlebacks2 中查找文件,如果没有找到,
# 那么它将在 Pictures 文件夹中查找。
# 注意:不要在文件名周围放置 "" 的引号。如果您想使用单个文件,
# 那么请将 bg_floor 或 bg_wall 设置为您想要使用的图像,并将另一个设置为 nil。
#
# 有时有些敌人您不想跟踪,或者如果您像我一样,您喜欢按部分对数据库进行排序并使用标签。
# 为了确保这些数据库条目不会出现在 bestiary 场景中,请使用此标签:
# <skip> - 当使用此标签时,将不会产生任何条目
#
# 有些游戏有同一个敌人的多个数据库条目,但它们稍微改变了统计数据以进行变化,
# 或者改变了图形以进行变化。但它们仍然被认为是同一个敌人。在这种情况下,
# 您可以使用此标签,以便无论您遇到哪一个,它都只会显示一个条目。
# <shown_id: x> - x 是在 Bestiary 中使用的数据库 ID
#
# 类别标签将是使用最多的标签。您可以在自定义部分设置类别。
# 您可以以任何您喜欢的方式对 Bestiary 场景进行排序。
# 例如,可以按 Common Enemies, Rare Enemies, Boss Enemies, Elite 等进行分类,
# 或按此演示中的地点分类。一个敌人可以出现在多个类别中。
# 使用以下标签设置敌人的类别:
# <category: x> - x 是下面定义的类别 ID
#
# 要使敌人对扫描免疫,请使用以下代码
# <no_scan> - 敌人对扫描技能免疫
#
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# ■ 物品/技能注释标签 -
# ----------------------------------------------------------------------------
# 最后一个注释标签可以放在技能或物品的注释标签中。它允许您扫描敌人以了解有关它的信息。
# <scan> - 当对敌人使用时,它会解锁信息
#
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# ■ 脚本调用 -
# ----------------------------------------------------------------------------
# - 手动添加 Bestiary 条目 -
# 以防您需要手动添加 bestiary 条目,请使用以下内容:
# add_enemy_entry(enemy_id) - enemy_id 是数据库中的 ID
#
# - 通过脚本调用更改敌人的描述 -
# 您可以通过脚本调用更改敌人的描述。当您通过脚本调用设置描述时,
# 它将覆盖找到的任何其他描述文本(默认描述或按击杀自定义的描述)。
# 要通过脚本调用设置描述,请使用以下格式:
# set_enemy_description(enemy_id, text) - enemy_id 是数据库 ID
# - text 是显示的文本。
# 文本遵循与其他所有描述文本相同的规则。您可以使用消息代码更改文本颜色、大小、使用图标等。使用 | 形成换行。如果您希望描述为空,则将文本设置为 ""。
#
# 要将描述文本重置为通常的内容,请使用:
# reset_enemy_description(enemy_id) - enemy_id 是数据库 ID
#
# - 获取敌人的击杀次数 -
# 如果您需要进行条件检查或其他任何原因,可以获取您给定敌人的击杀次数。使用:
# enemy_kill_count(enemy_id) - enemy_id 是数据库 ID
# 注意:如果给定的 enemy_id 有 <shown_id: x>,在其中,则将转到注释标签指向的敌人 ID。
# ==============================================================================
# ■ 配置
# ==============================================================================$imported ||= {}; $imported[:Venka_Bestiary] = true
module Venka; module Bestiary
# 通用设置
#----------------------------------------------------------------------------------------------------------------------
Windowskin = "Window" # 设置为 nil 以使用默认皮肤。
Window_Opacity = 255 # 窗口的整体透明度。数字 0 - 255
Window_BGOpacity = 180 # 窗口背景透明度(默认 192)
Use_Dividers = true # 是否绘制分隔线来分隔信息?
Line_Color = [150, 150, 250, 225] # 分隔线的颜色,格式为 [红色, 蓝色, 绿色, Alpha]
Frame_Image = false # 是否绘制敌人图像周围的窗口边框?
Menu_Access = true # 是否可以从菜单访问 Bestiary?
BG_Image = "Book" # 在 Title1 或 Pictures 文件夹中找到
Bestiary_BGM = ["Theme2", 80, 100] # ["文件", 音量, 音高]. 可以设置为 nil
Scroll_Speed = 6 # 按 ↑↓ 时信息移动的速度
Track_Progress = true # 显示每个类别的完成度
Track_Kills = true # 跟踪杀死敌人的次数
Show_Debuff_Info = true # 显示减益信息部分
Use_Wordwrapper = true # 使用 KilloZapit 的自动换行脚本来处理文本
# 默认设置
#----------------------------------------------------------------------------------------------------------------------
# 您可以为每个敌人设置默认的背景图像和描述信息,如果您没有为每个敌人制作自定义信息。
# 如果您只想使用一个背景图像,那么请在它的 Battleback 文件夹或 Pictures 文件夹中设置一个图像,
# 并将另一个设置为 nil。
#----------------------------------------------------------------------------------------------------------------------
Default_BGFloor = "Dirt1" # 默认使用的地面图像(Battlebacks1)
Default_BGWall = "Forest1" # 默认使用的墙面图像(Battlebacks2)
# 描述文本可以使用消息代码(例如:\c[1] - 更改文本颜色)。
# 使用 | 强制换行。
Default_Description = "关于这个 | 敌人知之甚少。"
# 随着击杀更多敌人,描述可以发展。这些描述必须通过注释标签设置。
# 如果没有设置描述,则将跳过描述并显示较低的消息或默认消息。
# 在此处设置击杀目标:
Description1 = 0 # 0次击杀时显示此消息
Description2 = 3 # 击杀3次后显示此消息
Description3 = 8 # 击杀8次后显示此消息
# 按击杀显示设置
#----------------------------------------------------------------------------------------------------------------------
# 您可以设置根据击杀次数显示敌人的哪些信息。使用扫描技能也将解锁以下所有信息,
# 无论给定敌人的击杀次数如何。
#----------------------------------------------------------------------------------------------------------------------
Show_BaseStats = 1 # 显示基础统计数据:攻击力、防御力、魔法攻击力等
Show_Elements = 1 # 显示元素抗性
Show_States = 1 # 显示状态抗性
Show_DebuffStats = 1 # 显示减益比率
Show_Abilities = 1 # 显示可以使用的能力列表
Show_Loot = 1 # 显示敌人的掉落列表
# 文本设置
#----------------------------------------------------------------------------------------------------------------------
# 您可以设置在 Bestiary 场景中出现的所有文本。
#----------------------------------------------------------------------------------------------------------------------
Bestiary_Command = "境界图鉴" # 菜单中场景的文本
Category_Select = "选择一个类别" # 选择类别的帮助文本
Enemy_Select = "选择一个敌人" # 选择敌人的帮助文本
Discovered_Text = "已发现的敌人" # 底部显示的文本
Percent_Finished = "已完成" # 完成百分比的文本
Unknown_Loot = "未知掉落" # 掉落未知时显示的文本
Unknown_Skills = "未知能力" # 技能未知时显示的文本
View_Stats = "统计数据" # 统计数据按钮文本
View_More = "其他信息" # 其他信息按钮文本
View_Element = "元素" # 元素信息按钮文本
View_States = "状态" # 状态信息按钮文本
View_Debuff = "减益" # 减益信息按钮文本
Stats_Text = "基础统计" # 基本统计数据的标题文本
Element_Text = "元素抗性" # 元素抗性的标题文本
Status_Text = "状态抗性" # 状态抗性的标题文本
Debuff_Text = "减益比率" # 减益比率的标题文本
Loot_Text = "奖励" # 可获得物品的列表
Skill_Text = "能力" # 敌人使用的技能文本
Immune_Text = "免疫" # 敌人对状态免疫时出现的文本
Absorb_Text = "吸收" # 元素吸收(Yanfly 元素吸收脚本)的文本
Unknown_Stat = "??" # 未知抗性/统计数据的文本
# 对于接下来的两个设置,如果您不想使用图标或文本,可以将其设置为 nil
Exp_Text = ["经验:", 117] # 经验和图标的文本和图标
Gold_Text = ["金币:", 361] # 金币和图标的文本和图标
Kills_Text = "击杀次数" # 显示敌人击杀数的文本
Instructions_Text = "使用 PageUp 和 PageDown 更换敌人。"
Battle_Instructions = "按 Shift 查看目标的更多信息。"
# 扫描技能设置
#----------------------------------------------------------------------------------------------------------------------
# 您可以在此处设置扫描技能的相关内容。这主要是设置在游戏中出现的文本。
# 您还可以设置在敌人窗口中选择敌人时弹出窗口显示的按键。
# 注意:窗口也会在成功扫描时弹出
#
# 按键选项为: :A - 这是 Shift 键
# :X - 这是 A 键 :Y - 这是 S 键
# :Z - 这是 D 键 :L - 这是 PageUp/Q 键
# :R - 这是 PageDw/W 键 :SHIFT, :CTRL, :ATL - shift, cntl, atl 键
#----------------------------------------------------------------------------------------------------------------------
Target_Scanned = "%s 已扫描!" # 成功扫描时的战斗信息
No_Scan = "%s 无法被扫描!" # 目标无法被扫描时的战斗信息
No_Info = "未找到信息" # 当目标对扫描免疫时的文本。
Scan_PopUp = :SHIFT # 使窗口弹出的输入键
# 列表排序设置
#----------------------------------------------------------------------------------------------------------------------
# 您可以设置列表的排序方式。您可以按发现顺序(发现顺序应该是默认的)、按它们的数据库 ID 或名称进行排序。
#----------------------------------------------------------------------------------------------------------------------
Sort_Type = :id # 选择有 :id, :name, 或 :default
# 字体设置
#----------------------------------------------------------------------------------------------------------------------
# :help_font = 出现在顶部和底部窗口的字体
# :list_font = 列表窗口中的字体
# :header_font = 用于统计类型的字体
# :stat_font = 用于统计数据的字体
# :description = 敌人描述文本的字体。
#
# 对于每种文本类型,您需要设置字体、大小、粗体和颜色。
# 使用以下格式:
# [["字体名称, 字体名称, 等"], 字体大小, 粗体?, 颜色]],
# 字体名称 = 一个数组,保存字体选择。第一个是您首先使用的选择,
# 但如果玩家的计算机上没有该字体,它将通过列表继续寻找可以使用的字体
# 字体大小 = 您想使用的字体大小
# 粗体? = 这应该是 true 用于粗体,false 关闭粗体
# 颜色 = 这是与设置 Gauge Color 的颜色相同的格式。
# 使用 [红色, 蓝色, 绿色, 不透明度] 或窗口皮肤颜色编号。
# 轮廓? = 这将打开或关闭字体的轮廓
#----------------------------------------------------------------------------------------------------------------------
Fonts = { # [["字体"]], 大小, 粗体?, 颜色, 轮廓?
:normal_font => [["Calibri", "Sylfaen"], 24, false, 0, true],
:list_font => [["Calibri", "Sylfaen"], 24, false, 0, true],
:header_font => [["Calibri", "Sylfaen"], 23, true, 1, true],
:stat_name => [["Calibri", "Sylfaen"], 20, true, 0, true],
:stats_font => [["Calibri", "Sylfaen"], 20, false, 0, true],
:description => [["Calibri", "Sylfaen"], 18, false, 0, true],
} # <—— 不要删除
# 下面两个颜色设置可以是窗口皮肤颜色或 [红色, 蓝色, 绿色]
High_Resist = 3 # 高抗性使用的颜色
Low_Resist = 18 # 低抗性(弱点)使用的颜色
Immunity_Color = 17 # 免疫/吸收文本使用的颜色
# 战斗字体设置
#----------------------------------------------------------------------------------------------------------------------
# 战斗中的字体与窗口中出现的字体略有不同。
# 对于这一个,颜色必须以 [红色, 蓝色, 绿色] 的格式。
#----------------------------------------------------------------------------------------------------------------------
# 字体族, 大小, 粗体?, 颜色, 轮廓?
Battle_Font = [["Calibri", "Sylfaen"], 24, true, [255,255,255], true]
# 基础统计设置
#----------------------------------------------------------------------------------------------------------------------
# 设置用于基础统计(HP, MP, 攻击, 等等)的文本和/或图标
# 您可以将文本或图标设置为 nil 以省略它们。
#----------------------------------------------------------------------------------------------------------------------
Base_Stats = [] #["文本", 图标索引]
Base_Stats[0] = ["生命", 122] # 最大生命值
Base_Stats[1] = ["灵力", 112] # 最大魔法值
Base_Stats[2] = ["攻击力", 116] # 攻击
Base_Stats[3] = ["防御", 161] # 防御
Base_Stats[4] = ["魔力", 113] # 魔法攻击
Base_Stats[5] = ["魔抗", 15] # 魔法防御
Base_Stats[6] = ["速度", 12] # 敏捷
Base_Stats[7] = ["幸运", 202] # 幸运
# 元素设置
#----------------------------------------------------------------------------------------------------------------------
# 您想要跟踪的元素。按优先顺序列出元素。在默认游戏分辨率下,大约会显示 9 个图标。
# 如果您使屏幕变宽,那么可能会显示更多。因此,按重要性顺序列出您想要显示的图标。
#----------------------------------------------------------------------------------------------------------------------
Elements = [
# [ID, 图标索引],金木水火土日月灵
[2, 858],
[3, 859],
[4, 860],
[5, 861],
[6, 862],
[7, 863],
[8, 864],
[9, 865],
] # <-— 不要删除!!
# 状态设置
#----------------------------------------------------------------------------------------------------------------------
# 这就像设置元素一样,但是不需要定义图标,因为所有状态/状态在数据库中都设置了图标。
# 所以对于这个,只需按优先顺序设置您想要跟踪的状态 ID。
#----------------------------------------------------------------------------------------------------------------------
States = [1, 2, 3, 4, 5, 6, 7, 10]
# 状态设置
#----------------------------------------------------------------------------------------------------------------------
# 这就像设置元素一样,但是不需要定义图标,因为所有状态/状态在数据库中都设置了图标。
# 所以对于这个,只需按优先顺序设置您想要跟踪的状态 ID。
#----------------------------------------------------------------------------------------------------------------------
States = [1, 2, 3, 4, 5, 6, 7, 10]
# 类别设置
#----------------------------------------------------------------------------------------------------------------------
# 您可以设置敌人将被分类到的类别。这可以是您喜欢的任何方式。例如,您可以按种类(哺乳动物、
# 鸟类、恶魔等)或按地区(森林、河流、山脉等)进行分类。您必须在此处设置所有类别,然后使用数据库的
# 敌人标签页来设置它。
#
# Category[ID] = { # ID 必须是唯一的数字。
# :name => "Miscellaneous", # 类别的名称,正如它在场景中出现的那样
# :bg_floor => "file", # 如果不是默认的,使用此图像(可以省略)
# :bg_wall => "file", # 如果不是默认的,使用此图像(可以省略)
# 文件 = 如果您想使用默认图像之外的图像,请使用此文件。如果您想使用
# 不使用图像,请将其设置为 ""。
# }
#
# 注意:地板和墙壁图像都可以省略以使用默认图像。如果使用单个图像,则将其中一个或另一个设置为您想要使用的图像
# (在相应的战斗背景文件夹或图片文件夹中找到),然后将另一个设置为 ""(一个空文件)。不要将另一个图像设置为 nil,
# 因为这将选择默认图像。
#---------------------------------------------------------------------------------------------------------------------- Category ||= {}
Category ||= {}
#----------------------------------------------------------------------------
Category[0] = { # This is the default category. Enemies appear in this
# category if they don't have one assigned or there was a typo in the tag.
:name => "人类",
} # <-DO NOT REMOVE
#----------------------------------------------------------------------------
Category[1] = { # Enemies found in the Forsaken Forest area
:name => "魔物", # Name of Category
}
#----------------------------------------------------------------------------
Category[2] = { # Enemies found in the Abandoned Mines area
:name => "机械", # Name of Category
}
#----------------------------------------------------------------------------
Category[3] = { # Enemies found in the Deep Space area
:name => "神明", # Name of Category
}
#----------------------------------------------------------------------------
Category[4] = { # Enemies found in the Nocturnal Plains area
:name => "亡魂", # Name of Category
}
#----------------------------------------------------------------------------
Category[5] = { # Undead Enemies
:name => "精英", # Name of Category
}
#----------------------------------------------------------------------------
Category[6] = { # Enemies found in the Nocturnal Plains area
:name => "首领", # Name of Category
}
#----------------------------------------------------------------------------
Category[7] = { # Enemies found in the Nocturnal Plains area
:name => "EXTRA", # Name of Category
}
#==============================================================================
# ■ Edits should stop here unless you know what you're doing :)
#==============================================================================
end
module Notetag
Skip_Enemy = /<skip>/i
Enemy_Category = /<category:\s*(\d+(?:\s*,\s*\d+)*)>/i
BG_Floor = /<bg_floor:\s*(\w+)>/i
BG_Wall = /<bg_wall:\s*(\w+)>/i
Enemy_Desc1 = /<description1:\s*(.*)>/i
Enemy_Desc2 = /<description2:\s*(.*)>/i
Enemy_Desc3 = /<description3:\s*(.*)>/i
Shown_ID = /<shown_id:\s*(\d+)>/i
Scan_Skill = /<scan>/i
No_Scan = /<no_scan>/i
end
end
#------------------------------------------------------------------------------
# ○ Creating a way to store discovered info about the enemy with Struct.
#------------------------------------------------------------------------------
Bestiary_Entry = Struct.new(:enemy_id, :category, :elements, :states, :kills,
:quotes, :scanned)
#==============================================================================
# ■ Vocab
#==============================================================================
module Vocab
# Scan Skill
Scanned = Venka::Bestiary::Target_Scanned
No_Scan = Venka::Bestiary::No_Scan
end
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#----------------------------------------------------------------------------
# ● alias method: load_database
#----------------------------------------------------------------------------
class << self; alias bestiary_db_notetags load_database; end
def self.load_database
bestiary_db_notetags
load_bestiary_notetags
end
#----------------------------------------------------------------------------
# ○ new method: load_bestiary_notetags
#----------------------------------------------------------------------------
def self.load_bestiary_notetags
($data_enemies + $data_skills + $data_items).compact.each do |item|
item.load_bestiary_notetags
end
end
end
#==============================================================================
# ■ RPG::UsableItem
#==============================================================================
class RPG::UsableItem
#----------------------------------------------------------------------------
# ♦ Public Instance Variables
#----------------------------------------------------------------------------
attr_accessor :scan
#----------------------------------------------------------------------------
# ○ new method: load_bestiary_notetags
#----------------------------------------------------------------------------
def load_bestiary_notetags
@scan = false
self.note.split(/[\r\n]+/).each do |line|
info = []
case line
when Venka::Notetag::Scan_Skill; @scan = true
end
end
end
end
#==============================================================================
# ■ RPG::Enemy
#==============================================================================
class RPG::Enemy
#----------------------------------------------------------------------------
# ♦ Public Instance Variables
#----------------------------------------------------------------------------
attr_accessor :skip, :category, :bg_floor, :bg_wall, :description, :shown_id
attr_accessor :no_scan, :descript1, :descript2, :descript3
#----------------------------------------------------------------------------
# ○ new method: load_bestiary_notetags
#----------------------------------------------------------------------------
def load_bestiary_notetags
@skip = false
@category = [0]
@bg_floor = @bg_wall = ""
@shown_id = @id
@no_scan = false
@description = nil
@descript1 = @descript2 = @descript3 = nil
self.note.split(/[\r\n]+/).each do |line|
info = []
case line
when Venka::Notetag::Skip_Enemy; @skip = true
when Venka::Notetag::No_Scan; @no_scan = true
when Venka::Notetag::Enemy_Category
$1.scan(/\d+/).each { |num| info.push(num.to_i) }
@category = info ? info : 0
when Venka::Notetag::BG_Floor; @bg_floor = $1.to_s
when Venka::Notetag::BG_Wall; @bg_wall = $1.to_s
when Venka::Notetag::Enemy_Desc1; @descript1 = $1.to_s
when Venka::Notetag::Enemy_Desc2; @descript2 = $1.to_s
when Venka::Notetag::Enemy_Desc3; @descript3 = $1.to_s
when Venka::Notetag::Shown_ID; @shown_id = $1.to_i
end
end
end
end
#==============================================================================
# ■ BattleManager
#==============================================================================
module BattleManager
#----------------------------------------------------------------------------
# ● alias method: battle_start
#----------------------------------------------------------------------------
class << self; alias bestiary_battle_start battle_start; end
def self.battle_start
bestiary_battle_start
add_bestiary_enemies
end
#----------------------------------------------------------------------------
# ○ new method: add_bestiary_enemies
#----------------------------------------------------------------------------
def self.add_bestiary_enemies
$game_troop.members.each do |enemy|
rpg_enemy = $data_enemies[enemy.enemy_id]
next if rpg_enemy.nil? || rpg_enemy.skip
unless $game_party.bestiary_include?(rpg_enemy.shown_id)
$game_party.add_enemy($data_enemies[rpg_enemy.shown_id])
end
end
end
end
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#----------------------------------------------------------------------------
# ● upgraded method: add_state
#----------------------------------------------------------------------------
def add_state(state_id)
Venka::Bestiary::States.each_with_index do |id, i|
next unless state_id == id
$game_party.bestiary.each do |enemy|
next unless enemy.enemy_id == $data_enemies[@enemy_id].shown_id
enemy.states[i] = true
end
end
super
end
end
#==============================================================================
# ■ Game_Troop
#==============================================================================
class Game_Troop < Game_Unit
#----------------------------------------------------------------------------
# ● alias method: battle_start
#----------------------------------------------------------------------------
alias bestiary_kill_count make_drop_items
def make_drop_items
add_encounter_count
bestiary_kill_count
end
#----------------------------------------------------------------------------
# ○ new method: add_encounter_count
#----------------------------------------------------------------------------
def add_encounter_count
dead_members.each do |enemy|
rpg_enemy = $data_enemies[enemy.enemy_id]
next if rpg_enemy.nil? || rpg_enemy.skip
$game_party.bestiary.each do |entry|
next unless entry.enemy_id == rpg_enemy.shown_id
entry.kills += 1
case entry.kills
when Venka::Bestiary::Show_Elements
entry.elements.size.times {|i| entry.elements[i] = true}
when Venka::Bestiary::Show_States
entry.states.size.times {|i| entry.states[i] = true}
end
end
end
end
end
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party < Game_Unit
#----------------------------------------------------------------------------
# ♦ Public Instance Variables
#----------------------------------------------------------------------------
attr_accessor :bestiary
#----------------------------------------------------------------------------
# ● alias method: initialize
#----------------------------------------------------------------------------
alias venka_bestiary_enounters_ini initialize
def initialize
venka_bestiary_enounters_ini
@bestiary = []
end
#----------------------------------------------------------------------------
# ○ new method: add_enemy
#----------------------------------------------------------------------------
# The entries are: EnemyID, BestiaryCategory, Array for Element info,
# Array for State info, Kill Counter, Actor Quotes, and Scanned?
#----------------------------------------------------------------------------
def add_enemy(enemy)
@bestiary << Bestiary_Entry.new(enemy.id, enemy.category,
Array.new(Venka::Bestiary::Elements.size, false),
Array.new(Venka::Bestiary::States.size, false), 0, [], false)
end
#----------------------------------------------------------------------------
# ○ new method: reveal_resist
#----------------------------------------------------------------------------
def reveal_resist(enemy_id, reveal = true)
rpg_enemy = $data_enemies[enemy_id]
return if rpg_enemy.nil? || rpg_enemy.skip
@bestiary.each do |entry|
next unless entry.enemy_id == rpg_enemy.shown_id
next if rpg_enemy.no_scan && !reveal
entry.elements.size.times {|i| entry.elements[i] = true}
entry.states.size.times {|i| entry.states[i] = true}
end
end
#----------------------------------------------------------------------------
# ○ new method: bestiary_include?
#----------------------------------------------------------------------------
def bestiary_include?(id)
@bestiary.each do |entry|
return true if entry.enemy_id == id
end
return false
end
end
#==============================================================================
# ■ Game_Interpreter
#==============================================================================
class Game_Interpreter
#----------------------------------------------------------------------------
# ○ new method: add_enemy_entry
#----------------------------------------------------------------------------
def add_enemy_entry(enemy_id)
rpg_enemy = $data_enemies[enemy_id]
return if rpg_enemy.nil? || rpg_enemy.skip
if $game_party.bestiary == []
$game_party.add_enemy($data_enemies[rpg_enemy.shown_id])
elsif !$game_party.bestiary_include?(rpg_enemy.shown_id)
$game_party.add_enemy($data_enemies[rpg_enemy.shown_id])
end
end
#----------------------------------------------------------------------------
# ○ new method: set_enemy_description
#----------------------------------------------------------------------------
def set_enemy_description(enemy_id, text)
id = $data_enemies[enemy_id].shown_id
$data_enemies[id].description = text
end
#----------------------------------------------------------------------------
# ○ new method: reset_enemy_description
#----------------------------------------------------------------------------
def reset_enemy_description(enemy_id)
id = $data_enemies[enemy_id].shown_id
$data_enemies[id].description = nil
end
#----------------------------------------------------------------------------
# ○ new method: enemy_kill_count(enemy_id)
#----------------------------------------------------------------------------
def enemy_kill_count(enemy_id)
kills = 0
$game_party.bestiary.each do |entry|
next unless entry.enemy_id == $data_enemies[enemy_id].shown_id
kills = entry.kills
case kills
when Venka::Bestiary::Show_Elements
entry.elements.size.times {|i| entry.elements[i] = true}
when Venka::Bestiary::Show_States
entry.states.size.times {|i| entry.states[i] = true}
end
end
return kills
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#----------------------------------------------------------------------------
# ○ new method: set_windowskin
#----------------------------------------------------------------------------
def set_windowskin
return unless Venka::Bestiary::Windowskin
self.windowskin = Cache.system(Venka::Bestiary::Windowskin)
self.opacity = Venka::Bestiary::Window_Opacity
self.back_opacity = Venka::Bestiary::Window_BGOpacity
end
#----------------------------------------------------------------------------
# ○ new method: get_color - method determines if text color or new color
#----------------------------------------------------------------------------
def get_color(input)
input.is_a?(Integer) ? text_color([[input, 0].max, 31].min) : Color.new(*input)
end
#----------------------------------------------------------------------------
# ○ new method: font_color
#----------------------------------------------------------------------------
def font_color(text_type)
f_color = Venka::Bestiary::Fonts[text_type][3]
color = f_color.is_a?(Integer) ? text_color(f_color) : Color.new(*f_color)
end
#----------------------------------------------------------------------------
# ○ new method: set_bestiary_font
#----------------------------------------------------------------------------
def set_bestiary_font(text_type, enabled = true)
font = Venka::Bestiary::Fonts[text_type]
contents.font.name = font[0]
contents.font.size = font[1]
contents.font.bold = font[2]
contents.font.outline = font[4]
change_color(font_color(text_type), enabled)
end
#----------------------------------------------------------------------------
# ○ new method: font_height
#----------------------------------------------------------------------------
def font_height
[contents.font.size, 24].max
end
#----------------------------------------------------------------------------
# ○ new method: draw_line
#----------------------------------------------------------------------------
def draw_line(y)
return unless Venka::Bestiary::Use_Dividers
color = get_color(Venka::Bestiary::Line_Color)
contents.fill_rect(4, y, contents_width - 8, 2, color)
contents.fill_rect(4, y + 2, contents_width - 8, 1, Color.new(16,16,16,100))
end
end
#==============================================================================
# ■ Window_Message
#==============================================================================
class Window_Message
#----------------------------------------------------------------------------
# ♦ Public Instance Variables
#----------------------------------------------------------------------------
attr_accessor :wordwrap
end
#==============================================================================
# ■ Window_MenuCommand
#==============================================================================
class Window_MenuCommand < Window_Command
#----------------------------------------------------------------------------
# ● alias method: add_original_commands
#----------------------------------------------------------------------------
alias bestiary_menu_access_aoc add_original_commands
def add_original_commands
bestiary_menu_access_aoc
add_command(Venka::Bestiary::Bestiary_Command, :bestiary) if Venka::Bestiary::Menu_Access
end
end
#==============================================================================
# ■ Window_BattleLog
#==============================================================================
class Window_BattleLog < Window_Selectable
#----------------------------------------------------------------------------
# ● alias method: display_failure
#----------------------------------------------------------------------------
alias bestiary_scan_fail_msg display_failure
def display_failure(target, item)
if item.scan && target.result.hit? && !target.result.success
text = $data_enemies[target.enemy_id].no_scan ? Vocab::No_Scan : Vocab::Scanned
add_text(sprintf(text, target.name))
wait
else
bestiary_scan_fail_msg(target, item)
end
end
end
#==============================================================================
# ■ Window_BestiaryHelp
#==============================================================================
class Window_BestiaryHelp < Window_Base
#----------------------------------------------------------------------------
# ● upgraded method: initialize
#----------------------------------------------------------------------------
def initialize(x, y)
height = [Venka::Bestiary::Fonts[:normal_font][1], 24].max + 24
super(x, y, Graphics.width, height)
set_windowskin
end
#----------------------------------------------------------------------------
# ○ new method: set_text
#----------------------------------------------------------------------------
def set_text(text)
contents.clear
set_bestiary_font(:normal_font)
draw_text(0, 0, contents.width, font_height, text, 1)
end
#----------------------------------------------------------------------------
# ○ new method: draw_completion
#----------------------------------------------------------------------------
def draw_completion
contents.clear
draw_enemies_discovered
end
#----------------------------------------------------------------------------
# ○ new method: draw_enemies_discovered
#----------------------------------------------------------------------------
def draw_enemies_discovered
set_bestiary_font(:normal_font)
enemies_discovered = $game_party.bestiary.size
total = total_enemies
text = "#{enemies_discovered}/#{total} #{Venka::Bestiary::Discovered_Text}"
draw_text(0, 0, contents.width, font_height, text)
discovered = (enemies_discovered.to_f / total) * 100
text = "#{discovered.round(1)}% #{Venka::Bestiary::Percent_Finished}"
draw_text(0, 0, contents.width, font_height, text, 2)
end
#----------------------------------------------------------------------------
# ○ new method: total_enemies
#----------------------------------------------------------------------------
def total_enemies
total = 0
for i in 1...$data_enemies.size
next if $data_enemies[i].shown_id != $data_enemies[i].id
total += 1 unless $data_enemies[i].skip
end
total
end
#----------------------------------------------------------------------------
# ○ new method: draw_instructions
#----------------------------------------------------------------------------
def draw_instructions
contents.clear
set_bestiary_font(:normal_font)
text = Venka::Bestiary::Instructions_Text
draw_text(0, 0, contents.width, font_height, text, 1)
end
#----------------------------------------------------------------------------
# ○ new method: set_description
#----------------------------------------------------------------------------
def set_description(enemy)
contents.clear
create_contents # Remake contents since the window size changed
get_description_text(enemy)
text = get_description_text(enemy)
if Venka::Bestiary::Use_Wordwrapper
wrapping = @wordwrap
@wordwrap = true
draw_text_ex(0, 0, text.gsub(/[|]/, ""))
@wordwrap = wrapping
else
draw_text_ex(0, 0, text.gsub(/[|]/, "\n"))
end
end
#----------------------------------------------------------------------------
# ○ new method: get_description_text
#----------------------------------------------------------------------------
def get_description_text(enemy)
if enemy.description
text = enemy.description
else
text = Venka::Bestiary::Default_Description
kills = 0
$game_party.bestiary.each do |foe|
kills = foe.kills if foe.enemy_id == enemy.shown_id
end
if kills >= Venka::Bestiary::Description3 && enemy.descript3
text = enemy.descript3
elsif kills >= Venka::Bestiary::Description2 && enemy.descript2
text = enemy.descript2
elsif kills >= Venka::Bestiary::Description1 && enemy.descript1
text = enemy.descript1
end
end
text
end
#----------------------------------------------------------------------------
# ● upgraded method: draw_text_ex
#----------------------------------------------------------------------------
def draw_text_ex(x, y, text)
set_bestiary_font(:description)
text = convert_escape_characters(text)
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
process_character(text.slice!(0, 1), text, pos) until text.empty?
end
end
#==============================================================================
# ■ Window_BestiaryCategory
#==============================================================================
class Window_BestiaryCategory < Window_Command
#----------------------------------------------------------------------------
# ● upgraded method: initialize
#----------------------------------------------------------------------------
def initialize(x, y)
@wy = y
@categories = Venka::Bestiary::Category
super(x, @wy)
set_windowskin
end
#----------------------------------------------------------------------------
# ● window settings
#----------------------------------------------------------------------------
def window_width; Graphics.width * 0.5; end
def window_height; Graphics.height - (@wy * 2); end
def item_height; [Venka::Bestiary::Fonts[:list_font][1], 24].max; end
#----------------------------------------------------------------------------
# ● upgraded method: make_command_list
#----------------------------------------------------------------------------
def make_command_list
@categories.each{|key, info| add_command(info[:name], key)}
end
#----------------------------------------------------------------------------
# ● upgraded method: draw_item
#----------------------------------------------------------------------------
def draw_item(index)
set_bestiary_font(:normal_font)
@width = Venka::Bestiary::Track_Progress ? text_size("99.9%").width + 5 : 0
rect = item_rect_for_text(index)
set_bestiary_font(:list_font)
draw_text(rect.x, rect.y, rect.width - @width, rect.height, command_name(index))
found_text(index, rect) if Venka::Bestiary::Track_Progress
end
#----------------------------------------------------------------------------
# ○ new method: found_text
#----------------------------------------------------------------------------
def found_text(index, rect)
set_bestiary_font(:normal_font)
total = total_enemies(index)
discovered = total_found(index)
value = (total > 0) ? (discovered.to_f / total) * 100 : 0.0
text = (value > 0 && value < 100) ? value.round(1) : value.round
draw_text(rect.width - @width, rect.y, @width, rect.height, "#{text}%", 2)
end
#----------------------------------------------------------------------------
# ○ new method: total_enemies
#----------------------------------------------------------------------------
def total_enemies(index)
total = 0
for i in 1...$data_enemies.size
next unless $data_enemies[i].category.include?(index)
next if $data_enemies[i].shown_id != $data_enemies[i].id
total += 1 unless $data_enemies[i].skip
end
return total
end
#----------------------------------------------------------------------------
# ○ new method: total_found
#----------------------------------------------------------------------------
def total_found(index)
total = 0
$game_party.bestiary.each {|e| total += 1 if e.category.include?(index)}
return total
end
end
#==============================================================================
# ■ Window_BestiaryEnemyList
#==============================================================================
class Window_BestiaryEnemyList < Window_Command
#----------------------------------------------------------------------------
# ♦ Public Instance Variables
#----------------------------------------------------------------------------
attr_reader :category_window, :stats_window
#----------------------------------------------------------------------------
# ● upgraded method: initialize
#----------------------------------------------------------------------------
def initialize(x, y)
@category = 0
@wy = y
super(x, @wy)
set_windowskin
end
#----------------------------------------------------------------------------
# ● window settings
#----------------------------------------------------------------------------
def window_width; Graphics.width * 0.5; end
def window_height; Graphics.height - (@wy * 2); end
def item_height; [Venka::Bestiary::Fonts[:list_font][1], 24].max; end
#----------------------------------------------------------------------------
# ○ new method: category_window
#----------------------------------------------------------------------------
def category_window=(category_window)
if @category_window != category_window
@category_window = category_window
@category = category_window.current_symbol.to_s.to_i
refresh
end
end
#----------------------------------------------------------------------------
# ○ new method: stats_window
#----------------------------------------------------------------------------
def stats_window=(stats_window)
if @stats_window != stats_window
@stats_window = stats_window
end
end
#----------------------------------------------------------------------------
# ● upgraded method: make_command_list
#----------------------------------------------------------------------------
def make_command_list
@enemies = []
sort_list
@bestiary_list.each do |enemy|
next if enemy.nil?
next unless enemy.category.include?(@category)
@enemies << enemy
add_command($data_enemies[enemy.enemy_id].name, :ok, true, enemy.enemy_id)
end
end
#----------------------------------------------------------------------------
# ○ new method: sort_list
#----------------------------------------------------------------------------
def sort_list
@bestiary_list = $game_party.bestiary.clone
if Venka::Bestiary::Sort_Type == :id # Sort by enemy id
@bestiary_list.sort!{|a, b| a.enemy_id <=> b.enemy_id}
elsif Venka::Bestiary::Sort_Type == :name # Sort by name
@bestiary_list.sort!{|a, b|
$data_enemies[a.enemy_id].name <=> $data_enemies[b.enemy_id].name}
end
end
#----------------------------------------------------------------------------
# ● upgraded method: draw_item
#----------------------------------------------------------------------------
def draw_item(index)
set_bestiary_font(:normal_font)
@width = contents_width * 0.33
@width = 0 unless Venka::Bestiary::Track_Kills
rect = item_rect_for_text(index)
set_bestiary_font(:list_font)
draw_text(rect.x, rect.y, rect.width - @width, rect.height, command_name(index))
draw_kills(index) if Venka::Bestiary::Track_Kills
end
#----------------------------------------------------------------------------
# ○ new method: draw_kills
#----------------------------------------------------------------------------
def draw_kills(index)
set_bestiary_font(:normal_font)
text = "#{@enemies[index].kills} #{Venka::Bestiary::Kills_Text}"
draw_text(item_rect_for_text(index), text, 2)
end
#----------------------------------------------------------------------------
# ● upgraded method: update
#----------------------------------------------------------------------------
def update
super
if @category_window && @category != @category_window.current_symbol.to_s.to_i
@category = @category_window.current_symbol.to_s.to_i
refresh
end
end
end
#==============================================================================
# ■ Window_BestiaryStatSelection
#==============================================================================
class Window_BestiaryStatSelection < Window_Selectable
#----------------------------------------------------------------------------
# ● upgraded method: initialize
#----------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
set_windowskin
select(0)
hide
refresh
end
#----------------------------------------------------------------------------
# ● window settings;
#----------------------------------------------------------------------------
def col_max; return item_max; end
def spacing; return 5; end
def item_height; [Venka::Bestiary::Fonts[:normal_font][1].size, 24].max; end
#----------------------------------------------------------------------------
# ● upgraded method: item_max
#----------------------------------------------------------------------------
def item_max
if SceneManager.scene_is?(Scene_Battle)
Venka::Bestiary::Show_Debuff_Info ? 4 : 3
else
return 2
end
end
#----------------------------------------------------------------------------
# ○ new method: enemy_id
#----------------------------------------------------------------------------
def enemy_id=(enemy_id)
return @enemy = nil if enemy_id == 0
if @enemy != $data_enemies[enemy_id]
@enemy = $data_enemies[enemy_id]
refresh
end
end
#----------------------------------------------------------------------------
# ● upgraded method: item_rect
#----------------------------------------------------------------------------
def item_rect(index)
rect = super
if SceneManager.scene_is?(Scene_Battle)
rect.y += [Venka::Bestiary::Fonts[:normal_font][1], 24].max + 6
end
rect
end
#----------------------------------------------------------------------------
# ● upgraded method: draw_item
#----------------------------------------------------------------------------
def draw_item(index)
rect = item_rect_for_text(index)
if SceneManager.scene_is?(Scene_Battle)
text = [Venka::Bestiary::View_Stats, Venka::Bestiary::View_Element,
Venka::Bestiary::View_States, Venka::Bestiary::View_Debuff]
else
text = [Venka::Bestiary::View_Stats, Venka::Bestiary::View_More]
end
set_bestiary_font(:normal_font)
draw_text(rect, text[index], 1)
end
#----------------------------------------------------------------------------
# ● upgraded method: refresh
#----------------------------------------------------------------------------
def refresh
contents.clear
if SceneManager.scene_is?(Scene_Battle)
set_bestiary_font(:normal_font)
@y = font_height
draw_enemy_name if @enemy
end
draw_all_items
end
#----------------------------------------------------------------------------
# ○ new method: draw_enemy_name
#----------------------------------------------------------------------------
def draw_enemy_name
draw_text(0, 0, contents.width, font_height, @enemy.name, 1)
draw_line(@y + 2)
@y += 6
draw_line(@y + item_height + 3)
end
#----------------------------------------------------------------------------
# ● upgraded method: update_help
#----------------------------------------------------------------------------
def update_help
@help_window.set_index(@index)
end
#----------------------------------------------------------------------------
# ● upgraded method: select
#----------------------------------------------------------------------------
def select(index)
super
@help_window.oy = 0 if @help_window
end
#----------------------------------------------------------------------------
# ● upgraded method: cursor_down
#----------------------------------------------------------------------------
def cursor_down(wrap = false)
super
if @help_window && display_window_oy < @help_window.total_height
@help_window.oy += Venka::Bestiary::Scroll_Speed
end
end
#----------------------------------------------------------------------------
# ○ new method: display_window_oy
#----------------------------------------------------------------------------
def display_window_oy
@help_window.oy + @help_window.height - (@help_window.standard_padding * 2)
end
#----------------------------------------------------------------------------
# ● upgraded method: cursor_up
#----------------------------------------------------------------------------
def cursor_up(wrap = false)
super
@help_window.oy -= Venka::Bestiary::Scroll_Speed if @help_window && @help_window.oy > 0
end
#----------------------------------------------------------------------------
# ○ new method: wait_to_close
#----------------------------------------------------------------------------
def wait_to_close
loop do
Graphics.update
Input.update
update
break if Input.trigger?(:C) || Input.trigger?(:B)
end
@help_window.hide
deactivate
self.hide
end
end
#==============================================================================
# ■ Window_BestiaryStats
#==============================================================================
class Window_BestiaryStats < Window_Base
#----------------------------------------------------------------------------
# ♦ Public Instance Variables
#----------------------------------------------------------------------------
attr_accessor :enemy, :total_height
#----------------------------------------------------------------------------
# ● upgraded method: initialize
#----------------------------------------------------------------------------
def initialize(x, y, width, height)
@win_height = height
super(x, y, width, height)
self.opacity = 0
@enemy = nil
hide
end
#----------------------------------------------------------------------------
# ○ new method: enemy_id
#----------------------------------------------------------------------------
def enemy_id=(enemy_id)
return @enemy = nil if enemy_id == 0
if @enemy != $data_enemies[enemy_id]
@enemy = $data_enemies[enemy_id]
refresh
end
end
#----------------------------------------------------------------------------
# ○ new method: set_index
#----------------------------------------------------------------------------
def set_index(index)
if @index != index
@index = index
refresh
end
end
#----------------------------------------------------------------------------
# ● upgraded method: contents_height
#----------------------------------------------------------------------------
def contents_height
@total_height ? @total_height : super
end
#----------------------------------------------------------------------------
# ● upgraded method: refresh
#----------------------------------------------------------------------------
def refresh
contents.clear
return if @enemy.nil?
if SceneManager.scene_is?(Scene_Bestiary)
@index == 0 ? draw_basic_stats : draw_other_info
end
end
#----------------------------------------------------------------------------
# ○ new method: determine_window_height
#----------------------------------------------------------------------------
def determine_window_height(text_lines)
set_bestiary_font(:header_font)
@total_height = font_height * text_lines
self.height = ([(@total_height + standard_padding * 2), @win_height].min)
create_contents
end
#----------------------------------------------------------------------------
# ○ new method: info_rect
#----------------------------------------------------------------------------
def info_rect(index)
rect = Rect.new
rect.width = contents.width * 0.5 - 3
rect.height = [Venka::Bestiary::Fonts[:stat_name][1], 24].max
rect.x = index % 2 * (rect.width + 3)
rect.y = index / 2 * font_height
rect
end
#----------------------------------------------------------------------------
# ○ new method: draw_basic_stats
#----------------------------------------------------------------------------
def draw_basic_stats
elements = Venka::Bestiary::Elements.size
states = Venka::Bestiary::States.size
# Get the total text lines to show
height = (elements / 2 + elements % 2) + (states / 2 + states % 2) + 10
height += 6 if Venka::Bestiary::Show_Debuff_Info
determine_window_height(height)
draw_line(5)
@y = 12
draw_main_stats
draw_line(@y + 5)
@y += 12
get_revealed_resists
draw_elements
draw_line(@y + 5)
@y += 12
draw_states
return unless Venka::Bestiary::Show_Debuff_Info
draw_line(@y + 5)
@y += 12
draw_debuffs
end
#----------------------------------------------------------------------------
# ○ new method: draw_main_stats
#----------------------------------------------------------------------------
def draw_main_stats
set_bestiary_font(:header_font)
draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Stats_Text, 1)
@y += font_height
8.times {|stat| draw_stat(stat, :stat)}
@y += info_rect(0).height * 4
end
#----------------------------------------------------------------------------
# ○ new method: draw_stat
#----------------------------------------------------------------------------
def draw_stat(stat, stat_type)
rect = info_rect(stat)
rect.y += @y
stat_info = Venka::Bestiary::Base_Stats[stat]
if stat_info[1]
draw_icon(stat_info[1], rect.x, rect.y)
rect.x += 25; rect.width -= 25
end
if stat_info[0]
set_bestiary_font(:stat_name)
draw_text(rect, stat_info[0])
text_width = text_size(stat_info[0]).width + 5
rect.x += text_width; rect.width -= text_width
end
set_bestiary_font(:stats_font)
text = Venka::Bestiary::Unknown_Stat
$game_party.bestiary.each do |entry|
next unless entry.enemy_id == @enemy.shown_id
if stat_type == :stat && (entry.scanned ||
entry.kills >= Venka::Bestiary::Show_BaseStats)
text = Game_Enemy.new(0, @enemy.shown_id).param(stat)
elsif stat_type == :debuff && (entry.scanned ||
entry.kills >= Venka::Bestiary::Show_DebuffStats)
rate = Game_Enemy.new(0, @enemy.shown_id).debuff_rate(stat)
text = get_resist_info(stat, rate)
end
end
draw_text(rect, text, 2)
end
#----------------------------------------------------------------------------
# ○ new method: get_revealed_resists
#----------------------------------------------------------------------------
def get_revealed_resists
$game_party.bestiary.each do |entry|
@eles = entry.elements if entry.enemy_id == @enemy.shown_id
@states = entry.states if entry.enemy_id == @enemy.shown_id
end
end
#----------------------------------------------------------------------------
# ○ new method: draw_elements
#----------------------------------------------------------------------------
def draw_elements
set_bestiary_font(:header_font)
draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Element_Text, 1)
@y += font_height
elements = Venka::Bestiary::Elements
(elements.size).times {|i| draw_ele_info(i, elements[i], info_rect(i))}
@y += (info_rect(0).height) * (elements.size * 0.5 + elements.size % 2)
end
#----------------------------------------------------------------------------
# ○ new method: draw_ele_info
#----------------------------------------------------------------------------
def draw_ele_info(i, element, rect)
rect.y += @y
if element[1]
draw_icon(element[1], rect.x, rect.y)
rect.x += 25; rect.width -= 25
end
set_bestiary_font(:stat_name)
tw = text_size(99).width + 5
draw_text(rect, $data_system.elements[element[0]])
text_width = text_size(element[0]).width + 5
# Scale text so the value will fit as well in small resolutions
rect.x = [(rect.x + text_width), (rect.x + rect.width - tw)].min
rect.width = [(rect.width - text_width), tw].max
set_bestiary_font(:stats_font)
text = @eles[i] ? get_resist_info(element[0], 11) : Venka::Bestiary::Unknown_Stat
draw_text(rect, text, 2)
end
#----------------------------------------------------------------------------
# ○ new method: get_resist_info
#----------------------------------------------------------------------------
def get_resist_info(stat_id, code_id)
case code_id
when 11 # Element
resist = Game_Enemy.new(0, @enemy.shown_id).element_rate(stat_id)
if $imported["YEA-Element Absorb"] && Game_Enemy.new(0, @enemy.shown_id).element_absorb?(stat_id)
set_resist_style(resist, Venka::Bestiary::Absorb_Text)
else
set_resist_style(resist)
end
when 13
enemy = Game_Enemy.new(0, @enemy.shown_id)
if enemy.features_with_id(14, stat_id).empty?
resist = enemy.state_rate(stat_id)
set_resist_style(resist)
else
set_resist_style(1.0, Venka::Bestiary::Immune_Text)
end
else
set_resist_style(code_id)
end
end
#----------------------------------------------------------------------------
# ○ new method: set_resist_style
#----------------------------------------------------------------------------
def set_resist_style(resist, text = "")
if text != ""
color = Venka::Bestiary::Immunity_Color
else
color = Venka::Bestiary::Fonts[:stats_font][3]
color = Venka::Bestiary::High_Resist if resist > 1.0
color = Venka::Bestiary::Low_Resist if resist < 1.0
resist -= 1.0 if resist >= 1.0
text = (resist * 100).round
end
new_color = color.is_a?(Integer) ? text_color(color) : Color.new(*color)
change_color(new_color)
return text
end
#----------------------------------------------------------------------------
# ○ new method: draw_states
#----------------------------------------------------------------------------
def draw_states
set_bestiary_font(:header_font)
draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Status_Text, 1)
@y += font_height
states = Venka::Bestiary::States
(states.size).times {|i| draw_state_info(i, states[i], info_rect(i))}
@y += (info_rect(0).height) * (states.size / 2).round
end
#----------------------------------------------------------------------------
# ○ new method: draw_state_info
#----------------------------------------------------------------------------
def draw_state_info(i, state_id, rect)
state = $data_states[state_id]
rect.y += @y
draw_icon(state.icon_index, rect.x, rect.y)
rect.x += 25; rect.width -= 25
set_bestiary_font(:stat_name)
tw = text_size(99).width + 5
draw_text(rect.x, rect.y, rect.width - tw, rect.height, state.name)
text_width = text_size(state.name).width + 5
# Scale text so the value will fit as well in small resolutions
rect.x = [(rect.x + text_width), (rect.x + rect.width - tw)].min
rect.width = [(rect.width - text_width), tw].max
set_bestiary_font(:stats_font)
text = @states[i] ? get_resist_info(state_id, 13) : Venka::Bestiary::Unknown_Stat
draw_text(rect, text, 2)
end
#----------------------------------------------------------------------------
# ○ new method: draw_debuffs
#----------------------------------------------------------------------------
def draw_debuffs
set_bestiary_font(:header_font)
draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Debuff_Text, 1)
@y += font_height
8.times do |stat|
draw_stat(stat, :debuff)
end
end
#----------------------------------------------------------------------------
# ○ new method: draw_other_info
#----------------------------------------------------------------------------
def draw_other_info
# Get the number of lines to display loot
drops = @enemy.drop_items.select {|d| d.kind > 0 }
# Get the number of lines to display enemy skills
ids = []
@enemy.actions.each do |action|
ids << action.skill_id unless ids.include?(action.skill_id)
end
# Total number of lines to display with skills, loot, headers, etc
height = 5 + drops.size + ids.size
determine_window_height(height)
draw_line(5)
@y = 12
set_bestiary_font(:header_font)
draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Loot_Text, 1)
@y += font_height
draw_exp_and_gold
draw_drops
draw_skills
end
#----------------------------------------------------------------------------
# ○ new method: draw_exp
#----------------------------------------------------------------------------
def draw_exp_and_gold
exp = Venka::Bestiary::Exp_Text
gold = Venka::Bestiary::Gold_Text
width = contents.width
width = ((@enemy.exp > 0 || @enemy.gold > 0) ? width * 0.5 : width).to_i
draw_icon_text(exp, 0, width, @enemy.exp) if @enemy.exp > 0
x = @enemy.exp > 0 ? width : 0
draw_icon_text(gold, x, width, @enemy.gold) if @enemy.gold > 0
@y += font_height
end
#----------------------------------------------------------------------------
# ○ new method: draw_icon_and_text
#----------------------------------------------------------------------------
def draw_icon_text(info, x, width, amount)
draw_icon(info[1], x, @y) if info[1]
dx = info[1] ? 25 : 0
set_bestiary_font(:stat_name)
draw_text(x + dx, @y, width - dx, font_height, info[0])
set_bestiary_font(:stats_font)
dx += text_size(info[0]).width + 10
draw_text(x + dx, @y, width - dx, font_height, amount)
end
#----------------------------------------------------------------------------
# ○ new method: draw_drops
#----------------------------------------------------------------------------
def draw_drops
drops_revealed = false
$game_party.bestiary.each do |entry|
next unless entry.enemy_id == @enemy.shown_id
if entry.scanned || entry.kills >= Venka::Bestiary::Show_Loot
drops_revealed = true
end
end
if drops_revealed
@enemy.drop_items.each do |drop_info|
next if drop_info.kind == 0
item = $data_items[drop_info.data_id] if drop_info.kind == 1
item = $data_weapons[drop_info.data_id] if drop_info.kind == 2
item = $data_armors[drop_info.data_id] if drop_info.kind == 3
set_bestiary_font(:stat_name)
tw = text_size("100%").width + 5
draw_item_name(item, 0, @y, contents.width - tw)
chance = (1.to_f / drop_info.denominator) * 100
chance = (chance > 0.9) ? chance.round : chance.round(1)
set_bestiary_font(:stats_font)
draw_text(0, @y, contents.width, font_height, "#{chance}%", 2)
@y += font_height
end
else
set_bestiary_font(:stat_name)
draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Unknown_Loot)
@y += font_height
end
draw_line(@y + 5)
@y += 12
end
#----------------------------------------------------------------------------
# ○ new method: draw_skills
#----------------------------------------------------------------------------
def draw_skills
set_bestiary_font(:header_font)
draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Skill_Text, 1)
@y += font_height
set_bestiary_font(:stat_name)
skills_revealed = false
$game_party.bestiary.each do |entry|
next unless entry.enemy_id == @enemy.shown_id
if entry.scanned || entry.kills >= Venka::Bestiary::Show_Abilities
skills_revealed = true
end
end
if skills_revealed
skills.each do |id|
draw_item_name($data_skills[id], 0, @y, contents.width)
@y += font_height
end
else
draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Unknown_Skills)
end
end
#----------------------------------------------------------------------------
# ○ new method: skills
#----------------------------------------------------------------------------
def skills
ids = []
@enemy.actions.each do |action|
ids << action.skill_id unless ids.include?(action.skill_id)
end
return ids
end
end
#==============================================================================
# ■ Window_BattleScan
#==============================================================================
class Window_BattleScan < Window_BestiaryStats
#----------------------------------------------------------------------------
# ♦ Public Instance Variables
#----------------------------------------------------------------------------
attr_accessor :show_stats
#----------------------------------------------------------------------------
# ● upgraded method: initialize
#----------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
end
#----------------------------------------------------------------------------
# ● upgraded method: refresh
#----------------------------------------------------------------------------
def refresh
contents.clear
return if @enemy.nil?
if $game_party.bestiary_include?(@enemy.shown_id)
@y = 0
case @index
when 0; draw_basic_stats
when 1; draw_enemy_resists
when 2; draw_enemy_states
when 3; draw_debuff_rates
end
else
set_bestiary_font(:stat_name)
text = Venka::Bestiary::No_Info
draw_text(0, 0, contents.width, contents.height, text, 1)
end
end
#----------------------------------------------------------------------------
# ○ new method: draw_basic_stats
#----------------------------------------------------------------------------
def draw_basic_stats
determine_window_height(4)
8.times {|stat| draw_stat(stat, :stat)}
end
#----------------------------------------------------------------------------
# ○ new method: draw_enemy_resists
#----------------------------------------------------------------------------
def draw_enemy_resists
elements = Venka::Bestiary::Elements
height = (elements.size / 2) + (elements.size % 2)
determine_window_height(height)
get_revealed_resists
(elements.size).times {|i| draw_ele_info(i, elements[i], info_rect(i))}
end
#----------------------------------------------------------------------------
# ○ new method: draw_enemy_states
#----------------------------------------------------------------------------
def draw_enemy_states
states = Venka::Bestiary::States
height = (states.size / 2) + (states.size % 2)
determine_window_height(height)
(states.size).times {|i| draw_state_info(i, states[i], info_rect(i))}
end
#----------------------------------------------------------------------------
# ○ new method: draw_debuff_rates
#----------------------------------------------------------------------------
def draw_debuff_rates
determine_window_height(4)
8.times {|stat| draw_stat(stat, :debuff)}
end
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase
#----------------------------------------------------------------------------
# ● alias method: create_command_window
#----------------------------------------------------------------------------
alias bestiary_menu_access_ccw create_command_window
def create_command_window
bestiary_menu_access_ccw
@command_window.set_handler(:bestiary, method(:command_bestiary))
end
#----------------------------------------------------------------------------
# ○ new method: command_bestiary
#----------------------------------------------------------------------------
def command_bestiary
SceneManager.call(Scene_Bestiary)
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#----------------------------------------------------------------------------
# ● alias method: create_all_windows
#----------------------------------------------------------------------------
alias scan_window_caw create_all_windows
def create_all_windows
scan_window_caw
create_info_instructions
create_stats_selection
create_stats_window
end
#----------------------------------------------------------------------------
# ○ new method: create_stats_selection
#----------------------------------------------------------------------------
def create_stats_selection
width = [Graphics.width * 0.6, 420].max
x = (Graphics.width - width) * 0.5
# Get total height of the window since it can change based on fonts used.
height = 40 + ([Venka::Bestiary::Fonts[:normal_font][1], 24].max * 2) +
([Venka::Bestiary::Fonts[:stat_name][1], 24].max * 4)
y = (Graphics.height - @status_window.height - height) * 0.5
@stats_selection = Window_BestiaryStatSelection.new(x, y, width, height)
end
#----------------------------------------------------------------------------
# ○ new method: create_stats_window
#----------------------------------------------------------------------------
def create_stats_window
y = @stats_selection.y + @stats_selection.item_height + 15 +
Venka::Bestiary::Fonts[:normal_font][1]
# Make the info window the same height as the selection window minus the
# header info and selection area.
height = @stats_selection.height - @stats_selection.item_height - 15 -
Venka::Bestiary::Fonts[:normal_font][1]
@stats_window = Window_BattleScan.new(@stats_selection.x, y,
@stats_selection.width, height)
@stats_selection.help_window = @stats_window
end
#----------------------------------------------------------------------------
# ○ new method: create_scan_window
#----------------------------------------------------------------------------
def create_info_instructions
@info_instructions = Sprite.new
@info_instructions.visible = false
font = Venka::Bestiary::Battle_Font
@info_instructions.bitmap = Bitmap.new(Graphics.width, font[1])
@info_instructions.bitmap.font.name = font[0]
@info_instructions.bitmap.font.size = font[1]
@info_instructions.bitmap.font.bold = font[2]
@info_instructions.bitmap.font.color = Color.new(*font[3])
@info_instructions.bitmap.font.outline = font[4]
text = Venka::Bestiary::Battle_Instructions
@info_instructions.bitmap.draw_text(0, 0, Graphics.width, font[1], text, 1)
@info_instructions.y = @enemy_window.y - font[1]
end
#----------------------------------------------------------------------------
# ● alias method: select_enemy_selection
#----------------------------------------------------------------------------
alias bestiary_info_enemy_select select_enemy_selection
def select_enemy_selection
@info_instructions.visible = true
bestiary_info_enemy_select
end
#----------------------------------------------------------------------------
# ● alias method: on_enemy_ok
#----------------------------------------------------------------------------
alias bestiary_info_enemy_ok on_enemy_ok
def on_enemy_ok
@info_instructions.visible = false
bestiary_info_enemy_ok
end
#----------------------------------------------------------------------------
# ● alias method: on_enemy_cancel
#----------------------------------------------------------------------------
alias bestiary_info_enemy_cancel on_enemy_cancel
def on_enemy_cancel
@info_instructions.visible = false
bestiary_info_enemy_cancel
end
#----------------------------------------------------------------------------
# ○ new method: show_enemy_info
#----------------------------------------------------------------------------
def show_enemy_info(enemy_id)
@stats_window.show
@stats_selection.enemy_id = enemy_id
@stats_window.enemy_id = enemy_id
@stats_selection.show.activate
@stats_selection.wait_to_close
end
#----------------------------------------------------------------------------
# ● alias method: update
#----------------------------------------------------------------------------
alias show_enemy_info_update update
def update
show_enemy_info_update
if @enemy_window.active && Input.trigger?(Venka::Bestiary::Scan_PopUp)
show_enemy_info(@enemy_window.enemy.enemy_id)
end
end
#----------------------------------------------------------------------------
# ● alias method: item_apply
#----------------------------------------------------------------------------
alias venka_scan_skill_used apply_item_effects
def apply_item_effects(target, item)
if target.is_a?(Game_Enemy)
enemy = $data_enemies[target.enemy_id]
$game_party.reveal_resist(enemy.id, false) if item.scan
attack_element = item.damage.element_id
Venka::Bestiary::Elements.size.times do |i|
if Venka::Bestiary::Elements[i][0] == attack_element
$game_party.bestiary.each do |entry|
entry.elements[i] = true if entry.enemy_id == enemy.shown_id
end
end
end
if item.scan
$game_party.bestiary.each do |entry|
entry.scanned = true if entry.enemy_id == enemy.shown_id
end
show_enemy_info(target.enemy_id)
end
end
venka_scan_skill_used(target, item)
end
#----------------------------------------------------------------------------
# ● alias method: terminate
#----------------------------------------------------------------------------
alias :dispose_instructions_on_term :terminate
def terminate
dispose_instructions_on_term
dispose_instructions
end
#----------------------------------------------------------------------------
# ○ new method: dispose_instructions
#----------------------------------------------------------------------------
def dispose_instructions
return if @info_instructions
@info_instructions.bitmap.dispose
@info_instructions.dispose
@info_instructions = nil
end
end
#==============================================================================
# ■ Scene_Bestiary
#==============================================================================
class Scene_Bestiary < Scene_MenuBase
#----------------------------------------------------------------------------
# ● upgraded method: start
#----------------------------------------------------------------------------
def start
stop_music if Venka::Bestiary::Bestiary_BGM
super
bestiary_music if Venka::Bestiary::Bestiary_BGM
@enemy = nil
create_all_windows
end
#----------------------------------------------------------------------------
# ○ new method: stop_music
#----------------------------------------------------------------------------
def stop_music
@map_bgm = RPG::BGM.last
fadeout_all(60)
end
#----------------------------------------------------------------------------
# ○ new method: bestiary_music
#----------------------------------------------------------------------------
def bestiary_music
RPG::BGM.new(*Venka::Bestiary::Bestiary_BGM).play
end
#----------------------------------------------------------------------------
# ● upgraded method: create_background
#----------------------------------------------------------------------------
def create_background
if Venka::Bestiary::BG_Image
@background_sprite = Sprite.new
@background_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
bitmap = bestiary_bgimage
dest_rect = Rect.new(0, 0, Graphics.width, Graphics.height)
@background_sprite.bitmap.stretch_blt(dest_rect, bitmap, bitmap.rect)
@background_sprite.color.set(16, 16, 16, 128)
else
super
end
end
#----------------------------------------------------------------------------
# ○ new method: bestiary_bgimage
#----------------------------------------------------------------------------
def bestiary_bgimage
file_info = Venka::Bestiary::BG_Image
begin; Cache.title1(file_info)
rescue; Cache.picture(file_info)
end
end
#----------------------------------------------------------------------------
# ○ new method: create_all_windows
#----------------------------------------------------------------------------
def create_all_windows
create_help_window
create_bottom_window
create_category_window
create_bestiary_list
create_enemy_image
create_stats_selection
create_stats_window
create_description_window
create_image_frame if Venka::Bestiary::Frame_Image
end
#----------------------------------------------------------------------------
# ● upgraded method: create_help_window
#----------------------------------------------------------------------------
def create_help_window
@help_window = Window_BestiaryHelp.new(0, 0)
@help_window.viewport = @viewport
@help_window.y = 0
@help_window.set_text(Venka::Bestiary::Category_Select)
end
#----------------------------------------------------------------------------
# ○ new method: create_bottom_window
#----------------------------------------------------------------------------
def create_bottom_window
y = Graphics.height - @help_window.height
@bottom_window = Window_BestiaryHelp.new(0, y)
@bottom_window.draw_completion
end
#----------------------------------------------------------------------------
# ○ new method: create_category_window
#----------------------------------------------------------------------------
def create_category_window
@category_window = Window_BestiaryCategory.new(0, @help_window.height)
@category_window.viewport = @viewport
@category_window.set_handler(:ok, method(:command_list))
@category_window.set_handler(:cancel, method(:return_scene))
end
#----------------------------------------------------------------------------
# ○ new method: command_list
#----------------------------------------------------------------------------
def command_list
@list_window.show.activate
@help_window.set_text(Venka::Bestiary::Enemy_Select)
end
#----------------------------------------------------------------------------
# ○ new method: create_bestiary_list
#----------------------------------------------------------------------------
def create_bestiary_list
@list_window = Window_BestiaryEnemyList.new(@category_window.width,
@help_window.height)
@list_window.viewport = @viewport
@list_window.category_window = @category_window
@list_window.deactivate
@list_window.set_handler(:ok, method(:command_bestiary))
@list_window.set_handler(:cancel, method(:command_category))
end
#----------------------------------------------------------------------------
# ○ new method: command_category
#----------------------------------------------------------------------------
def command_category
@category_window.activate
@help_window.set_text(Venka::Bestiary::Category_Select)
end
#----------------------------------------------------------------------------
# ○ new method: command_bestiary
#----------------------------------------------------------------------------
def command_bestiary
@list_window.hide
@category_window.hide
@stats_selection.show.activate
@stats_window.show
@descript_window.show
@frame_window.show if @frame_window
@enemy_bg.visible = true
update_enemy_info
end
#----------------------------------------------------------------------------
# ○ new method: create_enemy_image
#----------------------------------------------------------------------------
def create_enemy_image
width = (Graphics.width * 0.55).round; height = Graphics.height * 0.55
@enemy_bg = Sprite.new(@viewport)
@enemy_bg.visible = false
@enemy_bg.x = Graphics.width - (Graphics.width * 0.55).round
@enemy_bg.y = @help_window.height
@enemy_bg.bitmap = Bitmap.new(width, height)
end
#----------------------------------------------------------------------------
# ○ new method: create_stats_selection
#----------------------------------------------------------------------------
def create_stats_selection
height = Graphics.height - (@help_window.height * 2)
@stats_selection = Window_BestiaryStatSelection.new(0, @help_window.height,
Graphics.width - @enemy_bg.width, height)
@stats_selection.viewport = @viewport
@stats_selection.set_handler(:pageup, method(:prev_enemy))
@stats_selection.set_handler(:pagedown, method(:next_enemy))
@stats_selection.set_handler(:cancel, method(:to_enemy_list))
end
#----------------------------------------------------------------------------
# ○ new method: create_stats_window
#----------------------------------------------------------------------------
def create_stats_window
y = @stats_selection.y + @stats_selection.item_height
height = @stats_selection.height - @stats_selection.item_height
@stats_window = Window_BestiaryStats.new(0, y, @stats_selection.width, height)
@stats_window.viewport = @viewport
@stats_selection.help_window = @stats_window
@list_window.stats_window = @stats_window
end
#----------------------------------------------------------------------------
# ○ new method: prev_enemy
#----------------------------------------------------------------------------
def prev_enemy
if @list_window.index == 0
@list_window.index = @list_window.item_max - 1
else
@list_window.index -= 1
end
update_enemy_info
@stats_selection.activate
end
#----------------------------------------------------------------------------
# ○ new method: next_enemy
#----------------------------------------------------------------------------
def next_enemy
if @list_window.index == @list_window.item_max - 1
@list_window.index = 0
else
@list_window.index += 1
end
update_enemy_info
@stats_selection.activate
end
#----------------------------------------------------------------------------
# ○ new method: to_enemy_list
#----------------------------------------------------------------------------
def to_enemy_list
@help_window.set_text(Venka::Bestiary::Category_Select)
@bottom_window.draw_completion
@category_window.show
@stats_selection.hide.deactivate
@stats_window.hide
@descript_window.hide
@frame_window.hide if @frame_window
@enemy_bg.visible = false
command_list
end
#----------------------------------------------------------------------------
# ○ new method: create_description_window
#----------------------------------------------------------------------------
def create_description_window
y = (@help_window.height + @enemy_bg.height).to_i
@descript_window = Window_BestiaryHelp.new(@stats_window.width, y)
@descript_window.viewport = @viewport
@descript_window.width = Graphics.width - @stats_window.width
@descript_window.height = Graphics.height - y - @bottom_window.height
@descript_window.hide
end
#----------------------------------------------------------------------------
# ○ new method: create_image_frame
#----------------------------------------------------------------------------
def create_image_frame
@frame_window = Window_Base.new(@enemy_bg.x, @enemy_bg.y, @enemy_bg.width,
@enemy_bg.height)
@frame_window.viewport = @viewport
@frame_window.set_windowskin
@frame_window.back_opacity = 0
@frame_window.hide
end
#----------------------------------------------------------------------------
# ○ new method: update_enemy_info
#----------------------------------------------------------------------------
def update_enemy_info
enemy = $data_enemies[@list_window.current_ext]
@help_window.set_text(enemy.name)
# @bottom_window.draw_instructions
@stats_window.enemy_id = @list_window.current_ext
@descript_window.set_description(enemy)
update_enemy_image(enemy)
end
#----------------------------------------------------------------------------
# ○ new method: update_enemy_image
#----------------------------------------------------------------------------
def update_enemy_image(enemy)
@enemy_bg.bitmap.clear
enemy = $data_enemies[@list_window.current_ext]
if floor_image(enemy)
bg_floor = enemy_image(:floor, floor_image(enemy))
draw_image(bg_floor, @enemy_bg.width, @enemy_bg.height)
end
if wall_image(enemy)
bg_wall = enemy_image(:wall, wall_image(enemy))
draw_image(bg_wall, @enemy_bg.width, @enemy_bg.height)
end
enemy = enemy_image(:battler, enemy.battler_name, enemy.battler_hue)
draw_image(enemy, @enemy_bg.width, @enemy_bg.height)
end
#----------------------------------------------------------------------------
# ○ new method: floor_image
#----------------------------------------------------------------------------
def floor_image(enemy)
floor = enemy.bg_floor # Get the enemie's wall image (high priority)
if floor == "" # If it's not set, then get category image
floor = Venka::Bestiary::Category[@category_window.index][:bg_floor]
# If the category image wasn't set, then use the default image
floor = Venka::Bestiary::Default_BGFloor if floor.nil?
end
floor = nil if floor == "" # Set to no image if category was set to ""
return floor
end
#----------------------------------------------------------------------------
# ○ new method: wall_image
#----------------------------------------------------------------------------
def wall_image(enemy)
wall = enemy.bg_wall # Get the enemie's wall image (high priority)
if wall == "" # If it's not set, then get category image
wall = Venka::Bestiary::Category[@category_window.index][:bg_wall]
# If the category image wasn't set, then use the default image
wall = Venka::Bestiary::Default_BGWall if wall.nil?
end
wall = nil if wall == "" # Set to no image if category was set to ""
return wall
end
#----------------------------------------------------------------------------
# ○ new method: enemy_image
#----------------------------------------------------------------------------
def enemy_image(type, file, hue = 0)
begin
case type
when :floor; Cache.battleback1(file)
when :wall; Cache.battleback2(file)
when :battler; Cache.battler(file, hue)
end
rescue; Cache.picture(file)
end
end
#----------------------------------------------------------------------------
# ○ new method: draw_image
#----------------------------------------------------------------------------
def draw_image(bitmap, width, height)
x = (bitmap.width - width) * 0.5
y = (bitmap.height - height) * 0.5
src_rect = Rect.new(x, y, width, height)
@enemy_bg.bitmap.blt(0, 0, bitmap, src_rect)
end
#----------------------------------------------------------------------------
# ● upgraded method: terminate
#----------------------------------------------------------------------------
def terminate
super
fadeout_all(60)
@map_bgm.replay
dispose_enemy_image
end
#----------------------------------------------------------------------------
# ○ new method: dispose_enemy_image
#----------------------------------------------------------------------------
def dispose_enemy_image
return unless @enemy_bg
@enemy_bg.bitmap.dispose if @enemy_bg.bitmap
@enemy_bg.dispose
end
end