module Snstar
module EnemyList
# 敌人类型 0 1 2 3 4
ENEMY_TYPE = ["动物", "怪物", "人形", "其他", "BOSS"]
ENEMY_TYPE_DEFAULT = 0 # 敌人的默认类型
ENCOUNTER_PERCENT = 5 # 敌人现身所提升的辨识度
DEFEAT_PERCENT = 5 # 敌人战败所提升的辨识度
TEST_PERCENT = 5 # 测试用调整的辨识度
INCLUDE_ALL_CATEGORY = false # 是否包含“全部”类型
ALL_CATEGORY_TEXT = "全部" # “全部”类型的文字
ENEMY_MORE_INFO_BUTTON = :X # 显示敌人更多资讯的按键
ENEMY_MORE_INFO = false # 是否显示更多讯息(扩充用)
DRAW_ENEMY_ICON = false # 需要使用绘制单张图标才能使用
# 敌人图像大小限定
ENEMY_IMAGE_MAX_WIDTH = 170 # 敌人图像宽度限定
ENEMY_IMAGE_MAX_HEIGHT = 192 # 敌人图像高度限定
ENEMY_IMAGE_FOLDER = "Graphics/EnemyImages/" # 敌人指定图像资料夹
ENEMY_HUE_SYNC_DB = false # 敌人指定图像是否使用资料库设定的色相
# 文字设定
ENEMY_LIST_COMMAND_TEXT = "图鉴" # 主选单命令用字
ENEMY_LIST_SWITCH_ID = 0 # 主选单命令显示的控制开关
ENEMY_LIST_ENABLE_ID = 0 # 主选单命令有效的控制开关
ENEMY_PERCENT_VOCAB = "辨识度" # 辨识度用字
ENEMY_PERCENT_BASE_COLOR = Color.new(0, 255, 0)#Color.new(0, 0, 0)
ENEMY_PERCENT_FILL_COLOR = Color.new(255, 255, 0)
NO_DISPLAY_MASK = "??" # 无法显示时的替代文字
EST_DISPLAY_MASK = "大约是%s" # 显示估算数值时的文字
DROP_GOLD_VOCAB = "携带金钱"
DROP_ITEM_VOCAB = "掉落物"
FEA_WEAK_ELE_RATE = "弱点" # 属性有效度 > 100% 的文字
FEA_RES_ELE_RATE = "抵抗" # 属性有效度 < 100% 的文字
FEA_DEBUFF_RATE = "弱化属性" # 弱化属性的文字
FEA_ATK_ELEMENT = "属性" # 攻击附带属性的文字
# 辨识度提升数值
PERCENTAGE_ON_ENCOUNTER = 10 # 敌人现身时提升辨识度
PERCENTAGE_ON_DEFEAT = 10 # 敌人落败时提升辨识度
# 辨识度显示参数数值
NAME_DISPLAY_PERC = 1 # 名称显示百分比
HP_EST_DISPLAY_PERC = 5 # HP估算显示百分比
HP_DISPLAY_PERC = 10 # HP显示百分比
MP_EST_DISPLAY_PERC = 10 # MP估算显示百分比
MP_DISPLAY_PERC = 15 # MP显示百分比
ATK_DISPLAY_PERC = 50 # 攻击力显示百分比
DEF_DISPLAY_PERC = 50 # 防御力显示百分比
MAT_DISPLAY_PERC = 75 # 魔法攻击显示百分比
MDF_DISPLAY_PERC = 75 # 魔法防御显示百分比
AGI_DISPLAY_PERC = 75 # 敏捷显示百分比
LUK_DISPLAY_PERC = 75 # 幸运显示百分比
GOLD_DISPLAY_PERC = 100 # 掉落金钱显示百分比
ITEM_DISPLAY_PERC = 100 # 掉落物显示百分比
#TYPE_BOSS
end
end
class RPG::Enemy < RPG::BaseItem
include Snstar::EnemyList
def list_type
self.note.split(/[\r\n]+/).each{ |line|
if line =~ /\[(?:ltype) (\d+)\]/
return $1 ? $1.to_i : ENEMY_TYPE_DEFAULT
end}
return ENEMY_TYPE_DEFAULT
end
def list_image
self.note.split(/[\r\n]+/).each{ |line|
if line =~ /\[(?:limage) (\S+)\]/
return $1
end}
return nil # battler_name
end
def no_list?
self.note.split(/[\r\n]+/).each{ |line|
return true if line =~ /\[no_list\]/
}
return false
end
end
class Game_Party < Game_Unit
include Snstar::EnemyList
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
alias enemy_list_initialize initialize
def initialize
enemy_list_initialize
@enemy_know_percentage=[]
$data_enemies.each{ |e|
next unless e
set_enemy_percentage(e.id, 0)
}
end
#--------------------------------------------------------------------------
# ● 设置敌人百分比
#--------------------------------------------------------------------------
def set_enemy_percentage(e_id, percentage=100)
temp_p = [[0, percentage].max ,100].min
@enemy_know_percentage[e_id] = temp_p
end
#--------------------------------------------------------------------------
# ● 获取敌人百分比
#--------------------------------------------------------------------------
def enemy_percent(e_id)
return 0 unless seen_enemy?(e_id)
return @enemy_know_percentage[e_id]
end
#--------------------------------------------------------------------------
# ● 提升敌人百分比
#--------------------------------------------------------------------------
def see_enemy(e_id, percentage = 1)
temp_p = @enemy_know_percentage[e_id] + percentage
set_enemy_percentage(e_id, temp_p)
end
def know_enemy(e_id)
set_enemy_percentage(e_id, 100)
end
#--------------------------------------------------------------------------
# ● 判断是否见过敌人
#--------------------------------------------------------------------------
def seen_enemy?(e_id)
return @enemy_know_percentage[e_id] > 0
end
#--------------------------------------------------------------------------
# ● 判断是否熟知敌人
#--------------------------------------------------------------------------
def known_enemy?(e_id, percentage=100)
return false unless seen_enemy?(e_id)
return enemy_percent(e_id) == percentage
end
#--------------------------------------------------------------------------
# ● 战斗开始提升辨识度
#--------------------------------------------------------------------------
alias enemy_list_on_battle_start on_battle_start
def on_battle_start
enemy_list_on_battle_start
$game_troop.members.each{ |m|
e_id = m.enemy.id
see_enemy(e_id, ENCOUNTER_PERCENT)
}
end
end
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● 敌人战败提升辨识度
#--------------------------------------------------------------------------
alias enemy_list_perform_collapse_effect perform_collapse_effect
def perform_collapse_effect
enemy_list_perform_collapse_effect
$game_party.see_enemy(@enemy_id, Snstar::EnemyList::DEFEAT_PERCENT)
end
end
class Game_Interpreter
#--------------------------------------------------------------------------
# ● 呼叫敌人图鉴场景
#--------------------------------------------------------------------------
def call_enemy_list
SceneManager.call(Scene_List)
end
#--------------------------------------------------------------------------
# ● 提升敌人辨识度
#--------------------------------------------------------------------------
def gain_enemy_percentage(e_id, per)
$game_party.see_enemy(e_id, per)
end
end