设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 4616|回复: 12
打印 上一主题 下一主题

[已经解决] 关于 怪物图鉴

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
19 小时
注册时间
2014-3-1
帖子
23
跳转到指定楼层
1
发表于 2014-3-8 22:25:31 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
我找了半天都没找到简介在什么地方

()DD3PXPR]BN3(940AQ9]6V.jpg (99.09 KB, 下载次数: 31)

()DD3PXPR]BN3(940AQ9]6V.jpg

Lv1.梦旅人

梦石
0
星屑
50
在线时间
19 小时
注册时间
2014-3-1
帖子
23
2
 楼主| 发表于 2014-3-8 22:27:35 | 只看该作者

  1. module Snstar
  2.   module EnemyList
  3.     # 敌人类型      0       1       2       3       4
  4.     ENEMY_TYPE = ["异兽", "魔物", "人类", "其他", "首领"]
  5.     ENEMY_TYPE_DEFAULT = 3       # 敌人的默认类型
  6.     ENCOUNTER_PERCENT = 2        # 敌人现身所提升的辨识度
  7.     DEFEAT_PERCENT = 10          # 敌人战败所提升的辨识度
  8.     TEST_PERCENT = 5             # 测试用调整的辨识度
  9.     INCLUDE_ALL_CATEGORY = true  # 是否包含“全部”类型
  10.     ALL_CATEGORY_TEXT = "所有敌人"# “全部”类型的文字
  11.     ENEMY_MORE_INFO_BUTTON = :X  # 显示敌人更多资讯的按键
  12.     ENEMY_MORE_INFO = true#false      # 是否显示更多讯息(扩充用)
  13.    
  14.     DRAW_ENEMY_ICON = false # 需要使用绘制单张图标才能使用
  15.    
  16.     # 敌人图像大小限定
  17.     ENEMY_IMAGE_MAX_WIDTH = 333  # 敌人图像宽度限定
  18.     ENEMY_IMAGE_MAX_HEIGHT = 277 # 敌人图像高度限定
  19.     ENEMY_IMAGE_FOLDER = "Graphics/EnemyImages/" # 敌人指定图像资料夹
  20.     ENEMY_HUE_SYNC_DB = false # 敌人指定图像是否使用资料库设定的色相
  21.    
  22.     # 文字设定
  23.     ENEMY_LIST_COMMAND_TEXT = "敌人图鉴" # 主选单命令用字
  24.     ENEMY_LIST_SWITCH_ID    = 0        # 主选单命令显示的控制开关
  25.     ENEMY_LIST_ENABLE_ID    = 0        # 主选单命令有效的控制开关
  26.    
  27.     ENEMY_PERCENT_VOCAB = "辨识度"   # 辨识度用字
  28.     ENEMY_PERCENT_BASE_COLOR = Color.new(0, 255, 0)#Color.new(0, 0, 0)
  29.     ENEMY_PERCENT_FILL_COLOR = Color.new(255, 255, 0)
  30.     NO_DISPLAY_MASK = "???"       # 无法显示时的替代文字
  31.     EST_DISPLAY_MASK = "约是 %s"    # 显示估算数值时的文字
  32. #~     DROP_GOLD_VOCAB  = "掉落金钱"
  33.     DROP_ITEM_VOCAB  = "掉落物品"
  34.     FEA_WEAK_ELE_RATE = "弱点属性"    # 属性有效度 > 100% 的文字
  35.     FEA_RES_ELE_RATE  = "抵抗属性"    # 属性有效度 < 100% 的文字
  36.     FEA_DEBUFF_RATE   = "弱化属性"    # 弱化属性的文字
  37.     FEA_ATK_ELEMENT   = "攻击属性"    # 攻击附带属性的文字
  38.    
  39.     # 辨识度提升数值
  40.     PERCENTAGE_ON_ENCOUNTER = 1 # 敌人现身时提升辨识度
  41.     PERCENTAGE_ON_DEFEAT    = 3 # 敌人落败时提升辨识度
  42.    
  43.     # 辨识度显示参数数值
  44.     NO_DISPLAY_PERC     = 0   # 资讯窗口判断
  45.     NAME_DISPLAY_PERC   = 1   # 名称显示百分比
  46.     HP_EST_DISPLAY_PERC = 5   # HP估算显示百分比
  47.     HP_DISPLAY_PERC     = 10  # HP显示百分比
  48.     MP_EST_DISPLAY_PERC = 10  # MP估算显示百分比
  49.     MP_DISPLAY_PERC     = 15  # MP显示百分比
  50.     ATK_DISPLAY_PERC    = 20  # 攻击力显示百分比
  51.     DEF_DISPLAY_PERC    = 30  # 防御力显示百分比
  52.     ELEMENT_DISPLAY_PERC= 40  # 详细属性显示百分比
  53.     MAT_DISPLAY_PERC    = 50  # 魔法攻击显示百分比
  54.     MDF_DISPLAY_PERC    = 60  # 魔法防御显示百分比
  55.     AGI_DISPLAY_PERC    = 70  # 敏捷显示百分比
  56.     LUK_DISPLAY_PERC    = 80  # 幸运显示百分比
  57. #~     GOLD_DISPLAY_PERC   = 100 # 掉落金钱显示百分比
  58.     ITEM_DISPLAY_PERC   = 100 # 掉落物显示百分比
  59.     #TYPE_BOSS
  60.   end
  61. end
  62. class RPG::Enemy < RPG::BaseItem
  63.   include Snstar::EnemyList
  64.   def list_type
  65.     self.note.split(/[\r\n]+/).each{ |line|
  66.       if line =~ /\[(?:ltype) (\d+)\]/
  67.         return $1 ? $1.to_i : ENEMY_TYPE_DEFAULT
  68.       end}
  69.     return ENEMY_TYPE_DEFAULT
  70.   end
  71.   def list_image
  72.     self.note.split(/[\r\n]+/).each{ |line|
  73.       if line =~ /\[(?:limage) (\S+)\]/
  74.         return $1
  75.       end}
  76.     return nil # battler_name
  77.   end
  78.   def no_list?
  79.     self.note.split(/[\r\n]+/).each{ |line|
  80.       return true if line =~ /\[no_list\]/
  81.       }
  82.     return false
  83.   end
  84. end
  85. class Game_Party < Game_Unit
  86.   include Snstar::EnemyList
  87.   #--------------------------------------------------------------------------
  88.   # ● 初始化
  89.   #--------------------------------------------------------------------------
  90.   alias enemy_list_initialize initialize
  91.   def initialize
  92.     enemy_list_initialize
  93.     @enemy_know_percentage=[]
  94.     $data_enemies.each{ |e|
  95.       next unless e
  96.       set_enemy_percentage(e.id, 0)
  97.     }
  98.   end
  99.   #--------------------------------------------------------------------------
  100.   # ● 设置敌人百分比
  101.   #--------------------------------------------------------------------------
  102.   def set_enemy_percentage(e_id, percentage=100)
  103.     temp_p = [[0, percentage].max ,100].min
  104.     @enemy_know_percentage[e_id] = temp_p
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 获取敌人百分比
  108.   #--------------------------------------------------------------------------
  109.   def enemy_percent(e_id)
  110.     return 0 unless seen_enemy?(e_id)
  111.     return @enemy_know_percentage[e_id]
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ● 提升敌人百分比
  115.   #--------------------------------------------------------------------------
  116.   def see_enemy(e_id, percentage = 1)
  117.     temp_p = @enemy_know_percentage[e_id] + percentage
  118.     set_enemy_percentage(e_id, temp_p)
  119.   end
  120.   def know_enemy(e_id)
  121.     set_enemy_percentage(e_id, 100)
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 判断是否见过敌人
  125.   #--------------------------------------------------------------------------
  126.   def seen_enemy?(e_id)
  127.     return @enemy_know_percentage[e_id] > 0
  128.   end
  129.   #--------------------------------------------------------------------------
  130.   # ● 判断是否熟知敌人
  131.   #--------------------------------------------------------------------------
  132.   def known_enemy?(e_id, percentage=100)
  133.     return false unless seen_enemy?(e_id)
  134.     return enemy_percent(e_id) == percentage
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● 战斗开始提升辨识度
  138.   #--------------------------------------------------------------------------
  139.   alias enemy_list_on_battle_start on_battle_start
  140.   def on_battle_start
  141.     enemy_list_on_battle_start
  142.     $game_troop.members.each{ |m|
  143.       e_id = m.enemy.id
  144.       see_enemy(e_id, ENCOUNTER_PERCENT)
  145.     }
  146.   end
  147. end
  148. class Game_Enemy < Game_Battler
  149.   #--------------------------------------------------------------------------
  150.   # ● 敌人战败提升辨识度
  151.   #--------------------------------------------------------------------------
  152.   alias enemy_list_perform_collapse_effect perform_collapse_effect
  153.   def perform_collapse_effect
  154.     enemy_list_perform_collapse_effect
  155.     $game_party.see_enemy(@enemy_id, Snstar::EnemyList::DEFEAT_PERCENT)
  156.   end
  157. end
  158. class Game_Interpreter
  159.   #--------------------------------------------------------------------------
  160.   # ● 呼叫敌人图鉴场景
  161.   #--------------------------------------------------------------------------
  162.   def call_enemy_list
  163.     SceneManager.call(Scene_List)
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 提升敌人辨识度
  167.   #--------------------------------------------------------------------------
  168.   def gain_enemy_percentage(e_id, per)
  169.     $game_party.see_enemy(e_id, per)
  170.   end
  171. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
