#=============================================================================== # ■ 新获得道具提示 # by :VIPArcher [email: [email protected]] # -- Project1 论坛:[url]https://rpg.blue/[/url] 使用或转载请保留以上信息。 #============================================================================== # ■ 使用说明: # 使新获得的道具在物品栏列表中添加一个 New 的小图标 # 可以使用自定素材或者 Icon 里的图标 #============================================================================== $VIPArcherScript ||= {};$VIPArcherScript[:new_item] = 20181226 #============================================================================== # ★ 设定部分 ★ #============================================================================== module VIPArcher end module VIPArcher::NEW_ITEM # 配置部分 Icon = "NewIcon" # 125 # 注:Icon 填文件名使用对应文件,填数字则使用 IconSet 对应位置的图标 Switch = 0 # 该开关开启时获得新道具不做记录 Icon_X = 0 # New图标相对位置的 X 坐标偏移 Icon_Y = 0 # New图标相对位置的 Y 坐标偏移 # 配置结束 end class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ● 初始化新获得道具列表 #-------------------------------------------------------------------------- alias new_icon_init_all_items init_all_items def init_all_items new_icon_init_all_items @new_icon_list = { RPG::Item => [],RPG::Armor => [],RPG::Weapon => [] } end #-------------------------------------------------------------------------- # ● 设置新获得道具 #-------------------------------------------------------------------------- def set_new_icon(item) return unless item return if item_is_new?(item) @new_icon_list[item.class].push(item.id) end #-------------------------------------------------------------------------- # ● 移除新道具 #-------------------------------------------------------------------------- def remove_new_icon(item) return unless item @new_icon_list[item.class].delete(item.id) end #-------------------------------------------------------------------------- # ● 是否新道具 #-------------------------------------------------------------------------- def item_is_new?(item) return unless item @new_icon_list[item.class].include?(item.id) end #-------------------------------------------------------------------------- # ● 获取道具时设置 Icon 标志 #-------------------------------------------------------------------------- alias new_icon_gain_item gain_item def gain_item(item, amount, include_equip = false) new_icon_gain_item(item, amount, include_equip) return if $game_switches[VIPArcher::NEW_ITEM::Switch] set_new_icon(item) if amount > 0 end end class Window_ItemList < Window_Selectable include VIPArcher::NEW_ITEM #-------------------------------------------------------------------------- # ● 绘制新获得道具 Icon #-------------------------------------------------------------------------- def draw_item_new_flag(rect, item) if (Icon.is_a?(Integer)) draw_icon(Icon, rect.x + Icon_X, rect.y + Icon_Y, enable?(item)) else bitmap = Cache.system(Icon) contents.blt(rect.x + Icon_X, rect.y + Icon_Y, bitmap, bitmap.rect, enable?(item) ? 255 : translucent_alpha) end end #-------------------------------------------------------------------------- # ● 绘制项目 #-------------------------------------------------------------------------- alias new_icon_draw_item draw_item def draw_item(index) new_icon_draw_item(index) item = @data[index] return unless item && $game_party.item_is_new?(item) rect = item_rect(index) rect.width -= 4 draw_item_new_flag(rect, item) end #-------------------------------------------------------------------------- # ● 移除新道具 Icon #-------------------------------------------------------------------------- def remove_new_icon(item) return unless $game_party.item_is_new?(item) $game_party.remove_new_icon(item) redraw_item(@index) end #-------------------------------------------------------------------------- # ● 光标滑过移除 New Icon 标志 #-------------------------------------------------------------------------- def index=(index) remove_new_icon(@data[@index]) unless @index < 0 super end #-------------------------------------------------------------------------- # ● 确定时消除 New Icon 标志 #-------------------------------------------------------------------------- def call_ok_handler super remove_new_icon(@data[@index]) end end class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● 交换物品(修正替换装备也提示 New) #-------------------------------------------------------------------------- alias new_icon_trade_item_with_party trade_item_with_party def trade_item_with_party(new_item, old_item) result = new_icon_trade_item_with_party(new_item, old_item) $game_party.remove_new_icon(old_item) return result end end
# 事件中使用脚本打开怪物信息,第一行是遇到怪物,第二行是打开信息 # $game_system.m_dic_encount_sw[87] = true # $game_system.m_dic_victory_sw[87] = true #在敌人的备注里面填写 [ltype 类型代号],不填则默认ENEMY_TYPE_DEFAULT module Snstar module EnemyList # 敌人类型 0 1 2 3 4 5 6 ENEMY_TYPE = ["野兽", "魔物", "精怪", "人形", "龙形", "亡灵","首领"] ENEMY_TYPE_DEFAULT = 1 # 敌人的默认类型 ENCOUNTER_PERCENT = 1 # 敌人现身所提升的辨识度 DEFEAT_PERCENT = 5 # 敌人战败所提升的辨识度 TEST_PERCENT = 5 # 测试用调整的辨识度 INCLUDE_ALL_CATEGORY = false # 是否包含“全部”类型 ALL_CATEGORY_TEXT = "全部" # “全部”类型的文字 ENEMY_MORE_INFO_BUTTON = #:X # 显示敌人更多资讯的按键 ENEMY_MORE_INFO = true # 是否显示更多讯息(扩充用) DRAW_ENEMY_ICON = false # 需要使用绘制单张图标才能使用 # 敌人图像大小限定 ENEMY_IMAGE_MAX_WIDTH = 170 # 敌人图像宽度限定 ENEMY_IMAGE_MAX_HEIGHT = 192 # 敌人图像高度限定 ENEMY_IMAGE_FOLDER = "Graphics/EnemyImages/" # 敌人指定图像资料夹 ENEMY_HUE_SYNC_DB = true # 敌人指定图像是否使用资料库设定的色相,如果要显示默认战斗图则设置为true # 文字设定 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 = "属性" # 攻击附带属性的文字 ENEMY_EXP = "经验" ENEMY_DIE = "击杀数量" # 辨识度提升数值 PERCENTAGE_ON_ENCOUNTER = 0 # 敌人现身时提升辨识度 PERCENTAGE_ON_DEFEAT = 5 # 敌人落败时提升辨识度 # 辨识度显示参数数值 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 # 掉落物显示百分比 EXP_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
class Window_EnemyType < Window_HorzCommand include Snstar::EnemyList #-------------------------------------------------------------------------- # ● 初始化 #-------------------------------------------------------------------------- def initialize(x, y, min_height=48) super(x, y) @min_height = min_height @max_height = window_height end #-------------------------------------------------------------------------- # ● 定义窗口宽度 #-------------------------------------------------------------------------- def window_width Graphics.width end #-------------------------------------------------------------------------- # ● 定义栏数 #-------------------------------------------------------------------------- def col_max return 7 end #-------------------------------------------------------------------------- # ● 窗口更新 #-------------------------------------------------------------------------- def update super @item_window.category = current_symbol if @item_window end #-------------------------------------------------------------------------- # ● 绘制敌人类型列表 #-------------------------------------------------------------------------- def make_command_list add_command(ALL_CATEGORY_TEXT, :all) if INCLUDE_ALL_CATEGORY ENEMY_TYPE.each{ |type| add_command(type, type.to_sym) } end #-------------------------------------------------------------------------- # ● 设置敌人列表窗口 #-------------------------------------------------------------------------- def item_window=(item_window) @item_window = item_window update end #-------------------------------------------------------------------------- # ● 窗口有效化 #-------------------------------------------------------------------------- def activate super return unless @max_height self.height = @max_height end #-------------------------------------------------------------------------- # ● 窗口失效 #-------------------------------------------------------------------------- def deactivate super return unless @min_height self.height = @min_height @item_window.select_last_index end end class Window_EnemyList < Window_ItemList include Snstar::EnemyList #-------------------------------------------------------------------------- # ● 初始化 #-------------------------------------------------------------------------- def initialize(x, y, width, height) super(x, y, width, height) @last_index = {} end #-------------------------------------------------------------------------- # ● 选择上次索引 #-------------------------------------------------------------------------- def select_last_index select(@last_index[@category]) end def select(index) super(index) @info_window.enemy = @data[@index] end #-------------------------------------------------------------------------- # ● 窗口失效 #-------------------------------------------------------------------------- def deactivate super return unless @last_index @last_index[@category] = @index # 纪录当前敌人类型的索引 end #-------------------------------------------------------------------------- # ● 最大栏数 #-------------------------------------------------------------------------- def col_max return 1 end #-------------------------------------------------------------------------- # ● 生成敌人列表 #-------------------------------------------------------------------------- def make_item_list @data = [] @last_index[@category] = 0 if @last_index[@category].nil? selected_type = ENEMY_TYPE.index(@category.to_s) $data_enemies.each{ |enemy| next if enemy.nil? next if enemy.name == "" # 名字为空的敌人跳过 next if enemy.no_list? # 指定不列入的敌人跳过 if @category == :all or (enemy.list_type == selected_type) @data.push(enemy) end } end #-------------------------------------------------------------------------- # ● 绘制敌人项目 #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] if item rect = item_rect(index) rect.width -= 4 draw_item_name(item, rect.x, rect.y) end end #-------------------------------------------------------------------------- # ● 绘制敌人名称 #-------------------------------------------------------------------------- def draw_item_name(item, x, y, enabled = true, width = 172) return unless item if DRAW_ENEMY_ICON draw_icon(item.icon_index, x, y, enabled) x += 24 end change_color(normal_color, enabled) per = $game_party.enemy_percent(item.id) if per >= NAME_DISPLAY_PERC text = item.name else text = NO_DISPLAY_MASK end draw_text(x, y, width, line_height, text) end #-------------------------------------------------------------------------- # ● 资讯窗口更新 #-------------------------------------------------------------------------- def update_info @info_window.set_item(item) end #-------------------------------------------------------------------------- # ● 设置资讯窗口 #-------------------------------------------------------------------------- def info_window=(info_window) @info_window = info_window #call_update_info end end class Window_EnemyDetail < Window_Base include Snstar::EnemyList attr_reader :enemy #-------------------------------------------------------------------------- # ● 初始化 #-------------------------------------------------------------------------- def initialize super(160, 48, Graphics.width-160, Graphics.height-48) @enemy = nil end #-------------------------------------------------------------------------- # ● 设置当前敌人 #-------------------------------------------------------------------------- def enemy=(e) @enemy = e if enemy @percentage = $game_party.enemy_percent(e.id) # 获取当前敌人辨识度 else @percentage = 0 end refresh end #-------------------------------------------------------------------------- # ● 检查当前辨识度百分比 #-------------------------------------------------------------------------- def checkPercent?(per) return @percentage >= per end #-------------------------------------------------------------------------- # ● 窗口刷新 #-------------------------------------------------------------------------- def refresh contents.clear return unless @enemy # 无敌人时返回 return unless checkPercent?(NAME_DISPLAY_PERC) # 不显示名称时返回 @partial = false draw_enemy_image(0, 0) # 绘制敌人图像 draw_enemy_name(0, ENEMY_IMAGE_MAX_HEIGHT) # 绘制敌人名称 draw_enemy_features(0, ENEMY_IMAGE_MAX_HEIGHT+line_height) draw_enemy_percentage(0, ENEMY_IMAGE_MAX_HEIGHT+line_height*5) # 绘制敌人辨识度 e_na = $1.to_s if enemy.note =~ /<note1:\s*(.*?)>/i e_nb = $1.to_s if enemy.note =~ /<note2:\s*(.*?)>/i e_nc = $1.to_s if enemy.note =~ /<note3:\s*(.*?)>/i draw_text(0, y + line_height * 12, 600, line_height, e_na) draw_text(0, y + line_height * 13, 600, line_height, e_nb) draw_text(0, y + line_height * 14, 600, line_height, e_nc) partial_refresh end #-------------------------------------------------------------------------- # ● 窗口半刷新 #-------------------------------------------------------------------------- def partial_refresh return unless @enemy # 无敌人时返回 rect = Rect.new(ENEMY_IMAGE_MAX_WIDTH+10, 0, contents.width-(ENEMY_IMAGE_MAX_WIDTH+10), contents.height-125) contents.clear_rect(rect) if ENEMY_MORE_INFO && @partial Sound.play_cursor draw_other_info @partial = false else draw_enemy_hp(ENEMY_IMAGE_MAX_WIDTH+10, 0) # 绘制敌人体力 draw_enemy_mp(ENEMY_IMAGE_MAX_WIDTH+10, line_height) # 绘制敌人魔力 2.upto(7){ |n| draw_enemy_param(ENEMY_IMAGE_MAX_WIDTH+10, line_height*n, n) # 绘制敌人能力 } draw_enemy_gold(ENEMY_IMAGE_MAX_WIDTH+10, line_height*8) # 绘制敌人掉落金 draw_enemy_exp(ENEMY_IMAGE_MAX_WIDTH+10, line_height*9) # 绘制敌人掉落金 draw_enemy_item(ENEMY_IMAGE_MAX_WIDTH+10, line_height*10) # 绘制敌人掉落物 draw_enemy_die(ENEMY_IMAGE_MAX_WIDTH+10, line_height*13) # 绘制击杀数 @partial = true end end #-------------------------------------------------------------------------- # ● 绘制敌人特征 #-------------------------------------------------------------------------- def draw_enemy_features(x, y) fy = y for i in 0..4 do feature = @enemy.features[i] next unless feature label, value = get_feature(feature) next if label=="" change_color(system_color) draw_text(x, fy, text_width(label), line_height, label) change_color(normal_color) draw_text(x+72, fy, text_width(value), line_height, value) fy+=line_height end end #-------------------------------------------------------------------------- # ● 获取敌人特征 #-------------------------------------------------------------------------- def get_feature(feature) code = feature.code id = feature.data_id value = feature.value return "", 0 unless [11, 31].include?(code) if code == 11 if value < 1.0 label = FEA_RES_ELE_RATE elsif value > 1.0 label = FEA_WEAK_ELE_RATE else return "", 0 end element = $data_system.elements[id] # return_value = element + " #{value.truncate}倍" return_value = element# + " #{value.truncate}倍" elsif code == 31 label = FEA_ATK_ELEMENT return_value = $data_system.elements[id] end return label, return_value end #-------------------------------------------------------------------------- # ● 绘制敌人图像 #-------------------------------------------------------------------------- def draw_enemy_image(x, y) image_name = @enemy.list_image # 获取指定图像 if image_name.nil? # 指定图像为空时 image = Cache.battler(@enemy.battler_name, @enemy.battler_hue) # 获取战斗图 else hue = ENEMY_HUE_SYNC_DB ? @enemy.battler_hue : 0 image = Cache.load_bitmap(ENEMY_IMAGE_FOLDER, image_name, hue) # 获取战斗图 end ix = (image.width/2-ENEMY_IMAGE_MAX_WIDTH/2).abs # 获取中心点 # 敌人图像宽度在显示范围外 if image.width > ENEMY_IMAGE_MAX_WIDTH # 居中对齐 rx = ix cx = x # 敌人图像宽度在显示范围外 else # 居中对齐 rx = 0 cx = ix end # 敌人图像高度在显示范围外 if image.height > ENEMY_IMAGE_MAX_HEIGHT cy = y # 敌人图像高度在显示范围内 else cy = ENEMY_IMAGE_MAX_HEIGHT - image.height - 8 # 向下对齐 end rect = Rect.new(rx, 0, ENEMY_IMAGE_MAX_WIDTH, ENEMY_IMAGE_MAX_HEIGHT) contents.blt(cx, cy, image, rect, 255) end #-------------------------------------------------------------------------- # ● 绘制敌人辨识度 #-------------------------------------------------------------------------- def draw_enemy_percentage(x, y) width = contents.width change_color(system_color) text = ENEMY_PERCENT_VOCAB draw_text(x, y, text_width(text), line_height, text) # 绘制辨识度进度槽 draw_gauge(x+96, y, width - 350, @percentage.to_f/100, ENEMY_PERCENT_BASE_COLOR, ENEMY_PERCENT_FILL_COLOR) # 绘制百分比 change_color(normal_color) text = "#{@percentage}%" draw_text(x+96, y, text_width(text), line_height, text) end #-------------------------------------------------------------------------- # ● 绘制敌人名称 #-------------------------------------------------------------------------- def draw_enemy_name(x, y) change_color(system_color) text = "名称" draw_text(x, y, text_width(text), line_height, text) # 绘制名称 change_color(normal_color) text = @enemy.name draw_text(x+72, y, text_width(text), line_height, text) end #-------------------------------------------------------------------------- # ● 绘制敌人体力 #-------------------------------------------------------------------------- def draw_enemy_hp(x, y) change_color(system_color) text = Vocab::hp draw_text(x + 45, y, 108, line_height, text) change_color(normal_color) hp = a.to_i # 判断显示百分比 if checkPercent?(HP_DISPLAY_PERC) text = hp elsif checkPercent?(HP_EST_DISPLAY_PERC) # 计算体力约值 ahp = [(hp/10) * 10 - @enemy.params[3], 10].max text = sprintf(EST_DISPLAY_MASK, ahp) else text = NO_DISPLAY_MASK end draw_text(x+152, y, text_width(text), line_height, text) end #-------------------------------------------------------------------------- # ● 绘制敌人魔力 #-------------------------------------------------------------------------- def draw_enemy_mp(x, y) change_color(system_color) text = Vocab::mp draw_text(x + 45, y, 108, line_height, text) change_color(normal_color) mp = a.to_i # 判断显示百分比 if checkPercent?(MP_DISPLAY_PERC) text = mp elsif checkPercent?(MP_EST_DISPLAY_PERC) # 计算魔力约值 amp = [(mp/10) * 10 - @enemy.params[5], @enemy.params[4], 5].max text = sprintf(EST_DISPLAY_MASK, amp) else text = NO_DISPLAY_MASK end draw_text(x+152, y, text_width(text), line_height, text) end #-------------------------------------------------------------------------- # ● 绘制敌人能力值 #-------------------------------------------------------------------------- def draw_enemy_param(x, y, param_id) # 能力值ID为1或2时,调用绘制体力/魔力方法 draw_enemy_hp(x, y) if param_id==0 draw_enemy_mp(x, y) if param_id==1 return if param_id < 2 change_color(system_color) # 绘制能力值名称 text = Vocab::param(param_id) draw_text(x + 45, y, 108, line_height, text) change_color(normal_color) # 获取能力值百分比 param_percent = [ATK_DISPLAY_PERC, DEF_DISPLAY_PERC, MAT_DISPLAY_PERC, MDF_DISPLAY_PERC, AGI_DISPLAY_PERC, LUK_DISPLAY_PERC ] # 判断显示百分比 if checkPercent?(param_percent[param_id-2]) text = a.to_i else text = NO_DISPLAY_MASK end draw_text(x+152, y, text_width(text), line_height, text) end #-------------------------------------------------------------------------- # ● 绘制敌人掉落金钱 #-------------------------------------------------------------------------- def draw_enemy_gold(x, y) change_color(system_color) draw_text(x + 45, y, 96, line_height, DROP_GOLD_VOCAB) change_color(normal_color) # 判断显示百分比 if checkPercent?(GOLD_DISPLAY_PERC) draw_currency_value(@enemy.gold, Vocab.currency_unit, x+92, y, 108) else draw_text(x+152, y, 96, line_height, NO_DISPLAY_MASK) end end #-------------------------------------------------------------------------- # ● 绘制敌人经验 #-------------------------------------------------------------------------- def draw_enemy_exp(x, y) change_color(system_color) draw_text(x + 45, y, 96, line_height, ENEMY_EXP) change_color(normal_color) # 判断显示百分比 if checkPercent?(EXP_DISPLAY_PERC) a=@enemy.exp # draw_currency_value(@enemy.exp, Vocab.currency_unit, x+92, y, 108) draw_currency_value(a,"", x + 92, y, 80) else draw_text(x+152, y, 96, line_height, NO_DISPLAY_MASK) end end #击杀数 def draw_enemy_die(x, y) change_color(system_color) draw_text(x + 45, y, 96, line_height, ENEMY_DIE) change_color(normal_color) case enemy.id when 1 text = $game_variables[710].to_i when 2 text = $game_variables[711].to_i when 3 text = $game_variables[712].to_i when 4 text = $game_variables[713].to_i when 5 text = $game_variables[714].to_i end draw_text(x+152, y, 96, line_height, text) end #-------------------------------------------------------------------------- # ● 绘制敌人掉落物 #-------------------------------------------------------------------------- def draw_enemy_item(x, y) change_color(system_color) draw_text(x + 45, y, 200, line_height, DROP_ITEM_VOCAB) change_color(normal_color) # 判断显示百分比 if checkPercent?(ITEM_DISPLAY_PERC) nn_di = 0 for i in 0..2 do di = item_object(@enemy.drop_items[i]) # 获取掉落物物件 if di ly = y +line_height*(nn_di+1)-line_height # 计算绘制高度 draw_item_name(di, x+116, ly) nn_di += 1 # 计数器+1 end end return if nn_di > 0 # 计数器大于0时返回 draw_text(x+152, y, 200, line_height, "无") else draw_text(x+152, y, 200, line_height, NO_DISPLAY_MASK) end end #-------------------------------------------------------------------------- # ● 计算敌人掉落物 #-------------------------------------------------------------------------- def item_object(drop_item) kind = drop_item.kind data_id = drop_item.data_id return $data_items [data_id] if kind == 1 return $data_weapons[data_id] if kind == 2 return $data_armors [data_id] if kind == 3 return nil end #-------------------------------------------------------------------------- # ● 绘制其他资讯 #-------------------------------------------------------------------------- def draw_other_info end #-------------------------------------------------------------------------- # ● 获得文字宽度 #-------------------------------------------------------------------------- def text_width(text) return text_size(text).width + 5 end end
class Scene_List < Scene_MenuBase include Snstar::EnemyList #-------------------------------------------------------------------------- # ● 场景开始 #-------------------------------------------------------------------------- def start super create_category_window create_list_window create_detail_window end #-------------------------------------------------------------------------- # ● 创建敌人类型窗口 #-------------------------------------------------------------------------- def create_category_window @category_window = Window_EnemyType.new(0, 0) @category_window.set_handler(:ok, method(:on_category_ok)) @category_window.set_handler(:cancel, method(:return_scene)) @category_window.viewport = @viewport end #-------------------------------------------------------------------------- # ● 创建敌人列表窗口 #-------------------------------------------------------------------------- def create_list_window @list_window = Window_EnemyList.new(0, 48, 160, Graphics.height-48) @list_window.set_handler(:cancel, method(:on_list_cancel)) @list_window.viewport = @viewport @category_window.item_window = @list_window end #-------------------------------------------------------------------------- # ● 创建敌人讯息窗口 #-------------------------------------------------------------------------- def create_detail_window @detail_window = Window_EnemyDetail.new @list_window.info_window = @detail_window end #-------------------------------------------------------------------------- # ● 选择类型完成 #-------------------------------------------------------------------------- def on_category_ok @list_window.activate @list_window.select_last end #-------------------------------------------------------------------------- # ● 离开敌人列表 #-------------------------------------------------------------------------- def on_list_cancel @list_window.unselect @category_window.activate end #-------------------------------------------------------------------------- # ● 场景更新 #-------------------------------------------------------------------------- def update super on_list_partial_refersh if Input.trigger?(ENEMY_MORE_INFO_BUTTON) enemy_percent_change(:left) if Input.trigger?(:LEFT) enemy_percent_change(:right) if Input.trigger?(:RIGHT) end #-------------------------------------------------------------------------- # ● 敌人讯息半刷新 #-------------------------------------------------------------------------- def on_list_partial_refersh @detail_window.partial_refresh end #-------------------------------------------------------------------------- # ● 更改敌人辨识度百分比(仅游戏测试时可用) #-------------------------------------------------------------------------- def enemy_percent_change(sym) return unless $TEST return unless @list_window.active enemy = @detail_window.enemy return unless enemy $game_party.see_enemy(enemy.id, TEST_PERCENT) if sym == :right $game_party.see_enemy(enemy.id, -TEST_PERCENT) if sym == :left @list_window.refresh @detail_window.enemy = enemy end end class Window_MenuCommand < Window_Command #纵向排列菜单 include Snstar::EnemyList #-------------------------------------------------------------------------- # ● 加入敌人图鉴命令 #-------------------------------------------------------------------------- alias enemy_list_add_original_commands add_original_commands def add_original_commands enemy_list_add_original_commands return unless ENEMY_LIST_SWITCH_ID==0 || $game_switches[ENEMY_LIST_SWITCH_ID] enabled = ENEMY_LIST_ENABLE_ID == 0 || $game_switches[ENEMY_LIST_ENABLE_ID] add_command(ENEMY_LIST_COMMAND_TEXT, :enemy_list, enabled) end end class Scene_Menu < Scene_MenuBase #-------------------------------------------------------------------------- # ● 创建命令窗口 #-------------------------------------------------------------------------- alias enemy_list_create_command_window create_command_window def create_command_window enemy_list_create_command_window @command_window.set_handler(:enemy_list, method(:enemy_list_display)) end #-------------------------------------------------------------------------- # ● 呼叫敌人图鉴场景 #-------------------------------------------------------------------------- def enemy_list_display SceneManager.call(Scene_List) end end
1.43 MB, 下载次数: 93
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |