Project1

标题: 【求救】请问能把xp的脚本改改吗? [打印本页]

作者: 可可夏天    时间: 2012-5-20 23:53
标题: 【求救】请问能把xp的脚本改改吗?
#==============================================================================
# □ Window_EnemyGuideStatus
#------------------------------------------------------------------------------
#   在怪物图件上、表示简介的窗口。
#==============================================================================

class Window_EnemyGuideStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● 公开实例变量
  #--------------------------------------------------------------------------
  attr_reader   :enemy                    # 表示敌人
  #--------------------------------------------------------------------------
  # ● 对象初始化
  #--------------------------------------------------------------------------
  def initialize
    super(240, 0, Graphics.width - 240, Graphics.height)
    self.enemy = nil
    self.z = 100
    if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
      self.opacity = 0
    end
    @show_sprite = false
    @enemy_sprite = Sprite.new
    @enemy_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
    @enemy_sprite.x = 0
    @enemy_sprite.y = 0
    @enemy_sprite.z = self.z + 100
    @enemy_sprite.visible = false
  end
  #--------------------------------------------------------------------------
  # ● 释放
  #--------------------------------------------------------------------------
  def dispose
    super
    @enemy_sprite.bitmap.dispose
    @enemy_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # ○ 物件页是否显示
  #--------------------------------------------------------------------------
  def item_page_show?
    return true if KGC::EnemyGuide::SHOW_DROP_ITEM
    return true if $imported["Steal"] && KGC::EnemyGuide::SHOW_STEAL_OBJ

    return false
  end
  #--------------------------------------------------------------------------
  # ○ 取得页数
  #--------------------------------------------------------------------------
  def pages
    return (item_page_show? ? 2 : 1)
  end
  #--------------------------------------------------------------------------
  # ○ 表示敌人设定
  #--------------------------------------------------------------------------
  def enemy=(enemy)
    @enemy = enemy
    refresh
  end
  #--------------------------------------------------------------------------
  # ○ 更改显示的信息
  #     shamt : 移动页
  #--------------------------------------------------------------------------
  def shift_info_type(shamt)
    n = self.ox + (width - 32) * shamt
    self.ox = [[n, 0].max, (width - 32) * (pages - 1)].min
  end
  #--------------------------------------------------------------------------
  # ○ sprite的表示切换
  #--------------------------------------------------------------------------
  def switch_sprite
    @show_sprite = !@show_sprite
    @enemy_sprite.visible = @show_sprite
  end
  #--------------------------------------------------------------------------
  # ● 更新
  #--------------------------------------------------------------------------
  def refresh
    original_width = self.width
    self.width = original_width * pages - (32 * (pages - 1))
    create_contents
    self.width = original_width

    draw_enemy_sprite

    return if enemy == nil

    self.contents.font.color = normal_color
    # 没有遭遇
    unless KGC::Commands.enemy_encountered?(enemy.id)
      self.contents.font.color.alpha = 128
      dy = (height - 32) / 2
      dy -= dy % WLH
      self.contents.draw_text(0, dy, width - 32, WLH,
        KGC::EnemyGuide::UNENCOUNTERED_DATA, 1)
      self.contents.blt(width - 32, 0, self.contents, self.contents.rect)
      return
    end

    draw_status
  end
  #--------------------------------------------------------------------------
  # ○ 简介的描绘
  #--------------------------------------------------------------------------
  def draw_status
    # Page 1
    dy = draw_basic_info(0, 0)
    draw_description(0, dy)

    # Page 2 (如果你只看到相关的项目)
    if item_page_show?
      dx = width - 32
      dy = draw_basic_info(dx, 0)
      max_rows = (self.height - dy - 32) / WLH
      rows = (max_rows + 1) / (pages - 1)
      dy = draw_drop_item(dx, dy, rows)
      draw_steal_object(dx, dy, max_rows - rows)
    end
  end
  #--------------------------------------------------------------------------
  # ○ 基本请报页
  #     dx, dy : 描画先 X, Y
  #--------------------------------------------------------------------------
  def draw_basic_info(dx, dy)
    draw_graphic(dx, dy)
    draw_parameter1(dx + 112, dy)
    return dy + 96
  end
  #--------------------------------------------------------------------------
  # ○ 图解的描绘
  #     dx, dy : 描画先 X, Y
  #--------------------------------------------------------------------------
  def draw_graphic(dx, dy)
    buf = Bitmap.new(108, 96)
    bitmap = Cache.battler(enemy.battler_name, enemy.battler_hue)
    rect = Rect.new(0, 0, bitmap.width / 3, bitmap.height / 3)
    rect.x = (108 - rect.width) / 2
    rect.y = (96 - rect.height) / 2
    buf.stretch_blt(rect, bitmap, bitmap.rect)
    self.contents.blt(dx, dy, buf, buf.rect)
    buf.dispose
  end
  #--------------------------------------------------------------------------
  # ○ 敌人精灵的描画
  #--------------------------------------------------------------------------
  def draw_enemy_sprite
    return if @enemy_sprite == nil

    @enemy_sprite.bitmap.fill_rect(@enemy_sprite.bitmap.rect,
      Color.new(0, 0, 0, 160))

    return if enemy == nil || !KGC::Commands.enemy_encountered?(enemy.id)

    bitmap = Cache.battler(enemy.battler_name, enemy.battler_hue)
    dx = (Graphics.width - bitmap.width) / 2
    dy = (Graphics.height - bitmap.height) / 2
    @enemy_sprite.bitmap.blt(dx, dy, bitmap, bitmap.rect)
  end
  #--------------------------------------------------------------------------
  # ○ 参数的描画 - 1
  #     dx, dy : 描画先 X, Y
  #--------------------------------------------------------------------------
  def draw_parameter1(dx, dy)
    # 名前, HP, MP
    param = {}
    if KGC::Commands.enemy_defeated?(enemy.id)
      param[:maxhp] = enemy.maxhp
    else
      param[:maxhp] = KGC::EnemyGuide::UNDEFEATED_PARAMETER
    end

    self.contents.font.color = normal_color
    self.contents.draw_text(dx, dy, width - 144, WLH, enemy.name)
    self.contents.font.color = system_color
    self.contents.draw_text(dx, dy + WLH,     80, WLH, Vocab.hp)
    self.contents.font.color = normal_color
    self.contents.draw_text(dx + 88, dy + WLH,     64, WLH, param[:maxhp], 2)
  end
  #--------------------------------------------------------------------------
  # ○ ICON目录的描画
  #     dx, dy          : 描画处 X, Y
  #     rows, cols      : 行列数
  #     item_list       : 描画对象的目录
  #     cond_proc       : 描画条件 Proc
  #     index_proc      : ICON index 取得用 Proc
  #--------------------------------------------------------------------------
  def draw_icon_list(dx, dy, rows, cols, item_list, cond_proc, index_proc)
    nc = 0  # 现在的列数
    nr = 0  # 先在的行数
    item_list.each { |item|
      next if item == nil
      next unless cond_proc.call(item)
      icon_index = index_proc.call(item)
      next if icon_index == nil || icon_index == 0

      draw_icon(icon_index, dx + nc * 24, dy + nr * 24)
      nc += 1
      if nc == cols
        # 次の行へ
        nc = 0
        nr += 1
        break if nr == rows  # 行制限オーバー
      end
    }
  end
  #--------------------------------------------------------------------------
  # ○ 战利品的描画
  #     dx, dy : 描画先 X, Y
  #     rows   : 行数
  #--------------------------------------------------------------------------
  def draw_drop_item(dx, dy, rows)
    return dy unless KGC::EnemyGuide::SHOW_DROP_ITEM

    new_dy = dy + WLH * rows
    dw = (width - 32) / 2
    self.contents.font.color = system_color
    self.contents.draw_text(dx,      dy, 128, WLH,
      KGC::EnemyGuide::PARAMETER_NAME[:treasure], 1)

    return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)

    # 列表
    drop_items = [enemy.drop_item1, enemy.drop_item2]
    if $imported["ExtraDropItem"]
      drop_items += enemy.extra_drop_items
    end

    dy += WLH
    count = 0
    drop_items.each_with_index { |item, i|
      # 物品名
      case item.kind
      when 0
        next
      when 1
        drop_item = $data_items[item.item_id]
      when 2
        drop_item = $data_weapons[item.weapon_id]
      when 3
        drop_item = $data_armors[item.armor_id]
      end
      if KGC::Commands.enemy_item_dropped?(enemy.id, i)
        draw_item_name(drop_item, dx, dy)
      else
        draw_masked_item_name(drop_item, dx, dy)
      end
      dy += WLH
      count += 1
      break if count == rows
    }

    return new_dy
  end
  #--------------------------------------------------------------------------
  # ○ 物品名为遮挡的描画
  #     item    : 物品 (机能、武器、防具都可以)
  #     x       : 描画处 X 坐标
  #     y       : 描画出 Y 坐标
  #     enabled : 有効标志。false 的时候半透明的描画
  #--------------------------------------------------------------------------
  def draw_masked_item_name(item, x, y, enabled = true)
    return if item == nil

    draw_icon(item.icon_index, x, y, enabled)
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    mask = KGC::EnemyGuide::UNDROPPED_ITEM_NAME
    text = KGC.mask_string(item.name, mask)
    self.contents.draw_text(x + 24, y, 172, WLH, text)
  end
  #--------------------------------------------------------------------------
  # ○ 偷盗名为遮挡的描画
  #     dx, dy : 描画先 X, Y
  #     rows   : 行数
  #--------------------------------------------------------------------------
  def draw_steal_object(dx, dy, rows)
    return dy unless $imported["Steal"] && KGC::EnemyGuide::SHOW_STEAL_OBJ

    new_dy = dy + WLH * rows
    dw = (width - 32) / 2
    self.contents.font.color = system_color
    self.contents.draw_text(dx,      dy, 128, WLH,
      KGC::EnemyGuide::PARAMETER_NAME[:steal_obj], 1)
    self.contents.draw_text(dx + dw, dy, 128, WLH,
      KGC::EnemyGuide::PARAMETER_NAME[:steal_prob], 2)

    return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)

    # 列表
    steal_objects = enemy.steal_objects.clone
    if steal_objects.size >= rows
      steal_objects = steal_objects[0...(rows - 1)]
    end

    dy += WLH
    steal_objects.each_with_index { |obj, i|
      if obj.kind == 4
        # Gold
        if KGC::Commands.enemy_object_stolen?(enemy.id, i)
          text = sprintf("%d%s", obj.gold, Vocab.gold)
        else
          mask = KGC::EnemyGuide::UNDROPPED_ITEM_NAME
          text = KGC.mask_string("aaa", mask)
        end
        self.contents.draw_text(dx + 24, dy, dw, WLH, text)
      else
        # Item
        case obj.kind
        when 1
          item = $data_items[obj.item_id]
        when 2
          item = $data_weapons[obj.weapon_id]
        when 3
          item = $data_armors[obj.armor_id]
        end
        if KGC::Commands.enemy_object_stolen?(enemy.id, i)
          draw_item_name(item, dx, dy)
        else
          draw_masked_item_name(item, dx, dy)
        end
      end
      # 成功率
      if obj.success_prob > 0
        text = sprintf("%d%%", obj.success_prob)
      else
        text = "1/#{obj.denominator}"
      end
      self.contents.draw_text(dx + dw, dy, 128, WLH, text, 2)
      dy += WLH
    }

    return new_dy
  end
  #--------------------------------------------------------------------------
  # ○ 说明文字描画
  #     dx, dy : 描画先 X, Y
  #--------------------------------------------------------------------------
  def draw_description(dx, dy)
    return unless KGC::Commands.enemy_defeated?(enemy.id)

    dx += 4
    enemy.enemy_guide_description.each_line { |line|
      self.contents.draw_text(dx, dy, width - 32, WLH, line.chomp)
      dy += WLH
    }
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Map
#==============================================================================