19 小时
注册时间
2014-3-1
帖子
23
3
 楼主| 发表于 2014-3-8 22:28:38 | 只看该作者

  1. class Window_EnemyType < Window_HorzCommand
  2.   include Snstar::EnemyList
  3.   #--------------------------------------------------------------------------
  4.   # ● 初始化
  5.   #--------------------------------------------------------------------------
  6.   def initialize(x, y, min_height=48)
  7.     super(x, y)
  8.     @min_height = min_height
  9.     @max_height = window_height
  10.   end
  11.   #--------------------------------------------------------------------------
  12.   # ● 定义窗口宽度
  13.   #--------------------------------------------------------------------------
  14.   def window_width
  15.     Graphics.width
  16.   end
  17.   #--------------------------------------------------------------------------
  18.   # ● 定义栏数
  19.   #--------------------------------------------------------------------------
  20.   def col_max
  21.     return 6
  22.   end
  23.   #--------------------------------------------------------------------------
  24.   # ● 窗口更新
  25.   #--------------------------------------------------------------------------
  26.   def update
  27.     super
  28.     @item_window.category = current_symbol if @item_window
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   # ● 绘制敌人类型列表
  32.   #--------------------------------------------------------------------------
  33.   def make_command_list
  34.     add_command(ALL_CATEGORY_TEXT, :all) if INCLUDE_ALL_CATEGORY
  35.     ENEMY_TYPE.each{ |type|
  36.       add_command(type, type.to_sym)
  37.     }
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # ● 设置敌人列表窗口
  41.   #--------------------------------------------------------------------------
  42.   def item_window=(item_window)
  43.     @item_window = item_window
  44.     update
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # ● 窗口有效化
  48.   #--------------------------------------------------------------------------
  49.   def activate
  50.     super
  51.     return unless @max_height
  52.     self.height = @max_height
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ● 窗口失效
  56.   #--------------------------------------------------------------------------
  57.   def deactivate
  58.     super
  59.     return unless @min_height
  60.     self.height = @min_height
  61.     @item_window.select_last_index
  62.   end
  63. end
  64. class Window_EnemyList < Window_ItemList
  65.   include Snstar::EnemyList
  66.   #--------------------------------------------------------------------------
  67.   # ● 初始化
  68.   #--------------------------------------------------------------------------
  69.   def initialize(x, y, width, height)
  70.     super(x, y, width, height)
  71.     @last_index = {}
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ● 选择上次索引
  75.   #--------------------------------------------------------------------------
  76.   def select_last_index
  77.     select(@last_index[@category])
  78.   end
  79.   def select(index)
  80.     super(index)
  81.     @info_window.enemy = @data[@index]
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 窗口失效
  85.   #--------------------------------------------------------------------------
  86.   def deactivate
  87.     super
  88.     return unless @last_index
  89.     @last_index[@category] = @index # 纪录当前敌人类型的索引
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # ● 最大栏数
  93.   #--------------------------------------------------------------------------
  94.   def col_max
  95.     return 1
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● 生成敌人列表
  99.   #--------------------------------------------------------------------------
  100.   def make_item_list
  101.     @data = []
  102.     @last_index[@category] = 0 if @last_index[@category].nil?
  103.     selected_type = ENEMY_TYPE.index(@category.to_s)
  104.     $data_enemies.each{ |enemy|
  105.       next if enemy.nil?
  106.       next if enemy.name == "" # 名字为空的敌人跳过
  107.       next if enemy.no_list? # 指定不列入的敌人跳过
  108.       if @category == :all or (enemy.list_type == selected_type)
  109.         @data.push(enemy)
  110.       end
  111.     }
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ● 绘制敌人项目
  115.   #--------------------------------------------------------------------------
  116.   def draw_item(index)
  117.     item = @data[index]
  118.     if item
  119.       rect = item_rect(index)
  120.       rect.width -= 4
  121.       draw_item_name(item, rect.x, rect.y)
  122.     end
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ● 绘制敌人名称
  126.   #--------------------------------------------------------------------------
  127.   def draw_item_name(item, x, y, enabled = true, width = 172)
  128.     return unless item
  129.     if DRAW_ENEMY_ICON
  130.       draw_icon(item.icon_index, x, y, enabled)
  131.       x += 24
  132.     end
  133.     change_color(normal_color, enabled)
  134.     per = $game_party.enemy_percent(item.id)
  135.     if  per >= NAME_DISPLAY_PERC
  136.       text = item.name
  137.     else
  138.       text = NO_DISPLAY_MASK
  139.     end
  140.     draw_text(x, y, width, line_height, text)
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ● 资讯窗口更新
  144.   #--------------------------------------------------------------------------
  145.   def update_info
  146.    
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # ● 设置资讯窗口
  150.   #--------------------------------------------------------------------------
  151.   def info_window=(info_window)
  152.     @info_window = info_window
  153.   #    call_update_info
  154. end
  155.   
  156. end
  157. class Window_EnemyDetail < Window_Base
  158.   include Snstar::EnemyList
  159.   attr_reader :enemy
  160.   #--------------------------------------------------------------------------
  161.   # ● 初始化
  162.   #--------------------------------------------------------------------------
  163.   def initialize
  164.     super(160, 48, Graphics.width-160, Graphics.height-48)
  165.     @enemy = nil
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # ● 设置当前敌人
  169.   #--------------------------------------------------------------------------
  170.   def enemy=(e)
  171.     @enemy = e
  172.     if enemy
  173.       @percentage = $game_party.enemy_percent(e.id) # 获取当前敌人辨识度
  174.     else
  175.       @percentage = 0
  176.     end
  177.     refresh
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● 检查当前辨识度百分比
  181.   #--------------------------------------------------------------------------
  182.   def checkPercent?(per)
  183.     return @percentage >= per
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ● 窗口刷新
  187.   #--------------------------------------------------------------------------
  188.   def refresh
  189.     contents.clear
  190.     return unless @enemy # 无敌人时返回
  191.     return unless checkPercent?(NAME_DISPLAY_PERC) # 不显示名称时返回
  192.     @partial = false
  193.     draw_enemy_image(0, 0) # 绘制敌人图像
  194.     draw_enemy_name(0, ENEMY_IMAGE_MAX_HEIGHT) # 绘制敌人名称
  195.    #draw_enemy_features(0, ENEMY_IMAGE_MAX_HEIGHT+line_height)
  196.     draw_enemy_percentage(0, ENEMY_IMAGE_MAX_HEIGHT+line_height*5) # 绘制敌人辨识度
  197.     partial_refresh
  198.       x = 0
  199.       y = 192
  200.       e_na = $1.to_s if enemy.note =~ /<note1:\s*(.*?)>/i
  201.       e_nb = $1.to_s if enemy.note =~ /<note2:\s*(.*?)>/i
  202.       e_nc = $1.to_s if enemy.note =~ /<note3:\s*(.*?)>/i
  203.       e_nd = $1.to_s if enemy.note =~ /<note4:\s*(.*?)>/i
  204.       change_color(system_color)
  205.       draw_text(x, y, 500, line_height, "简介:")
  206.       change_color(normal_color)
  207.       draw_text(x+36, y + line_height * 1, 500, line_height, e_na)
  208.       draw_text(x,    y + line_height * 2, 500, line_height, e_nb)
  209.       draw_text(x,    y + line_height * 3, 500, line_height, e_nc)
  210.       draw_text(x,    y + line_height * 4, 500, line_height, e_nd)

  211.   end
  212.   #--------------------------------------------------------------------------
  213.   # ● 窗口半刷新
  214.   #--------------------------------------------------------------------------
  215.   def partial_refresh
  216.     return unless @enemy # 无敌人时返回
  217.     rect = Rect.new(ENEMY_IMAGE_MAX_WIDTH+8, 0,
  218.       contents.width-(ENEMY_IMAGE_MAX_WIDTH+8), contents.height-line_height)
  219.     contents.clear_rect(rect)
  220.     if ENEMY_MORE_INFO && @partial
  221.       Sound.play_cursor
  222.       draw_other_info
  223.       @partial = false
  224.     else
  225.       draw_enemy_hp(ENEMY_IMAGE_MAX_WIDTH+8, 0) # 绘制敌人体力
  226.       draw_enemy_mp(ENEMY_IMAGE_MAX_WIDTH+8, line_height) # 绘制敌人魔力
  227.       2.upto(7){ |n|
  228.         draw_enemy_param(ENEMY_IMAGE_MAX_WIDTH+8, line_height*n, n) # 绘制敌人能力
  229.       }
  230. #~    draw_enemy_gold(ENEMY_IMAGE_MAX_WIDTH+8, line_height*8) # 绘制敌人掉落金
  231.       draw_enemy_item(ENEMY_IMAGE_MAX_WIDTH+8, line_height*9) # 绘制敌人掉落物
  232.       @partial = true
  233.     end
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   # ● 绘制敌人特征
  237.   #--------------------------------------------------------------------------
  238.   # def draw_enemy_features(x, y)
  239.   # text = $1.to_s if enemy.note =~ /<intro>((?:[^<]|<[^\/])*)<\/intro>/i
  240.   # change_color(system_color)
  241.   # draw_text(x + 24, y - line_height, text_width(text), line_height, "简介:")
  242.   # change_color(normal_color)
  243.   # draw_text_ex(x + 24, y, text)
  244.   # end
  245.   #--------------------------------------------------------------------------
  246.   # ● 获取敌人特征
  247.   #--------------------------------------------------------------------------
  248.   def get_feature(feature)
  249.     code = feature.code
  250.     id = feature.data_id
  251.     value = feature.value
  252.     return "", 0 unless [11, 31].include?(code)
  253.     if code == 11
  254.       if value < 1.00
  255.         label = FEA_RES_ELE_RATE
  256.       elsif value > 1.00
  257.         label = FEA_WEAK_ELE_RATE
  258.       else
  259.         return "", 0
  260.       end
  261.       element = $data_system.elements[id]
  262.       return_value = element + "×" + " #{(value * 100).truncate}%"
  263.     elsif code == 31
  264.       label = FEA_ATK_ELEMENT
  265.       return_value = $data_system.elements[id]
  266.     end
  267.     return label, return_value
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ● 绘制敌人图像
  271.   #--------------------------------------------------------------------------
  272.   def draw_enemy_image(x, y)
  273.     image_name = @enemy.list_image # 获取指定图像
  274.     if image_name.nil? # 指定图像为空时
  275.       image = Cache.battler(@enemy.battler_name, @enemy.battler_hue) # 获取战斗图
  276.     else
  277.       hue = ENEMY_HUE_SYNC_DB ? @enemy.battler_hue : 0
  278.       image = Cache.load_bitmap(ENEMY_IMAGE_FOLDER, image_name, hue) # 获取战斗图
  279.     end
  280.    
  281.     ix = (image.width/2-ENEMY_IMAGE_MAX_WIDTH/2).abs  # 获取中心点
  282.     # 敌人图像宽度在显示范围外
  283.     if image.width > ENEMY_IMAGE_MAX_WIDTH
  284.       # 居中对齐
  285.       rx = ix
  286.       cx = x
  287.     # 敌人图像宽度在显示范围外
  288.     else
  289.       # 居中对齐
  290.       rx = 0
  291.       cx = ix
  292.     end
  293.     # 敌人图像高度在显示范围外
  294.     if image.height > ENEMY_IMAGE_MAX_HEIGHT
  295.       cy = y
  296.     # 敌人图像高度在显示范围内
  297.     else
  298.       cy = ENEMY_IMAGE_MAX_HEIGHT - image.height - 8 # 向下对齐
  299.     end
  300.     rect = Rect.new(rx, 0, ENEMY_IMAGE_MAX_WIDTH, ENEMY_IMAGE_MAX_HEIGHT)
  301.     contents.blt(cx, cy, image, rect, 255)
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # ● 绘制敌人辨识度
  305.   #--------------------------------------------------------------------------
  306.   def draw_enemy_percentage(x, y)
  307.     width = contents.width
  308.     change_color(system_color)
  309.     text = ENEMY_PERCENT_VOCAB
  310.     draw_text(x, y, text_width(text), line_height, text)
  311.     # 绘制辨识度进度槽
  312.     # draw_gauge(x+96, y, width- 96, @percentage.to_i/100,
  313.     # ENEMY_PERCENT_BASE_COLOR, ENEMY_PERCENT_FILL_COLOR)
  314.     # 绘制百分比
  315.     change_color(normal_color)
  316.     text = "#{@percentage}%"
  317.     draw_text(x+96, y, text_width(text), line_height, text)
  318.   end

  319.   #--------------------------------------------------------------------------
  320.   # ● 绘制敌人名称
  321.   #--------------------------------------------------------------------------
  322.   def draw_enemy_name(x, y)
  323.     y = 277
  324.     change_color(system_color)
  325.     text = "名称"
  326.     draw_text(x, y, text_width(text), line_height, text)
  327.     # 绘制名称
  328.     change_color(normal_color)
  329.     text = @enemy.name
  330.     draw_text(x+48, y, text_width(text), line_height, text)
  331.   end
  332.   #--------------------------------------------------------------------------
  333.   # ● 绘制敌人体力
  334.   #--------------------------------------------------------------------------
  335.   def draw_enemy_hp(x, y)
  336.     change_color(system_color)
  337.     text = Vocab::hp
  338.     draw_text(x, y, 108, line_height, text)
  339.     change_color(normal_color)
  340.     hp = @enemy.params[0]
  341.     # 判断显示百分比
  342.     if checkPercent?(HP_DISPLAY_PERC)
  343.       text = hp
  344.     elsif checkPercent?(HP_EST_DISPLAY_PERC)
  345.       # 计算体力约值
  346.       ahp = [(hp/10) * 10 - @enemy.params[3], 10].max * (rand(11)+89)/100
  347.       text = sprintf(EST_DISPLAY_MASK, ahp)
  348.     else
  349.       text = NO_DISPLAY_MASK
  350.     end
  351.     draw_text(x+72, y, text_width(text), line_height, text)
  352.   end
  353.   #--------------------------------------------------------------------------
  354.   # ● 绘制敌人魔力
  355.   #--------------------------------------------------------------------------
  356.   def draw_enemy_mp(x, y)
  357.     change_color(system_color)
  358.     text = Vocab::mp
  359.     draw_text(x, y, 108, line_height, text)
  360.     change_color(normal_color)
  361.     mp = @enemy.params[1]
  362.     # 判断显示百分比
  363.     if checkPercent?(MP_DISPLAY_PERC)
  364.       text = mp
  365.     elsif checkPercent?(MP_EST_DISPLAY_PERC)
  366.       # 计算魔力约值
  367.       amp = [(mp/10) * 10 - @enemy.params[5], @enemy.params[4], 5].max * (rand(11)+89)/100
  368.       text = sprintf(EST_DISPLAY_MASK, amp)
  369.     else
  370.       text = NO_DISPLAY_MASK
  371.     end
  372.     draw_text(x+72, y, text_width(text), line_height, text)
  373.   end
  374.   #--------------------------------------------------------------------------
  375.   # ● 绘制敌人能力值
  376.   #--------------------------------------------------------------------------
  377.   def draw_enemy_param(x, y, param_id)
  378.     # 能力值ID为1或2时,调用绘制体力/魔力方法
  379.     draw_enemy_hp(x, y) if param_id==0
  380.     draw_enemy_mp(x, y) if param_id==1
  381.     return if param_id < 2
  382.     change_color(system_color)
  383.     # 绘制能力值名称
  384.     draw_text(x, y, 108, line_height, Vocab::param(param_id))
  385.     change_color(normal_color)
  386.     # 获取能力值百分比
  387.     param_percent = [ATK_DISPLAY_PERC, DEF_DISPLAY_PERC, MAT_DISPLAY_PERC,
  388.                      MDF_DISPLAY_PERC, AGI_DISPLAY_PERC, LUK_DISPLAY_PERC ]
  389.     # 判断显示百分比
  390.     if checkPercent?(param_percent[param_id-2])
  391.       text = @enemy.params[param_id]
  392.     else
  393.       text = NO_DISPLAY_MASK
  394.     end
  395.     draw_text(x+72, y, text_width(text), line_height, text)
  396.   end
  397. #~   #--------------------------------------------------------------------------
  398. #~   # ● 绘制敌人掉落金钱
  399. #~   #--------------------------------------------------------------------------
  400. #~   def draw_enemy_gold(x, y)
  401. #~     change_color(system_color)
  402. #~     draw_text(x, y, 96, line_height, DROP_GOLD_VOCAB)
  403. #~     change_color(normal_color)
  404. #~     # 判断显示百分比
  405. #~     if checkPercent?(GOLD_DISPLAY_PERC)
  406. #~       draw_currency_value(@enemy.gold, Vocab.currency_unit, x+12, y+24, 108)
  407. #~     else
  408. #~       draw_text(x+72, y+24, 96, line_height, NO_DISPLAY_MASK)
  409. #~     end
  410. #~   end
  411.   #--------------------------------------------------------------------------
  412.   # ● 绘制敌人掉落物
  413.   #--------------------------------------------------------------------------
  414.   def draw_enemy_item(x, y)
  415.     change_color(system_color)
  416.     draw_text(x, y+24, 96, line_height, DROP_ITEM_VOCAB)
  417.     change_color(normal_color)
  418.     # 判断显示百分比
  419.     if checkPercent?(ITEM_DISPLAY_PERC)
  420.       nn_di = 0
  421.       for i in 0..2 do
  422.         di = item_object(@enemy.drop_items[i]) # 获取掉落物物件
  423.         if di
  424.           ly = y+line_height*(nn_di+1)+24 # 计算绘制高度
  425.           draw_item_name(di, x+24, ly)
  426.           nn_di += 1 # 计数器+1
  427.         end
  428.       end
  429.       return if nn_di > 0 # 计数器大于0时返回
  430.       draw_text(x+80, y+line_height+24, 96, line_height, "无")
  431.     else
  432.       draw_text(x+72, y+line_height+24, 96, line_height, NO_DISPLAY_MASK)
  433.     end
  434.   end
  435.   #--------------------------------------------------------------------------
  436.   # ● 计算敌人掉落物
  437.   #--------------------------------------------------------------------------
  438.   def item_object(drop_item)
  439.     kind = drop_item.kind
  440.     data_id = drop_item.data_id
  441.     return $data_items  [data_id] if kind == 1
  442.     return $data_weapons[data_id] if kind == 2
  443.     return $data_armors [data_id] if kind == 3
  444.     return nil
  445.   end
  446.   #--------------------------------------------------------------------------
  447.   # ● 绘制其他资讯
  448.   #--------------------------------------------------------------------------
  449.   def draw_other_info
  450.       fy = y
  451.       change_color(system_color)
  452.       draw_text(x+66, fy-45, 500, line_height, "详细属性")
  453.     if checkPercent?(ELEMENT_DISPLAY_PERC)
  454.       for i in 0..20 do
  455.         feature = @enemy.features[i]
  456.         next unless feature
  457.         label, value = get_feature(feature)
  458.         next if label==""
  459.         change_color(system_color)
  460.         draw_text(x+18, fy-45+line_height*2, text_width(label), line_height, label)
  461.         change_color(tp_cost_color)
  462.         draw_text(x+100, fy-45+line_height*2, text_width(value), line_height, value)
  463.         fy+=line_height
  464.       end
  465.     else
  466.       change_color(normal_color)
  467.       draw_text(x+90, y-line_height+24, 96, line_height, "???")
  468.       draw_text(x+90, y+line_height+24, 96, line_height, "???")
  469.       draw_text(x+90, y+line_height*3+24, 96, line_height, "???")
  470.     end
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # ● 获得文字宽度
  474.   #--------------------------------------------------------------------------
  475.   def text_width(text)
  476.     return text_size(text).width + 5
  477.   end
  478. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
