查看: 90|回复: 0

[转载发布] “字符串”技能树

[复制链接]
  • TA的每日心情
    开心
    7 天前
  • 签到天数: 37 天

    连续签到: 3 天

    [LV.5]常住居民I

    2028

    主题

    32

    回帖

    7260

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    0
    卡币
    5184
    OK点
    16
    积分
    7260
    发表于 同元一千年八月四日(秋) | 显示全部楼层 |阅读模式
    源自:http://rpg.blue/thread-336098-1-1.html



    看似很复杂,其实很简单。



    脚本参考,当然要自行做一些整合

    选择窗口
    1. # --------------------  # 重要!!!!!!!!  # --------------------  attr_accessor :skill_case  attr_accessor :shuzhi_hash复制代码
    复制代码
    初始化
    1. # --------------------    # 重要!!!!!!!!    # --------------------        # 判断选择状态用的哈希表    @skill_case = {}        # 树枝的哈希表    @shuzhi_hash = {}复制代码
    复制代码
    添加
    1. # ------------------    # 描绘图标与树枝    # ------------------        # 循环准备    xunhuan_time = 0        jineng_time = 0        # 简化    #@shuzhi_array.size - 1    #@shuzhi_array[jianqu1].split(/◎/)[0].to_i          jianqu1 = @shuzhi_array.size - 1    jxmh = @shuzhi_array[jianqu1].split(/◎/)[0].to_i        # 矩形    rect = Rect.new(0, 0, 24, 24)          # 循环    for i in @shuzhi_array      # 坐标      x = (xunhuan_time % jxmh) * 32 + 4      y = (xunhuan_time / jxmh) * 32 + 4      # 不等与"☆"描绘      if i != "☆"        case i        # 技能图标        when "★"          # 图标透明度          unless @actor.skills.include?(@skill[jineng_time].id)            opacity_icon = 160          else            opacity_icon = 255          end          self.contents.blt(x, y, @icon[jineng_time], rect, opacity_icon)          # 以XY坐标为主键技能为值          @skill_case[x.to_s+"◎"+y.to_s] = @skill[jineng_time]          jineng_time += 1        # 树枝        when "→"          self.contents.blt(x, y, @shuzhi_picture[0], rect)          # 以XY坐标为主键方向字符为值          @shuzhi_hash[x.to_s+"◎"+y.to_s] = "→"        when "←"          self.contents.blt(x, y, @shuzhi_picture[1], rect)          # 以XY坐标为主键方向字符为值          @shuzhi_hash[x.to_s+"◎"+y.to_s] = "←"        when "↑"          self.contents.blt(x, y, @shuzhi_picture[2], rect)          # 以XY坐标为主键方向字符为值          @shuzhi_hash[x.to_s+"◎"+y.to_s] = "↑"        when "↓"          self.contents.blt(x, y, @shuzhi_picture[3], rect)          # 以XY坐标为主键方向字符为值          @shuzhi_hash[x.to_s+"◎"+y.to_s] = "↓"        when "↖"          self.contents.blt(x, y, @shuzhi_picture[4], rect)          # 以XY坐标为主键方向字符为值          @shuzhi_hash[x.to_s+"◎"+y.to_s] = "↖"        when "↗"          self.contents.blt(x, y, @shuzhi_picture[5], rect)          # 以XY坐标为主键方向字符为值          @shuzhi_hash[x.to_s+"◎"+y.to_s] = "↗"        when "↘"          self.contents.blt(x, y, @shuzhi_picture[6], rect)          # 以XY坐标为主键方向字符为值          @shuzhi_hash[x.to_s+"◎"+y.to_s] = "↘"        when "↙"          self.contents.blt(x, y, @shuzhi_picture[7], rect)          # 以XY坐标为主键方向字符为值          @shuzhi_hash[x.to_s+"◎"+y.to_s] = "↙"        end      end      # 项目判断      xunhuan_time += 1    end复制代码
    复制代码
    帮助刷新
    1. # 刷新帮助  def update_help            # 为了刷新,就只好牺牲内存了        # 判断    #if self.index != @old_index      # 隐藏帮助      @help_window.visible = false      # 简化写法      jianqu1 = @shuzhi_array.size - 1      jxmh = @shuzhi_array[jianqu1].split(/◎/)[0].to_i      # 帮助坐标      x = (self.index % jxmh) * 32      y = (self.index / jxmh) * 32      # 循环      for i in @skill_case.keys        # 判断        if i == (x+4).to_s+"◎"+(y+4).to_s          @help_window.set_text(          x + 50, y, @skill_case[(x+4).to_s+"◎"+(y+4).to_s], @actor)        end      end    #  @old_index = self.index    #end      end复制代码
    复制代码
    [code]  # 刷新选择窗口  def update_select_window    # B键的按下    if Input.trigger?(Input::B)      $scene = Scene_Map.new    end    # C键的按下    if Input.trigger?(Input::C)            # 获取坐标,以坐标为媒介(主键)获取相关信息            # 坐标      jianqu1 = SHEZHI::ACTOR_ARRAY[@actor.id].size - 1      jxmh = SHEZHI::ACTOR_ARRAY[@actor.id][jianqu1].split(/◎/)[0].to_i             x = (@select_window.index % jxmh) * 32 + 4      y = (@select_window.index / jxmh) * 32 + 4            # 判断是否选中技能      if @select_window.skill_case[x.to_s+"◎"+y.to_s] != nil        # 简化,方便之后使用skill值        skill = @select_window.skill_case[x.to_s+"◎"+y.to_s]        # 判断技能是否已经领悟        unless @actor.skills.include?(skill)          # ------------------          # 判断技能树关系          # (判断基础技能是否学习)          # ------------------          # 连接线:→←↑↓↖↗↘↙          # ------------------                    # 判断准备          base_skill_array = []                    # 左边:          x_copy = x - 32          y_copy = y                    if @select_window.shuzhi_hash[x_copy.to_s+"◎"+y_copy.to_s] != nil            # 简化            shuzhi = @select_window.shuzhi_hash[x_copy.to_s+"◎"+y_copy.to_s]            # 分歧            if shuzhi == "→"              # 获得基础技能坐标              x_copy = x - 64              y_copy = y              # 简化,通过基础技能坐标获取基础技能              base = @select_window.skill_case[x_copy.to_s+"◎"+y_copy.to_s]              base_skill_array
    天天去同能,天天有童年!
    回复 论坛版权

    使用道具 举报

    ahome_bigavatar:guest
    ahome_bigavatar:welcomelogin
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2024-5-17 17:42 , Processed in 0.047868 second(s), 43 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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