class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ● 实行画面的切换
  #--------------------------------------------------------------------------
  alias update_scene_change_KGC_EnemyGuide update_scene_change
  def update_scene_change
    return if $game_player.moving?    # 玩家的移动中?

    if $game_temp.next_scene == :enemy_guide
      call_enemy_guide
      return
    end

    update_scene_change_KGC_EnemyGuide
  end
  #--------------------------------------------------------------------------
  # ○ 切换到怪物图鉴
  #--------------------------------------------------------------------------
  def call_enemy_guide
    $game_temp.next_scene = nil
    $scene = Scene_EnemyGuide.new(0, Scene_EnemyGuide::HOST_MAP)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Menu
#==============================================================================

class Scene_Menu < Scene_Base
  if KGC::EnemyGuide::USE_MENU_ENEMY_GUIDE_COMMAND
  #--------------------------------------------------------------------------
  # ● 作成指令窗口
  #--------------------------------------------------------------------------
  alias create_command_window_KGC_EnemyGuide create_command_window
  def create_command_window
    create_command_window_KGC_EnemyGuide

    return if $imported["CustomMenuCommand"]

    @__command_enemy_guide_index =
      @command_window.add_command(Vocab.enemy_guide)
    if @command_window.oy > 0
      @command_window.oy -= Window_Base::WLH
    end
    @command_window.index = @menu_index
  end
  end
  #--------------------------------------------------------------------------
  # ● 指令选择的更新
  #--------------------------------------------------------------------------
  alias update_command_selection_KGC_EnemyGuide update_command_selection
  def update_command_selection
    current_menu_index = @__command_enemy_guide_index
    call_enemy_guide_flag = false

    if Input.trigger?(Input::C)
      case @command_window.index
      when @__command_enemy_guide_index  # 怪物图鉴
        call_enemy_guide_flag = true
      end
    end

    # 移动到怪物图鉴
    if call_enemy_guide_flag
      Sound.play_decision
      $scene = Scene_EnemyGuide.new(@__command_enemy_guide_index,
        Scene_EnemyGuide::HOST_MENU)
      return
    end

    update_command_selection_KGC_EnemyGuide
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ Scene_EnemyGuide
#------------------------------------------------------------------------------
#   进行怪物图鉴画面的处理的目录。
#==============================================================================