19 小时
注册时间
2014-3-1
帖子
23
4
 楼主| 发表于 2014-3-8 22:29:16 | 只看该作者

  1. class Scene_List < Scene_Base
  2.   include Snstar::EnemyList
  3.   #--------------------------------------------------------------------------
  4.   # ● 场景开始
  5.   #--------------------------------------------------------------------------
  6.   def start
  7.     super
  8.     create_category_window
  9.     create_list_window
  10.     create_detail_window
  11.   end
  12.   #--------------------------------------------------------------------------
  13.   # ● 创建敌人类型窗口
  14.   #--------------------------------------------------------------------------
  15.   def create_category_window
  16.     @category_window = Window_EnemyType.new(0, 0)
  17.     @category_window.set_handler(:ok,     method(:on_category_ok))
  18.     @category_window.set_handler(:cancel, method(:return_scene))
  19.     @category_window.viewport = @viewport
  20.   end
  21.   #--------------------------------------------------------------------------
  22.   # ● 创建敌人列表窗口
  23.   #--------------------------------------------------------------------------
  24.   def create_list_window
  25.     @list_window = Window_EnemyList.new(0, 48, 160, Graphics.height-48)
  26.     @list_window.set_handler(:cancel, method(:on_list_cancel))
  27.     @list_window.viewport = @viewport
  28.     @category_window.item_window = @list_window
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   # ● 创建敌人讯息窗口
  32.   #--------------------------------------------------------------------------
  33.   def create_detail_window
  34.     @detail_window = Window_EnemyDetail.new
  35.     @list_window.info_window = @detail_window
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ● 选择类型完成
  39.   #--------------------------------------------------------------------------
  40.   def on_category_ok
  41.     @list_window.activate
  42.     @list_window.select_last
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 离开敌人列表
  46.   #--------------------------------------------------------------------------
  47.   def on_list_cancel
  48.     @list_window.unselect
  49.     @category_window.activate
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # ● 场景更新
  53.   #--------------------------------------------------------------------------
  54.   def update
  55.     super
  56.     on_list_partial_refersh if Input.trigger?(ENEMY_MORE_INFO_BUTTON)
  57.     enemy_percent_change(:left) if Input.trigger?(:LEFT)
  58.     enemy_percent_change(:right) if Input.trigger?(:RIGHT)
  59.   end
  60.   #--------------------------------------------------------------------------
  61.   # ● 敌人讯息半刷新
  62.   #--------------------------------------------------------------------------
  63.   def on_list_partial_refersh
  64.     @detail_window.partial_refresh
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ● 更改敌人辨识度百分比(仅游戏测试时可用)
  68.   #--------------------------------------------------------------------------
  69.   def enemy_percent_change(sym)
  70.     return unless $TEST
  71.     return unless @list_window.active
  72.     enemy = @detail_window.enemy
  73.     return unless enemy
  74.     $game_party.see_enemy(enemy.id, TEST_PERCENT) if sym == :right
  75.     $game_party.see_enemy(enemy.id, -TEST_PERCENT) if sym == :left
  76.     @list_window.refresh
  77.     @detail_window.enemy = enemy
  78.   end
  79. end
  80. #   class Window_MenuCommand < Window_Command
  81. #    include Snstar::EnemyList
  82. #    #--------------------------------------------------------------------------
  83. #    # ● 加入敌人图鉴命令
  84. #    #--------------------------------------------------------------------------
  85. #    alias enemy_list_add_original_commands add_original_commands
  86. #    def add_original_commands
  87. #      enemy_list_add_original_commands
  88. #      return unless ENEMY_LIST_SWITCH_ID==0 || $game_switches[ENEMY_LIST_SWITCH_ID]
  89. #      enabled = ENEMY_LIST_ENABLE_ID == 0 || $game_switches[ENEMY_LIST_ENABLE_ID]
  90. #      add_command(ENEMY_LIST_COMMAND_TEXT, :enemy_list, enabled)
  91. #    end
  92. #  end
  93. class Scene_Menu < Scene_MenuBase
  94.   #--------------------------------------------------------------------------
  95.   # ● 创建命令窗口
  96.   #--------------------------------------------------------------------------
  97.   alias enemy_list_create_command_window create_command_window
  98.   def create_command_window
  99.     enemy_list_create_command_window
  100.     @command_window.set_handler(:enemy_list, method(:enemy_list_display))
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ● 呼叫敌人图鉴场景
  104.   #--------------------------------------------------------------------------
  105.   def enemy_list_display
  106.     SceneManager.call(Scene_List)
  107.   end
  108. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
