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

Project1

 找回密码
 注册会员
搜索

求一个能够将基础属性与综合属性分开的状态界面的方法...

查看数: 1357 | 评论数: 2 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2022-4-3 12:10

正文摘要:

本帖最后由 周君休佚 于 2022-4-3 12:17 编辑 如截图中的,默认物攻是(基础力量+武器攻击力),需要一个能够单独显示基础力量的脚本来识别各职业或角色当前的强度,来决定使用哪位角色。每次对比都要脱下装备, ...

回复

周君休佚 发表于 2022-4-3 13:16:17
#encoding:utf-8
#==============================================================================
# ■ Window_EquipStatus
#------------------------------------------------------------------------------
#  装备画面中,显示角色能力值变化的窗口。
#==============================================================================

class Window_EquipStatus < Window_Base
  #  0 最大HP          Maximum Hit Point
  #  1 最大MP          Maximum Magic Point
  #  2 物理攻击        ATtacK power
  #  3 物理防御        DEFense power
  #  4 魔法攻击        Magic ATtack power
  #  5 魔法防御        Magic DeFense power
  #  6 敏 捷 值        AGIlity
  #  7 幸 运 值        LUcK
  # x0 成功几率        HIT rate
  # x1 闪避几率        EVAsion rate
  # x2 必杀几率        CRItical rate
  # x3 闪避必杀几率    Critical EVasion rate
  # x4 闪避魔法几率    Magic EVasion rate
  # x5 反射魔法几率    Magic ReFlection rate
  # x6 反击几率        CouNTer attack rate
  # x7 HP再生速度      Hp ReGeneration rate
  # x8 MP再生速度      Mp ReGeneration rate
  # x9 TP再生速度      Tp ReGeneration rate
  # s0 受到攻击的几率  TarGet Rate
  # s1 防御效果比率    GuaRD effect rate
  # s2 恢复效果比率    RECovery effect rate
  # s3 药理知识        PHArmacology
  # s4 MP消费率        Mp Cost Rate
  # s5 TP消耗率        Tp Charge Rate
  # s6 物理伤害加成    Physical Damage Rate
  # s7 魔法伤害加成    Magical Damage Rate
  # s8 地形伤害加成    Floor Damage Rate
  # s9 经验获得加成    EXperience Rate

  Params = [
            ["攻击力", "actor.param(2)"],
            ["防御力", "actor.param(3)"],
            ["力量", "actor.param(2) - $game_actors[actor.id].weapons[0].params[2]"],
            ["智慧", "actor.param(4)"],
            ["精神", "actor.param(5)"],
            ["速度", "actor.param(6)"],
            ["幸运", "actor.param(7)"],
            ["命中率", "actor.xparam(0) * 100"],
            ["暴击率", "actor.xparam(2) * 100"],
            ["回避率", "actor.xparam(1) * 100"],

            ["反击率", "actor.xparam(6) * 100"],
            ["反射", "actor.xparam(5) * 100"],
            ["恢复", "actor.sparam(3) * 100"],
            ["威胁", "actor.sparam(0) * 100"],
           ]
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize(x, y, height)
    super(x, y, window_width, height)
    @actor = nil
    @temp_actor = nil
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 获取显示行数
  #--------------------------------------------------------------------------
  def visible_line_number
    return Params.size
  end

  #--------------------------------------------------------------------------
  # ● 获取行高
  #--------------------------------------------------------------------------
  def line_height
    return contents.font.size
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    y = 0
    contents.clear
    contents.font.size = 20
    if @actor
      draw_actor_name(@actor, 4, 0)
      y += line_height
    end
    contents.font.size = 20 #字体大小
    Params.each {|i| draw_item(0, y, i); y += line_height }
  end
  #--------------------------------------------------------------------------
  # ● 绘制能力值的名字
  #--------------------------------------------------------------------------
  def draw_param_name(x, y, param_name)
    change_color(system_color)
    draw_text(x, y, 80, line_height, param_name)
  end
  #---------------------------------------------------------------------
  # ● 计算能力值 by orzFly
  #--------------------------------------------------------------------------
  def calc_param(actor, param_formal)
   
    Kernel.eval(param_formal).to_i rescue actor.param(2)
  end

  #--------------------------------------------------------------------------
  # ● 绘制当前能力值
  #--------------------------------------------------------------------------
  def draw_current_param(x, y, param_id)
    change_color(normal_color)
    draw_text(x, y, 42, line_height, calc_param(@actor, param_id), 2)
  end

  #--------------------------------------------------------------------------
  # ● 绘制更换装备后的能力值
  #--------------------------------------------------------------------------
  def draw_new_param(x, y, param_id)
    new_value = calc_param(@temp_actor, param_id)
    change_color(param_change_color(new_value - calc_param(@actor, param_id)))
    draw_text(x, y, 42, line_height, new_value, 2)
  end
  #--------------------------------------------------------------------------
  # ● 绘制项目
  #--------------------------------------------------------------------------
  def draw_item(x, y, param)
    draw_param_name(x , y, param[0])
    draw_current_param(x + 55, y, param[1]) if @actor
    draw_right_arrow(x + 100, y)
    draw_new_param(x + 120, y, param[1]) if @temp_actor
  end
end

#==============================================================================

# ■ Window_EquipItem
#------------------------------------------------------------------------------
#  装备画面中,显示可替换装备的窗口。(下部选择框中的列数)
#==============================================================================

class Window_EquipItem < Window_ItemList
  def col_max
    return 2
  end
end

#==============================================================================
# ■ Scene_Equip
#------------------------------------------------------------------------------
#  装备画面
#==============================================================================

class Scene_Equip < Scene_MenuBase

  #--------------------------------------------------------------------------
  # ● 生成状态窗口(可调整字体)
  #--------------------------------------------------------------------------
  def create_status_window
        Font.default_size = 20
    @status_window = Window_EquipStatus.new(0, @help_window.height,
                                       Graphics.height - @help_window.height)
    @status_window.viewport = @viewport
    @status_window.actor = @actor
  end
  #--------------------------------------------------------------------------
  # ● 生成物品窗口(可调整字体)
  #--------------------------------------------------------------------------
  def create_item_window
    Font.default_size = 20
    wx = @status_window.width
    wy = @slot_window.y + @slot_window.height
    ww = Graphics.width - @status_window.width
    wh = Graphics.height - wy
    @item_window = Window_EquipItem.new(wx, wy, ww, wh)
    @item_window.viewport = @viewport
    @item_window.help_window = @help_window
    @item_window.status_window = @status_window
    @item_window.actor = @actor
    @item_window.set_handler(:ok,     method(:on_item_ok))
    @item_window.set_handler(:cancel, method(:on_item_cancel))
    @slot_window.item_window = @item_window
  end
end





依葫芦画瓢“力量”那的公式,
改成下面的:
["力量", "actor.param(2) - $game_actors[actor.id].equips[0].params[2]"],
["体力", "actor.param(3) - $game_actors[actor.id].equips[0].params[3]"],
没成功,请问应该是什么公式?
周君休佚 发表于 2022-4-3 12:16:47
……………………呃呃呃呃呃呃,无法上传图片……一上传就提示非法字符,离谱。。。
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

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

GMT+8, 2024-9-22 18:18

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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