| 赞 | 0  | 
 
| VIP | 0 | 
 
| 好人卡 | 0 | 
 
| 积分 | 1 | 
 
| 经验 | 0 | 
 
| 最后登录 | 2021-8-30 | 
 
| 在线时间 | 2 小时 | 
 
 
 
 
 
Lv1.梦旅人 
	- 梦石
 - 0 
 
        - 星屑
 - 55 
 
        - 在线时间
 - 2 小时
 
        - 注册时间
 - 2021-1-6
 
        - 帖子
 - 3
 
 
 
 | 
	
2楼
 
 
 楼主 |
发表于 2021-8-30 18:24:55
|
只看该作者
 
 
 
怪物图鉴脚本 
- =begin
 
 - 脚本里设定好敌人的类型
 
 - 在敌人的备注里面填写 [ltype 类型代号]
 
 - 没有填写时默认为 ENEMY_TYPE_DEFAULT 所设定的类型
 
 - 其于相关设定请看脚本内注释的说明
 
  
- 在敌人的备注里面填写 [limage 文件名]
 
 - 则可以指定显示敌人的图像
 
 - 没有填写时则使用数据库里设定的战斗图
 
 - 这项设定主要是针对想显示与战斗图不同或缩小版的图像所用
 
 - 图片文件放在 游戏根目录/Graphics/EnemyImages 里面
 
  
- 在敌人的备注里面填写 [no_list],或是名称留空
 
 - 则不会被列入图鉴当中
 
  
- 敌人的辨识度最高为 100 最低为 0
 
 - 辨识度越高,则资讯窗口中显示越多
 
 - 资讯显示辨识度百分比可以用脚本中 NAME_DISPLAY_PERC 等等这些常量去设定
 
 - 具体说明请看注释
 
  
- 敌人的辨识度提升有三种方法
 
 -   1. 战斗一开始,就会提升 1 点
 
 -      数值可以修改 ENCOUNTER_PERCENT 来变更
 
 -   2. 战斗中击败敌人,就会提升 5 点
 
 -      数值可以修改 DEFEAT_PERCENT 来变更
 
 -   3. 事件指令提升
 
 -      事件调用 gain_enemy_percentage(敌人ID, 百分比)
 
  
- 调用敌人图鉴场景有两种方法
 
 -   1. 事件指令调用
 
 -      call_enemy_list 调用显示
 
 -   2. 插入主菜单介面指令(默认)
 
 -      可以在脚本里设定 ENEMY_LIST_SWITCH_ID 来设定开放的开关ID
 
 -      设定为 0 则没有开关
 
 -      也可以在脚本里设定 ENEMY_LIST_ENABLE_ID 来设定有效/无效的开关ID
 
 -      当开关关闭时,主菜单中会显示,但是无法使用
 
 -      设定为 0 则没有开关
 
 -      或是设定成跟 ENEMY_LIST_SWITCH_ID 一样,则开启时则同时有效化
 
 -      
 
 - 在敌人图鉴中,进入敌人列表后,可以按左右键调整辨识度
 
 - 此功能只有在游戏测试中有效。
 
 - =end
 
  
- module Snstar
 
 -   module EnemyList
 
 -     # 敌人类型      0       1       2       3         4
 
 -     ENEMY_TYPE = ["生物类","机械类","变种类","仿生类","赏金首"]
 
 -     ENEMY_TYPE_DEFAULT = 0       # 敌人的默认类型
 
 -     ENCOUNTER_PERCENT = 25        # 敌人现身所提升的辨识度
 
 -     DEFEAT_PERCENT = 100           # 敌人战败所提升的辨识度
 
 -     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 = 260  # 敌人图像宽度限定170
 
 -     ENEMY_IMAGE_MAX_HEIGHT = 192 # 敌人图像高度限定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   = 10 # 掉落物显示百分比
 
 -     #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] if @info_window
 
 -   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
 
 -     @new_enemy = nil
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 设置当前敌人
 
 -   #--------------------------------------------------------------------------
 
 -   def enemy=(e)
 
 -     @enemy = e
 
 -     if @enemy
 
 -       @new_enemy = Game_Enemy.new(0,@enemy.id)
 
 -     end
 
 -     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) # 绘制敌人体力
 
 -       [2,3,6,7].each_with_index do |v,n|
 
 -         draw_enemy_param(ENEMY_IMAGE_MAX_WIDTH+8, line_height*n+line_height,v) # 绘制敌人能力
 
 -       end
 
 -       draw_enemy_gold(ENEMY_IMAGE_MAX_WIDTH+8, line_height*5) # 绘制敌人掉落金
 
 -       draw_enemy_item(ENEMY_IMAGE_MAX_WIDTH+8, line_height*6) # 绘制敌人掉落物
 
 -       @partial = true
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 绘制敌人特征
 
 -   #--------------------------------------------------------------------------
 
 -   def draw_enemy_features(x, y)
 
 -     fy = y
 
 -     value = RPGBOY.get_enemy_weak(@enemy.id)
 
 -     change_color(system_color)
 
 -     draw_text(x, fy, text_width(FEA_RES_ELE_RATE), line_height, FEA_RES_ELE_RATE)
 
 -     change_color(normal_color)
 
 -     draw_text(x+72, fy, text_width(value), line_height, value)
 
 -     fy+=line_height
 
 -     value = RPGBOY.get_enemy_res(@enemy.id)
 
 -     change_color(system_color)
 
 -     draw_text(x, fy, text_width(FEA_RES_ELE_RATE), line_height, FEA_WEAK_ELE_RATE)
 
 -     change_color(normal_color)
 
 -     draw_text(x+72, fy, text_width(value), line_height, value)
 
 - =begin
 
 -     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
 
 -   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 = @new_enemy.param_base(0,false)
 
 -     # 判断显示百分比
 
 -     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)
 
 -     return 
 
 -     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 - @new_enemy.param_base(5,false), @new_enemy.param_base(4,false), 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
 
 -     return if param_id < 1
 
 -     change_color(system_color)
 
 -     # 绘制能力值名称
 
 -     draw_text(x, y, 108, line_height, Vocab::param(param_id))
 
 -     change_color(normal_color)
 
 -     # 获取能力值百分比
 
 -     param_percent = [0,0,ATK_DISPLAY_PERC,DEF_DISPLAY_PERC,
 
 -                      0,0,AGI_DISPLAY_PERC,LUK_DISPLAY_PERC ]
 
 -      #判断显示百分比
 
 -     if checkPercent?(param_percent[param_id])
 
 -       text = @new_enemy.param_base(param_id,false)
 
 -     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+0, 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
 
 -     create_background
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 结束处理
 
 -   #--------------------------------------------------------------------------
 
 -   def terminate
 
 -     super
 
 -     dispose_background
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 生成背景
 
 -   #--------------------------------------------------------------------------
 
 -   def create_background
 
 -     @background_sprite = Sprite.new
 
 -     @background_sprite.bitmap = SceneManager.background_bitmap
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 释放背景
 
 -   #--------------------------------------------------------------------------
 
 -   def dispose_background
 
 -     @background_sprite.dispose
 
 -   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
 
 
  复制代码 |   
 
 
 
 |