class Scene_EnemyGuide < Scene_Base
  HOST_MENU   = 0
  HOST_MAP    = 1
  #--------------------------------------------------------------------------
  # ● 对象初始化
  #     menu_index  : 指令光标初期位置
  #     host_scene  : 呼出原处 (0..菜单  1..地图)
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0, host_scene = HOST_MENU)
    @menu_index = menu_index
    @host_scene = host_scene
  end
  #--------------------------------------------------------------------------
  # ● 开始的处理
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
      @back_sprite = Sprite.new
      begin
        @back_sprite.bitmap = Cache.system(KGC::EnemyGuide::BACKGROUND_FILENAME)
      rescue
        @back_sprite.bitmap = Bitmap.new(32, 32)
      end
    end

    @top_window = Window_EnemyGuideTop.new
    @enemy_window = Window_EnemyGuideList.new
    @status_window = Window_EnemyGuideStatus.new
    @status_window.enemy = @enemy_window.item
  end
  #--------------------------------------------------------------------------
  # ● 退出场景
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    if @back_sprite != nil
      @back_sprite.bitmap.dispose
      @back_sprite.dispose
    end
    @top_window.dispose
    @enemy_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # ○ 返回原菜单画面
  #--------------------------------------------------------------------------
  def return_scene
    case @host_scene
    when HOST_MENU
      $scene = Scene_Menu.new(@menu_index)
    when HOST_MAP
      $scene = Scene_Map.new
    end
  end
  #--------------------------------------------------------------------------
  # ● 帧更新
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @top_window.update
    @enemy_window.update
    @status_window.update
    if @enemy_window.active
      update_enemy_selection
    end
  end
  #--------------------------------------------------------------------------
  # ○ 敌人选择的更新
  #--------------------------------------------------------------------------
  def update_enemy_selection
    if @last_index != @enemy_window.index
      @status_window.enemy = @enemy_window.item
      @last_index = @enemy_window.index
    end

    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::A) || Input.trigger?(Input::C)
      # sprte的表示切换
      Sound.play_decision
      @status_window.switch_sprite
    elsif Input.trigger?(Input::LEFT)
      # 参数表示
      Sound.play_cursor
      @status_window.shift_info_type(-1)
    elsif Input.trigger?(Input::RIGHT)
      # 说明表示
      Sound.play_cursor
      @status_window.shift_info_type(1)
    end
  end
end