19 小时
注册时间
2014-3-1
帖子
23
5
 楼主| 发表于 2014-3-8 22:29:43 | 只看该作者
上面是我考培的脚本
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
19 小时
注册时间
2014-3-1
帖子
23
6
 楼主| 发表于 2014-3-8 22:32:06 | 只看该作者
要把哪里删除才可以把简介删除啊 求大神指导。。。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
19 小时
注册时间
2014-3-1
帖子
23
7
 楼主| 发表于 2014-3-8 23:19:12 | 只看该作者
简介我已经删掉了 现在是要把那个辨识度的坐标改上面一点 要改哪里的代码
还有要给怪物 分类 要怎么分???
回复 支持 反对

使用道具 举报

Lv4.逐梦者 (版主)

无限の剣制

梦石
0
星屑
10073
在线时间
5020 小时
注册时间
2013-2-28
帖子
5030

开拓者贵宾

8
发表于 2014-3-8 23:28:36 | 只看该作者
本帖最后由 VIPArcher 于 2014-3-8 23:29 编辑
674521854 发表于 2014-3-8 23:19
简介我已经删掉了 现在是要把那个辨识度的坐标改上面一点 要改哪里的代码
还有要给怪物 分类 要怎么分?? ...


分类的方法是在怪物的备注里打上 [ltype x] X为你上面要定义的类型
改辨识度的坐标在窗口的那个脚本大概312行左右draw_text(x, y, text_width(text), line_height, text)
下面三行的坐标都要改
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
19 小时
注册时间
2014-3-1
帖子
23
9
 楼主| 发表于 2014-3-8 23:55:34 | 只看该作者
VIPArcher 发表于 2014-3-8 23:28
分类的方法是在怪物的备注里打上 [ltype x] X为你上面要定义的类型
改辨识度的坐标在窗口的那个脚本大概3 ...

我还想改 那个辨识度的进度条的颜色要改哪里啊
回复 支持 反对

使用道具 举报

Lv4.逐梦者 (版主)

无限の剣制

梦石
0
星屑
10073
在线时间
5020 小时
注册时间
2013-2-28
帖子
5030

开拓者贵宾

10
发表于 2014-3-9 00:06:35 | 只看该作者
674521854 发表于 2014-3-8 23:55
我还想改 那个辨识度的进度条的颜色要改哪里啊

图鉴核心那个脚本第29 30行左右
  1.     ENEMY_PERCENT_BASE_COLOR = Color.new(0, 255, 0)#Color.new(0, 0, 0)
  2.     ENEMY_PERCENT_FILL_COLOR = Color.new(255, 255, 0)
复制代码
改()里面的值对应的是 R B G 这个应该懂吧

评分

参与人数 1梦石 +1 收起 理由
Sion + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-25 05:31

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表