赞 | 0 |
VIP | 1 |
好人卡 | 10 |
积分 | 1 |
经验 | 14593 |
最后登录 | 2017-6-2 |
在线时间 | 201 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 201 小时
- 注册时间
- 2013-1-23
- 帖子
- 270
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 love896624434 于 2013-5-29 20:20 编辑
我在整合脚本里找到了怪物类型脚本,可是不知道怎么定义怪物类型,总不能其它类别都是???,只有其他和全部里有吧……求助,有三个脚本配套的,我一起发出来。
以上是曾经的问题,现在我的问题是,我不想它在图鉴里显示怪兽掉落的物品,该怎么办?直接删掉那一项就会报错了。
核心脚本:- module Snstar
- module EnemyList
- # 敌人类型 0 1 2 3 4 5
- ENEMY_TYPE = ["异兽", "魔物", "精怪", "人形", "其他", "首领"]
- ENEMY_TYPE_DEFAULT = 4 # 敌人的默认类型
- ENCOUNTER_PERCENT = 1 # 敌人现身所提升的辨识度
- DEFEAT_PERCENT = 5 # 敌人战败所提升的辨识度
- TEST_PERCENT = 5 # 测试用调整的辨识度
- INCLUDE_ALL_CATEGORY = true # 是否包含“全部”类型
- 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 = 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 # 掉落物显示百分比
- #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 6
- 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) # 绘制敌人辨识度
- partial_refresh
- end
- #--------------------------------------------------------------------------
- # ● 窗口半刷新
- #--------------------------------------------------------------------------
- def partial_refresh
- return unless @enemy # 无敌人时返回
- rect = Rect.new(ENEMY_IMAGE_MAX_WIDTH+8, 0,
- contents.width-(ENEMY_IMAGE_MAX_WIDTH+8), contents.height-line_height)
- 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+8, 0) # 绘制敌人体力
- draw_enemy_mp(ENEMY_IMAGE_MAX_WIDTH+8, line_height) # 绘制敌人魔力
- 2.upto(7){ |n|
- draw_enemy_param(ENEMY_IMAGE_MAX_WIDTH+8, line_height*n, n) # 绘制敌人能力
- }
- draw_enemy_gold(ENEMY_IMAGE_MAX_WIDTH+8, line_height*8) # 绘制敌人掉落金
- draw_enemy_item(ENEMY_IMAGE_MAX_WIDTH+8, line_height*9) # 绘制敌人掉落物
- @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}倍"
- 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 - 96, @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, y, 108, line_height, text)
- change_color(normal_color)
- hp = @enemy.params[0]
- # 判断显示百分比
- 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+72, y, text_width(text), line_height, text)
- end
- #--------------------------------------------------------------------------
- # ● 绘制敌人魔力
- #--------------------------------------------------------------------------
- def draw_enemy_mp(x, y)
- change_color(system_color)
- text = Vocab::mp
- draw_text(x, y, 108, line_height, text)
- change_color(normal_color)
- mp = @enemy.params[1]
- # 判断显示百分比
- 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+72, 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)
- # 绘制能力值名称
- draw_text(x, y, 108, line_height, Vocab::param(param_id))
- 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 = @enemy.params[param_id]
- else
- text = NO_DISPLAY_MASK
- end
- draw_text(x+72, y, text_width(text), line_height, text)
- end
- #--------------------------------------------------------------------------
- # ● 绘制敌人掉落金钱
- #--------------------------------------------------------------------------
- def draw_enemy_gold(x, y)
- change_color(system_color)
- draw_text(x, 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+12, y, 108)
- else
- draw_text(x+72, y, 96, line_height, NO_DISPLAY_MASK)
- end
- end
- #--------------------------------------------------------------------------
- # ● 绘制敌人掉落物
- #--------------------------------------------------------------------------
- def draw_enemy_item(x, y)
- change_color(system_color)
- draw_text(x, y, 96, 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) # 计算绘制高度
- draw_item_name(di, x+24, ly)
- nn_di += 1 # 计数器+1
- end
- end
- return if nn_di > 0 # 计数器大于0时返回
- draw_text(x+80, y, 96, line_height, "无")
- else
- draw_text(x+24, y+line_height, 96, 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_Base
- 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
复制代码 |
|