帮忙改成ace可以吗 我是新手不会啊~各位前辈拜托了dsu_plus_rewardpost_czw
作者: Raiku    时间: 2012-5-21 12:09
你没把脚本全贴出来要我们怎么改呢?
话说脚本要放在代码框
作者: 可可夏天    时间: 2012-5-23 00:06
  1. #==============================================================================
  2. # □ Window_EnemyGuideStatus
  3. #------------------------------------------------------------------------------
  4. #   在怪物图件上、表示简介的窗口。
  5. #==============================================================================

  6. class Window_EnemyGuideStatus < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 公开实例变量
  9.   #--------------------------------------------------------------------------
  10.   attr_reader   :enemy                    # 表示敌人
  11.   #--------------------------------------------------------------------------
  12.   # ● 对象初始化
  13.   #--------------------------------------------------------------------------
  14.   def initialize
  15.     super(240, 0, Graphics.width - 240, Graphics.height)
  16.     self.enemy = nil
  17.     self.z = 100
  18.     if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
  19.       self.opacity = 0
  20.     end
  21.     @show_sprite = false
  22.     @enemy_sprite = Sprite.new
  23.     @enemy_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  24.     @enemy_sprite.x = 0
  25.     @enemy_sprite.y = 0
  26.     @enemy_sprite.z = self.z + 100
  27.     @enemy_sprite.visible = false
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # ● 释放
  31.   #--------------------------------------------------------------------------
  32.   def dispose
  33.     super
  34.     @enemy_sprite.bitmap.dispose
  35.     @enemy_sprite.dispose
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ○ 物件页是否显示
  39.   #--------------------------------------------------------------------------
  40.   def item_page_show?
  41.     return true if KGC::EnemyGuide::SHOW_DROP_ITEM
  42.     return true if $imported["Steal"] && KGC::EnemyGuide::SHOW_STEAL_OBJ

  43.     return false
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ○ 取得页数
  47.   #--------------------------------------------------------------------------
  48.   def pages
  49.     return (item_page_show? ? 2 : 1)
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # ○ 表示敌人设定
  53.   #--------------------------------------------------------------------------
  54.   def enemy=(enemy)
  55.     @enemy = enemy
  56.     refresh
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ○ 更改显示的信息
  60.   #     shamt : 移动页
  61.   #--------------------------------------------------------------------------
  62.   def shift_info_type(shamt)
  63.     n = self.ox + (width - 32) * shamt
  64.     self.ox = [[n, 0].max, (width - 32) * (pages - 1)].min
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ○ sprite的表示切换
  68.   #--------------------------------------------------------------------------
  69.   def switch_sprite
  70.     @show_sprite = !@show_sprite
  71.     @enemy_sprite.visible = @show_sprite
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ● 更新
  75.   #--------------------------------------------------------------------------
  76.   def refresh
  77.     original_width = self.width
  78.     self.width = original_width * pages - (32 * (pages - 1))
  79.     create_contents
  80.     self.width = original_width

  81.     draw_enemy_sprite

  82.     return if enemy == nil

  83.     self.contents.font.color = normal_color
  84.     # 没有遭遇
  85.     unless KGC::Commands.enemy_encountered?(enemy.id)
  86.       self.contents.font.color.alpha = 128
  87.       dy = (height - 32) / 2
  88.       dy -= dy % WLH
  89.       self.contents.draw_text(0, dy, width - 32, WLH,
  90.         KGC::EnemyGuide::UNENCOUNTERED_DATA, 1)
  91.       self.contents.blt(width - 32, 0, self.contents, self.contents.rect)
  92.       return
  93.     end

  94.     draw_status
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ○ 简介的描绘
  98.   #--------------------------------------------------------------------------
  99.   def draw_status
  100.     # Page 1
  101.     dy = draw_basic_info(0, 0)
  102.     draw_description(0, dy)

  103.     # Page 2 (如果你只看到相关的项目)
  104.     if item_page_show?
  105.       dx = width - 32
  106.       dy = draw_basic_info(dx, 0)
  107.       max_rows = (self.height - dy - 32) / WLH
  108.       rows = (max_rows + 1) / (pages - 1)
  109.       dy = draw_drop_item(dx, dy, rows)
  110.       draw_steal_object(dx, dy, max_rows - rows)
  111.     end
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ○ 基本请报页
  115.   #     dx, dy : 描画先 X, Y
  116.   #--------------------------------------------------------------------------
  117.   def draw_basic_info(dx, dy)
  118.     draw_graphic(dx, dy)
  119.     draw_parameter1(dx + 112, dy)
  120.     return dy + 96
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ○ 图解的描绘
  124.   #     dx, dy : 描画先 X, Y
  125.   #--------------------------------------------------------------------------
  126.   def draw_graphic(dx, dy)
  127.     buf = Bitmap.new(108, 96)
  128.     bitmap = Cache.battler(enemy.battler_name, enemy.battler_hue)
  129.     rect = Rect.new(0, 0, bitmap.width / 3, bitmap.height / 3)
  130.     rect.x = (108 - rect.width) / 2
  131.     rect.y = (96 - rect.height) / 2
  132.     buf.stretch_blt(rect, bitmap, bitmap.rect)
  133.     self.contents.blt(dx, dy, buf, buf.rect)
  134.     buf.dispose
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ○ 敌人精灵的描画
  138.   #--------------------------------------------------------------------------
  139.   def draw_enemy_sprite
  140.     return if @enemy_sprite == nil

  141.     @enemy_sprite.bitmap.fill_rect(@enemy_sprite.bitmap.rect,
  142.       Color.new(0, 0, 0, 160))

  143.     return if enemy == nil || !KGC::Commands.enemy_encountered?(enemy.id)

  144.     bitmap = Cache.battler(enemy.battler_name, enemy.battler_hue)
  145.     dx = (Graphics.width - bitmap.width) / 2
  146.     dy = (Graphics.height - bitmap.height) / 2
  147.     @enemy_sprite.bitmap.blt(dx, dy, bitmap, bitmap.rect)
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ○ 参数的描画 - 1
  151.   #     dx, dy : 描画先 X, Y
  152.   #--------------------------------------------------------------------------
  153.   def draw_parameter1(dx, dy)
  154.     # 名前, HP, MP
  155.     param = {}
  156.     if KGC::Commands.enemy_defeated?(enemy.id)
  157.       param[:maxhp] = enemy.maxhp
  158.     else
  159.       param[:maxhp] = KGC::EnemyGuide::UNDEFEATED_PARAMETER
  160.     end

  161.     self.contents.font.color = normal_color
  162.     self.contents.draw_text(dx, dy, width - 144, WLH, enemy.name)
  163.     self.contents.font.color = system_color
  164.     self.contents.draw_text(dx, dy + WLH,     80, WLH, Vocab.hp)
  165.     self.contents.font.color = normal_color
  166.     self.contents.draw_text(dx + 88, dy + WLH,     64, WLH, param[:maxhp], 2)
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # ○ ICON目录的描画
  170.   #     dx, dy          : 描画处 X, Y
  171.   #     rows, cols      : 行列数
  172.   #     item_list       : 描画对象的目录
  173.   #     cond_proc       : 描画条件 Proc
  174.   #     index_proc      : ICON index 取得用 Proc
  175.   #--------------------------------------------------------------------------
  176.   def draw_icon_list(dx, dy, rows, cols, item_list, cond_proc, index_proc)
  177.     nc = 0  # 现在的列数
  178.     nr = 0  # 先在的行数
  179.     item_list.each { |item|
  180.       next if item == nil
  181.       next unless cond_proc.call(item)
  182.       icon_index = index_proc.call(item)
  183.       next if icon_index == nil || icon_index == 0

  184.       draw_icon(icon_index, dx + nc * 24, dy + nr * 24)
  185.       nc += 1
  186.       if nc == cols
  187.         # 次の行へ
  188.         nc = 0
  189.         nr += 1
  190.         break if nr == rows  # 行制限オーバー
  191.       end
  192.     }
  193.   end
  194.   #--------------------------------------------------------------------------
  195.   # ○ 战利品的描画
  196.   #     dx, dy : 描画先 X, Y
  197.   #     rows   : 行数
  198.   #--------------------------------------------------------------------------
  199.   def draw_drop_item(dx, dy, rows)
  200.     return dy unless KGC::EnemyGuide::SHOW_DROP_ITEM

  201.     new_dy = dy + WLH * rows
  202.     dw = (width - 32) / 2
  203.     self.contents.font.color = system_color
  204.     self.contents.draw_text(dx,      dy, 128, WLH,
  205.       KGC::EnemyGuide::PARAMETER_NAME[:treasure], 1)

  206.     return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)

  207.     # 列表
  208.     drop_items = [enemy.drop_item1, enemy.drop_item2]
  209.     if $imported["ExtraDropItem"]
  210.       drop_items += enemy.extra_drop_items
  211.     end

  212.     dy += WLH
  213.     count = 0
  214.     drop_items.each_with_index { |item, i|
  215.       # 物品名
  216.       case item.kind
  217.       when 0
  218.         next
  219.       when 1
  220.         drop_item = $data_items[item.item_id]
  221.       when 2
  222.         drop_item = $data_weapons[item.weapon_id]
  223.       when 3
  224.         drop_item = $data_armors[item.armor_id]
  225.       end
  226.       if KGC::Commands.enemy_item_dropped?(enemy.id, i)
  227.         draw_item_name(drop_item, dx, dy)
  228.       else
  229.         draw_masked_item_name(drop_item, dx, dy)
  230.       end
  231.       dy += WLH
  232.       count += 1
  233.       break if count == rows
  234.     }

  235.     return new_dy
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # ○ 物品名为遮挡的描画
  239.   #     item    : 物品 (机能、武器、防具都可以)
  240.   #     x       : 描画处 X 坐标
  241.   #     y       : 描画出 Y 坐标
  242.   #     enabled : 有効标志。false 的时候半透明的描画
  243.   #--------------------------------------------------------------------------
  244.   def draw_masked_item_name(item, x, y, enabled = true)
  245.     return if item == nil

  246.     draw_icon(item.icon_index, x, y, enabled)
  247.     self.contents.font.color = normal_color
  248.     self.contents.font.color.alpha = enabled ? 255 : 128
  249.     mask = KGC::EnemyGuide::UNDROPPED_ITEM_NAME
  250.     text = KGC.mask_string(item.name, mask)
  251.     self.contents.draw_text(x + 24, y, 172, WLH, text)
  252.   end
  253.   #--------------------------------------------------------------------------
  254.   # ○ 偷盗名为遮挡的描画
  255.   #     dx, dy : 描画先 X, Y
  256.   #     rows   : 行数
  257.   #--------------------------------------------------------------------------
  258.   def draw_steal_object(dx, dy, rows)
  259.     return dy unless $imported["Steal"] && KGC::EnemyGuide::SHOW_STEAL_OBJ

  260.     new_dy = dy + WLH * rows
  261.     dw = (width - 32) / 2
  262.     self.contents.font.color = system_color
  263.     self.contents.draw_text(dx,      dy, 128, WLH,
  264.       KGC::EnemyGuide::PARAMETER_NAME[:steal_obj], 1)
  265.     self.contents.draw_text(dx + dw, dy, 128, WLH,
  266.       KGC::EnemyGuide::PARAMETER_NAME[:steal_prob], 2)

  267.     return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)

  268.     # 列表
  269.     steal_objects = enemy.steal_objects.clone
  270.     if steal_objects.size >= rows
  271.       steal_objects = steal_objects[0...(rows - 1)]
  272.     end

  273.     dy += WLH
  274.     steal_objects.each_with_index { |obj, i|
  275.       if obj.kind == 4
  276.         # Gold
  277.         if KGC::Commands.enemy_object_stolen?(enemy.id, i)
  278.           text = sprintf("%d%s", obj.gold, Vocab.gold)
  279.         else
  280.           mask = KGC::EnemyGuide::UNDROPPED_ITEM_NAME
  281.           text = KGC.mask_string("aaa", mask)
  282.         end
  283.         self.contents.draw_text(dx + 24, dy, dw, WLH, text)
  284.       else
  285.         # Item
  286.         case obj.kind
  287.         when 1
  288.           item = $data_items[obj.item_id]
  289.         when 2
  290.           item = $data_weapons[obj.weapon_id]
  291.         when 3
  292.           item = $data_armors[obj.armor_id]
  293.         end
  294.         if KGC::Commands.enemy_object_stolen?(enemy.id, i)
  295.           draw_item_name(item, dx, dy)
  296.         else
  297.           draw_masked_item_name(item, dx, dy)
  298.         end
  299.       end
  300.       # 成功率
  301.       if obj.success_prob > 0
  302.         text = sprintf("%d%%", obj.success_prob)
  303.       else
  304.         text = "1/#{obj.denominator}"
  305.       end
  306.       self.contents.draw_text(dx + dw, dy, 128, WLH, text, 2)
  307.       dy += WLH
  308.     }

  309.     return new_dy
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # ○ 说明文字描画
  313.   #     dx, dy : 描画先 X, Y
  314.   #--------------------------------------------------------------------------
  315.   def draw_description(dx, dy)
  316.     return unless KGC::Commands.enemy_defeated?(enemy.id)

  317.     dx += 4
  318.     enemy.enemy_guide_description.each_line { |line|
  319.       self.contents.draw_text(dx, dy, width - 32, WLH, line.chomp)
  320.       dy += WLH
  321.     }
  322.   end
  323. end

  324. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  325. #==============================================================================
  326. # ■ Scene_Map
  327. #==============================================================================

  328. class Scene_Map < Scene_Base
  329.   #--------------------------------------------------------------------------
  330.   # ● 实行画面的切换
  331.   #--------------------------------------------------------------------------
  332.   alias update_scene_change_KGC_EnemyGuide update_scene_change
  333.   def update_scene_change
  334.     return if $game_player.moving?    # 玩家的移动中?

  335.     if $game_temp.next_scene == :enemy_guide
  336.       call_enemy_guide
  337.       return
  338.     end

  339.     update_scene_change_KGC_EnemyGuide
  340.   end
  341.   #--------------------------------------------------------------------------
  342.   # ○ 切换到怪物图鉴
  343.   #--------------------------------------------------------------------------
  344.   def call_enemy_guide
  345.     $game_temp.next_scene = nil
  346.     $scene = Scene_EnemyGuide.new(0, Scene_EnemyGuide::HOST_MAP)
  347.   end
  348. end

  349. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  350. #==============================================================================
  351. # ■ Scene_Menu
  352. #==============================================================================

  353. class Scene_Menu < Scene_Base
  354.   if KGC::EnemyGuide::USE_MENU_ENEMY_GUIDE_COMMAND
  355.   #--------------------------------------------------------------------------
  356.   # ● 作成指令窗口
  357.   #--------------------------------------------------------------------------
  358.   alias create_command_window_KGC_EnemyGuide create_command_window
  359.   def create_command_window
  360.     create_command_window_KGC_EnemyGuide

  361.     return if $imported["CustomMenuCommand"]

  362.     @__command_enemy_guide_index =
  363.       @command_window.add_command(Vocab.enemy_guide)
  364.     if @command_window.oy > 0
  365.       @command_window.oy -= Window_Base::WLH
  366.     end
  367.     @command_window.index = @menu_index
  368.   end
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # ● 指令选择的更新
  372.   #--------------------------------------------------------------------------
  373.   alias update_command_selection_KGC_EnemyGuide update_command_selection
  374.   def update_command_selection
  375.     current_menu_index = @__command_enemy_guide_index
  376.     call_enemy_guide_flag = false

  377.     if Input.trigger?(Input::C)
  378.       case @command_window.index
  379.       when @__command_enemy_guide_index  # 怪物图鉴
  380.         call_enemy_guide_flag = true
  381.       end
  382.     end

  383.     # 移动到怪物图鉴
  384.     if call_enemy_guide_flag
  385.       Sound.play_decision
  386.       $scene = Scene_EnemyGuide.new(@__command_enemy_guide_index,
  387.         Scene_EnemyGuide::HOST_MENU)
  388.       return
  389.     end

  390.     update_command_selection_KGC_EnemyGuide
  391.   end
  392. end

  393. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  394. #==============================================================================
  395. # □ Scene_EnemyGuide
  396. #------------------------------------------------------------------------------
  397. #   进行怪物图鉴画面的处理的目录。
  398. #==============================================================================

  399. class Scene_EnemyGuide < Scene_Base
  400.   HOST_MENU   = 0
  401.   HOST_MAP    = 1
  402.   #--------------------------------------------------------------------------
  403.   # ● 对象初始化
  404.   #     menu_index  : 指令光标初期位置
  405.   #     host_scene  : 呼出原处 (0..菜单  1..地图)
  406.   #--------------------------------------------------------------------------
  407.   def initialize(menu_index = 0, host_scene = HOST_MENU)
  408.     @menu_index = menu_index
  409.     @host_scene = host_scene
  410.   end
  411.   #--------------------------------------------------------------------------
  412.   # ● 开始的处理
  413.   #--------------------------------------------------------------------------
  414.   def start
  415.     super
  416.     create_menu_background
  417.     if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
  418.       @back_sprite = Sprite.new
  419.       begin
  420.         @back_sprite.bitmap = Cache.system(KGC::EnemyGuide::BACKGROUND_FILENAME)
  421.       rescue
  422.         @back_sprite.bitmap = Bitmap.new(32, 32)
  423.       end
  424.     end

  425.     @top_window = Window_EnemyGuideTop.new
  426.     @enemy_window = Window_EnemyGuideList.new
  427.     @status_window = Window_EnemyGuideStatus.new
  428.     @status_window.enemy = @enemy_window.item
  429.   end
  430.   #--------------------------------------------------------------------------
  431.   # ● 退出场景
  432.   #--------------------------------------------------------------------------
  433.   def terminate
  434.     super
  435.     dispose_menu_background
  436.     if @back_sprite != nil
  437.       @back_sprite.bitmap.dispose
  438.       @back_sprite.dispose
  439.     end
  440.     @top_window.dispose
  441.     @enemy_window.dispose
  442.     @status_window.dispose
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # ○ 返回原菜单画面
  446.   #--------------------------------------------------------------------------
  447.   def return_scene
  448.     case @host_scene
  449.     when HOST_MENU
  450.       $scene = Scene_Menu.new(@menu_index)
  451.     when HOST_MAP
  452.       $scene = Scene_Map.new
  453.     end
  454.   end
  455.   #--------------------------------------------------------------------------
  456.   # ● 帧更新
  457.   #--------------------------------------------------------------------------
  458.   def update
  459.     super
  460.     update_menu_background
  461.     @top_window.update
  462.     @enemy_window.update
  463.     @status_window.update
  464.     if @enemy_window.active
  465.       update_enemy_selection
  466.     end
  467.   end
  468.   #--------------------------------------------------------------------------
  469.   # ○ 敌人选择的更新
  470.   #--------------------------------------------------------------------------
  471.   def update_enemy_selection
  472.     if @last_index != @enemy_window.index
  473.       @status_window.enemy = @enemy_window.item
  474.       @last_index = @enemy_window.index
  475.     end

  476.     if Input.trigger?(Input::B)
  477.       Sound.play_cancel
  478.       return_scene
  479.     elsif Input.trigger?(Input::A) || Input.trigger?(Input::C)
  480.       # sprte的表示切换
  481.       Sound.play_decision
  482.       @status_window.switch_sprite
  483.     elsif Input.trigger?(Input::LEFT)
  484.       # 参数表示
  485.       Sound.play_cursor
  486.       @status_window.shift_info_type(-1)
  487.     elsif Input.trigger?(Input::RIGHT)
  488.       # 说明表示
  489.       Sound.play_cursor
  490.       @status_window.shift_info_type(1)
  491.     end
  492.   end
  493. end
复制代码


‘‘──可可夏天于2012-5-23 00:06补充以下内容
  1. #==============================================================================
  2. # □ Window_EnemyGuideStatus
  3. #------------------------------------------------------------------------------
  4. #   在怪物图件上、表示简介的窗口。
  5. #==============================================================================

  6. class Window_EnemyGuideStatus < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 公开实例变量
  9.   #--------------------------------------------------------------------------
  10.   attr_reader   :enemy                    # 表示敌人
  11.   #--------------------------------------------------------------------------
  12.   # ● 对象初始化
  13.   #--------------------------------------------------------------------------
  14.   def initialize
  15.     super(240, 0, Graphics.width - 240, Graphics.height)
  16.     self.enemy = nil
  17.     self.z = 100
  18.     if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
  19.       self.opacity = 0
  20.     end
  21.     @show_sprite = false
  22.     @enemy_sprite = Sprite.new
  23.     @enemy_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  24.     @enemy_sprite.x = 0
  25.     @enemy_sprite.y = 0
  26.     @enemy_sprite.z = self.z + 100
  27.     @enemy_sprite.visible = false
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # ● 释放
  31.   #--------------------------------------------------------------------------
  32.   def dispose
  33.     super
  34.     @enemy_sprite.bitmap.dispose
  35.     @enemy_sprite.dispose
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ○ 物件页是否显示
  39.   #--------------------------------------------------------------------------
  40.   def item_page_show?
  41.     return true if KGC::EnemyGuide::SHOW_DROP_ITEM
  42.     return true if $imported["Steal"] && KGC::EnemyGuide::SHOW_STEAL_OBJ

  43.     return false
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ○ 取得页数
  47.   #--------------------------------------------------------------------------
  48.   def pages
  49.     return (item_page_show? ? 2 : 1)
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # ○ 表示敌人设定
  53.   #--------------------------------------------------------------------------
  54.   def enemy=(enemy)
  55.     @enemy = enemy
  56.     refresh
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ○ 更改显示的信息
  60.   #     shamt : 移动页
  61.   #--------------------------------------------------------------------------
  62.   def shift_info_type(shamt)
  63.     n = self.ox + (width - 32) * shamt
  64.     self.ox = [[n, 0].max, (width - 32) * (pages - 1)].min
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ○ sprite的表示切换
  68.   #--------------------------------------------------------------------------
  69.   def switch_sprite
  70.     @show_sprite = !@show_sprite
  71.     @enemy_sprite.visible = @show_sprite
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ● 更新
  75.   #--------------------------------------------------------------------------
  76.   def refresh
  77.     original_width = self.width
  78.     self.width = original_width * pages - (32 * (pages - 1))
  79.     create_contents
  80.     self.width = original_width

  81.     draw_enemy_sprite

  82.     return if enemy == nil

  83.     self.contents.font.color = normal_color
  84.     # 没有遭遇
  85.     unless KGC::Commands.enemy_encountered?(enemy.id)
  86.       self.contents.font.color.alpha = 128
  87.       dy = (height - 32) / 2
  88.       dy -= dy % WLH
  89.       self.contents.draw_text(0, dy, width - 32, WLH,
  90.         KGC::EnemyGuide::UNENCOUNTERED_DATA, 1)
  91.       self.contents.blt(width - 32, 0, self.contents, self.contents.rect)
  92.       return
  93.     end

  94.     draw_status
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ○ 简介的描绘
  98.   #--------------------------------------------------------------------------
  99.   def draw_status
  100.     # Page 1
  101.     dy = draw_basic_info(0, 0)
  102.     draw_description(0, dy)

  103.     # Page 2 (如果你只看到相关的项目)
  104.     if item_page_show?
  105.       dx = width - 32
  106.       dy = draw_basic_info(dx, 0)
  107.       max_rows = (self.height - dy - 32) / WLH
  108.       rows = (max_rows + 1) / (pages - 1)
  109.       dy = draw_drop_item(dx, dy, rows)
  110.       draw_steal_object(dx, dy, max_rows - rows)
  111.     end
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ○ 基本请报页
  115.   #     dx, dy : 描画先 X, Y
  116.   #--------------------------------------------------------------------------
  117.   def draw_basic_info(dx, dy)
  118.     draw_graphic(dx, dy)
  119.     draw_parameter1(dx + 112, dy)
  120.     return dy + 96
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ○ 图解的描绘
  124.   #     dx, dy : 描画先 X, Y
  125.   #--------------------------------------------------------------------------
  126.   def draw_graphic(dx, dy)
  127.     buf = Bitmap.new(108, 96)
  128.     bitmap = Cache.battler(enemy.battler_name, enemy.battler_hue)
  129.     rect = Rect.new(0, 0, bitmap.width / 3, bitmap.height / 3)
  130.     rect.x = (108 - rect.width) / 2
  131.     rect.y = (96 - rect.height) / 2
  132.     buf.stretch_blt(rect, bitmap, bitmap.rect)
  133.     self.contents.blt(dx, dy, buf, buf.rect)
  134.     buf.dispose
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ○ 敌人精灵的描画
  138.   #--------------------------------------------------------------------------
  139.   def draw_enemy_sprite
  140.     return if @enemy_sprite == nil

  141.     @enemy_sprite.bitmap.fill_rect(@enemy_sprite.bitmap.rect,
  142.       Color.new(0, 0, 0, 160))

  143.     return if enemy == nil || !KGC::Commands.enemy_encountered?(enemy.id)

  144.     bitmap = Cache.battler(enemy.battler_name, enemy.battler_hue)
  145.     dx = (Graphics.width - bitmap.width) / 2
  146.     dy = (Graphics.height - bitmap.height) / 2
  147.     @enemy_sprite.bitmap.blt(dx, dy, bitmap, bitmap.rect)
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ○ 参数的描画 - 1
  151.   #     dx, dy : 描画先 X, Y
  152.   #--------------------------------------------------------------------------
  153.   def draw_parameter1(dx, dy)
  154.     # 名前, HP, MP
  155.     param = {}
  156.     if KGC::Commands.enemy_defeated?(enemy.id)
  157.       param[:maxhp] = enemy.maxhp
  158.     else
  159.       param[:maxhp] = KGC::EnemyGuide::UNDEFEATED_PARAMETER
  160.     end

  161.     self.contents.font.color = normal_color
  162.     self.contents.draw_text(dx, dy, width - 144, WLH, enemy.name)
  163.     self.contents.font.color = system_color
  164.     self.contents.draw_text(dx, dy + WLH,     80, WLH, Vocab.hp)
  165.     self.contents.font.color = normal_color
  166.     self.contents.draw_text(dx + 88, dy + WLH,     64, WLH, param[:maxhp], 2)
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # ○ ICON目录的描画
  170.   #     dx, dy          : 描画处 X, Y
  171.   #     rows, cols      : 行列数
  172.   #     item_list       : 描画对象的目录
  173.   #     cond_proc       : 描画条件 Proc
  174.   #     index_proc      : ICON index 取得用 Proc
  175.   #--------------------------------------------------------------------------
  176.   def draw_icon_list(dx, dy, rows, cols, item_list, cond_proc, index_proc)
  177.     nc = 0  # 现在的列数
  178.     nr = 0  # 先在的行数
  179.     item_list.each { |item|
  180.       next if item == nil
  181.       next unless cond_proc.call(item)
  182.       icon_index = index_proc.call(item)
  183.       next if icon_index == nil || icon_index == 0

  184.       draw_icon(icon_index, dx + nc * 24, dy + nr * 24)
  185.       nc += 1
  186.       if nc == cols
  187.         # 次の行へ
  188.         nc = 0
  189.         nr += 1
  190.         break if nr == rows  # 行制限オーバー
  191.       end
  192.     }
  193.   end
  194.   #--------------------------------------------------------------------------
  195.   # ○ 战利品的描画
  196.   #     dx, dy : 描画先 X, Y
  197.   #     rows   : 行数
  198.   #--------------------------------------------------------------------------
  199.   def draw_drop_item(dx, dy, rows)
  200.     return dy unless KGC::EnemyGuide::SHOW_DROP_ITEM

  201.     new_dy = dy + WLH * rows
  202.     dw = (width - 32) / 2
  203.     self.contents.font.color = system_color
  204.     self.contents.draw_text(dx,      dy, 128, WLH,
  205.       KGC::EnemyGuide::PARAMETER_NAME[:treasure], 1)

  206.     return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)

  207.     # 列表
  208.     drop_items = [enemy.drop_item1, enemy.drop_item2]
  209.     if $imported["ExtraDropItem"]
  210.       drop_items += enemy.extra_drop_items
  211.     end

  212.     dy += WLH
  213.     count = 0
  214.     drop_items.each_with_index { |item, i|
  215.       # 物品名
  216.       case item.kind
  217.       when 0
  218.         next
  219.       when 1
  220.         drop_item = $data_items[item.item_id]
  221.       when 2
  222.         drop_item = $data_weapons[item.weapon_id]
  223.       when 3
  224.         drop_item = $data_armors[item.armor_id]
  225.       end
  226.       if KGC::Commands.enemy_item_dropped?(enemy.id, i)
  227.         draw_item_name(drop_item, dx, dy)
  228.       else
  229.         draw_masked_item_name(drop_item, dx, dy)
  230.       end
  231.       dy += WLH
  232.       count += 1
  233.       break if count == rows
  234.     }

  235.     return new_dy
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # ○ 物品名为遮挡的描画
  239.   #     item    : 物品 (机能、武器、防具都可以)
  240.   #     x       : 描画处 X 坐标
  241.   #     y       : 描画出 Y 坐标
  242.   #     enabled : 有効标志。false 的时候半透明的描画
  243.   #--------------------------------------------------------------------------
  244.   def draw_masked_item_name(item, x, y, enabled = true)
  245.     return if item == nil

  246.     draw_icon(item.icon_index, x, y, enabled)
  247.     self.contents.font.color = normal_color
  248.     self.contents.font.color.alpha = enabled ? 255 : 128
  249.     mask = KGC::EnemyGuide::UNDROPPED_ITEM_NAME
  250.     text = KGC.mask_string(item.name, mask)
  251.     self.contents.draw_text(x + 24, y, 172, WLH, text)
  252.   end
  253.   #--------------------------------------------------------------------------
  254.   # ○ 偷盗名为遮挡的描画
  255.   #     dx, dy : 描画先 X, Y
  256.   #     rows   : 行数
  257.   #--------------------------------------------------------------------------
  258.   def draw_steal_object(dx, dy, rows)
  259.     return dy unless $imported["Steal"] && KGC::EnemyGuide::SHOW_STEAL_OBJ

  260.     new_dy = dy + WLH * rows
  261.     dw = (width - 32) / 2
  262.     self.contents.font.color = system_color
  263.     self.contents.draw_text(dx,      dy, 128, WLH,
  264.       KGC::EnemyGuide::PARAMETER_NAME[:steal_obj], 1)
  265.     self.contents.draw_text(dx + dw, dy, 128, WLH,
  266.       KGC::EnemyGuide::PARAMETER_NAME[:steal_prob], 2)

  267.     return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)

  268.     # 列表
  269.     steal_objects = enemy.steal_objects.clone
  270.     if steal_objects.size >= rows
  271.       steal_objects = steal_objects[0...(rows - 1)]
  272.     end

  273.     dy += WLH
  274.     steal_objects.each_with_index { |obj, i|
  275.       if obj.kind == 4
  276.         # Gold
  277.         if KGC::Commands.enemy_object_stolen?(enemy.id, i)
  278.           text = sprintf("%d%s", obj.gold, Vocab.gold)
  279.         else
  280.           mask = KGC::EnemyGuide::UNDROPPED_ITEM_NAME
  281.           text = KGC.mask_string("aaa", mask)
  282.         end
  283.         self.contents.draw_text(dx + 24, dy, dw, WLH, text)
  284.       else
  285.         # Item
  286.         case obj.kind
  287.         when 1
  288.           item = $data_items[obj.item_id]
  289.         when 2
  290.           item = $data_weapons[obj.weapon_id]
  291.         when 3
  292.           item = $data_armors[obj.armor_id]
  293.         end
  294.         if KGC::Commands.enemy_object_stolen?(enemy.id, i)
  295.           draw_item_name(item, dx, dy)
  296.         else
  297.           draw_masked_item_name(item, dx, dy)
  298.         end
  299.       end
  300.       # 成功率
  301.       if obj.success_prob > 0
  302.         text = sprintf("%d%%", obj.success_prob)
  303.       else
  304.         text = "1/#{obj.denominator}"
  305.       end
  306.       self.contents.draw_text(dx + dw, dy, 128, WLH, text, 2)
  307.       dy += WLH
  308.     }

  309.     return new_dy
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # ○ 说明文字描画
  313.   #     dx, dy : 描画先 X, Y
  314.   #--------------------------------------------------------------------------
  315.   def draw_description(dx, dy)
  316.     return unless KGC::Commands.enemy_defeated?(enemy.id)

  317.     dx += 4
  318.     enemy.enemy_guide_description.each_line { |line|
  319.       self.contents.draw_text(dx, dy, width - 32, WLH, line.chomp)
  320.       dy += WLH
  321.     }
  322.   end
  323. end

  324. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  325. #==============================================================================
  326. # ■ Scene_Map
  327. #==============================================================================

  328. class Scene_Map < Scene_Base
  329.   #--------------------------------------------------------------------------
  330.   # ● 实行画面的切换
  331.   #--------------------------------------------------------------------------
  332.   alias update_scene_change_KGC_EnemyGuide update_scene_change
  333.   def update_scene_change
  334.     return if $game_player.moving?    # 玩家的移动中?

  335.     if $game_temp.next_scene == :enemy_guide
  336.       call_enemy_guide
  337.       return
  338.     end

  339.     update_scene_change_KGC_EnemyGuide
  340.   end
  341.   #--------------------------------------------------------------------------
  342.   # ○ 切换到怪物图鉴
  343.   #--------------------------------------------------------------------------
  344.   def call_enemy_guide
  345.     $game_temp.next_scene = nil
  346.     $scene = Scene_EnemyGuide.new(0, Scene_EnemyGuide::HOST_MAP)
  347.   end
  348. end

  349. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  350. #==============================================================================
  351. # ■ Scene_Menu
  352. #==============================================================================

  353. class Scene_Menu < Scene_Base
  354.   if KGC::EnemyGuide::USE_MENU_ENEMY_GUIDE_COMMAND
  355.   #--------------------------------------------------------------------------
  356.   # ● 作成指令窗口
  357.   #--------------------------------------------------------------------------
  358.   alias create_command_window_KGC_EnemyGuide create_command_window
  359.   def create_command_window
  360.     create_command_window_KGC_EnemyGuide

  361.     return if $imported["CustomMenuCommand"]

  362.     @__command_enemy_guide_index =
  363.       @command_window.add_command(Vocab.enemy_guide)
  364.     if @command_window.oy > 0
  365.       @command_window.oy -= Window_Base::WLH
  366.     end
  367.     @command_window.index = @menu_index
  368.   end
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # ● 指令选择的更新
  372.   #--------------------------------------------------------------------------
  373.   alias update_command_selection_KGC_EnemyGuide update_command_selection
  374.   def update_command_selection
  375.     current_menu_index = @__command_enemy_guide_index
  376.     call_enemy_guide_flag = false

  377.     if Input.trigger?(Input::C)
  378.       case @command_window.index
  379.       when @__command_enemy_guide_index  # 怪物图鉴
  380.         call_enemy_guide_flag = true
  381.       end
  382.     end

  383.     # 移动到怪物图鉴
  384.     if call_enemy_guide_flag
  385.       Sound.play_decision
  386.       $scene = Scene_EnemyGuide.new(@__command_enemy_guide_index,
  387.         Scene_EnemyGuide::HOST_MENU)
  388.       return
  389.     end

  390.     update_command_selection_KGC_EnemyGuide
  391.   end
  392. end

  393. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  394. #==============================================================================
  395. # □ Scene_EnemyGuide
  396. #------------------------------------------------------------------------------
  397. #   进行怪物图鉴画面的处理的目录。
  398. #==============================================================================

  399. class Scene_EnemyGuide < Scene_Base
  400.   HOST_MENU   = 0
  401.   HOST_MAP    = 1
  402.   #--------------------------------------------------------------------------
  403.   # ● 对象初始化
  404.   #     menu_index  : 指令光标初期位置
  405.   #     host_scene  : 呼出原处 (0..菜单  1..地图)
  406.   #--------------------------------------------------------------------------
  407.   def initialize(menu_index = 0, host_scene = HOST_MENU)
  408.     @menu_index = menu_index
  409.     @host_scene = host_scene
  410.   end
  411.   #--------------------------------------------------------------------------
  412.   # ● 开始的处理
  413.   #--------------------------------------------------------------------------
  414.   def start
  415.     super
  416.     create_menu_background
  417.     if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
  418.       @back_sprite = Sprite.new
  419.       begin
  420.         @back_sprite.bitmap = Cache.system(KGC::EnemyGuide::BACKGROUND_FILENAME)
  421.       rescue
  422.         @back_sprite.bitmap = Bitmap.new(32, 32)
  423.       end
  424.     end

  425.     @top_window = Window_EnemyGuideTop.new
  426.     @enemy_window = Window_EnemyGuideList.new
  427.     @status_window = Window_EnemyGuideStatus.new
  428.     @status_window.enemy = @enemy_window.item
  429.   end
  430.   #--------------------------------------------------------------------------
  431.   # ● 退出场景
  432.   #--------------------------------------------------------------------------
  433.   def terminate
  434.     super
  435.     dispose_menu_background
  436.     if @back_sprite != nil
  437.       @back_sprite.bitmap.dispose
  438.       @back_sprite.dispose
  439.     end
  440.     @top_window.dispose
  441.     @enemy_window.dispose
  442.     @status_window.dispose
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # ○ 返回原菜单画面
  446.   #--------------------------------------------------------------------------
  447.   def return_scene
  448.     case @host_scene
  449.     when HOST_MENU
  450.       $scene = Scene_Menu.new(@menu_index)
  451.     when HOST_MAP
  452.       $scene = Scene_Map.new
  453.     end
  454.   end
  455.   #--------------------------------------------------------------------------
  456.   # ● 帧更新
  457.   #--------------------------------------------------------------------------
  458.   def update
  459.     super
  460.     update_menu_background
  461.     @top_window.update
  462.     @enemy_window.update
  463.     @status_window.update
  464.     if @enemy_window.active
  465.       update_enemy_selection
  466.     end
  467.   end
  468.   #--------------------------------------------------------------------------
  469.   # ○ 敌人选择的更新
  470.   #--------------------------------------------------------------------------
  471.   def update_enemy_selection
  472.     if @last_index != @enemy_window.index
  473.       @status_window.enemy = @enemy_window.item
  474.       @last_index = @enemy_window.index
  475.     end

  476.     if Input.trigger?(Input::B)
  477.       Sound.play_cancel
  478.       return_scene
  479.     elsif Input.trigger?(Input::A) || Input.trigger?(Input::C)
  480.       # sprte的表示切换
  481.       Sound.play_decision
  482.       @status_window.switch_sprite
  483.     elsif Input.trigger?(Input::LEFT)
  484.       # 参数表示
  485.       Sound.play_cursor
  486.       @status_window.shift_info_type(-1)
  487.     elsif Input.trigger?(Input::RIGHT)
  488.       # 说明表示
  489.       Sound.play_cursor
  490.       @status_window.shift_info_type(1)
  491.     end
  492.   end
  493. end
复制代码

’’


‘‘──可可夏天于2012-5-23 00:07补充以下内容

@Raiku  拜托了
’’


‘‘──可可夏天于2012-5-23 22:37补充以下内容

这不是完整的吗= =
’’




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1