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

Project1

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

[已经解决] 人物属性加点与技能加点冲突

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1206
在线时间
561 小时
注册时间
2014-11-30
帖子
155
跳转到指定楼层
1
发表于 2015-6-6 15:41:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 309988769 于 2015-6-6 15:48 编辑

RUBY 代码复制
  1. #encoding:utf-8
  2. #=============================================================================
  3. #-----------RMVA加点系统正常向-v1.01---By:救世小树--------转载请注明出处-------
  4. #=============================================================================
  5.  
  6. module Point_Tree
  7.  
  8.   POINT_VARIABLE = 34
  9.   POINT_KIND     = 4             #设定加点种类
  10.   #储存属性点的变量编号是34+角色id*(6+1),
  11.   #即41号变量为一号角色自由点;42号起6个变量为1号角色6个种类的已加点值
  12.  
  13.   LEVEL_UP_POINT = 1
  14.   #每升一级属性点增加数
  15.  
  16.   RESET_ITEM     = 20   #洗点水编号
  17.  
  18.   STR_POINT        = ["武力","谋略","政治","兵法"]#,"韧性","灵活","???"]
  19.   #分别对应增加       [MHP,MMP,物攻,物防,魔攻,魔防,敏捷,幸运]
  20.   POINT_ADD_PARAM = [[0 ,  0,   12,  0,   0,   0,   0,   0],     #体力
  21.                      [0  , 0,   0,  0,   12,   0,   0,   0],     #精神
  22.                      [0  ,  0,   0,  9,   0,   9,   0,   0],     #力量
  23.                      [0  ,  0,   0,  0,   0,   0,   15,   0],     #魔力
  24. #~                      [0  ,  0,   0,  0,   0,   0,   0,   0],     #韧性
  25. #~                      [0  ,  0,   0,  0,   0,   0,   0,   0],     #灵活
  26.  
  27. #~                      [0,0,0,0,0,0,0,0]
  28.                     ]
  29.                      #可以按上面的格式添加下去,不过要改POINT_KIND,STR_ALL,不然加了也白加
  30.  
  31.   #分别对应增加       [物理命中,物理闪避,必杀,必杀闪避,魔法闪避,魔法反射,物理反击,HP再生,Mp再生,Tp再生]
  32.   POINT_ADD_XPARAM = [[0 , 0, 0, 0, 0, 0, 0, 0, 0, 0],
  33.                       [0 , 0, 0, 0, 0, 0, 0, 0, 0, 0],
  34.                       [0 , 0, 0, 0, 0, 0, 0, 0, 0, 0],
  35.                       [0 , 0, 0, 0, 0, 0, 0, 0, 0, 0],
  36. #~                       [0 , 0, 0, 0, 0, 0, 0, 0, 0, 0],
  37. #~                       [0 , 0, 0, 0, 0, 0, 0, 0, 0, 0],
  38. #~                     
  39. #~                       [0,0,0,0,0,0,0,0,0,0]
  40.                      ]
  41.                      #这里的单位是万分之一数值也就是0.01%,我随便填了下【别嫌小,够大了,有心情你可以算算看平衡性】
  42.  
  43.   #各种名称
  44.   ADDPOINT       = "加点"   #菜单中选项
  45.  
  46.   POINT_NAME     = "属性点" #未分配点数
  47.  
  48.   XARAM_NAME     = ["物理命中","物理闪避","暴击几率","暴击闪避","魔法闪避","魔法反射","物理反击","兵力回复率","气力回复率","怒气上升率"]
  49.   def reset(actor_id)       #洗点
  50.     for i in 1..6
  51.       $game_variables[actor_id*(POINT_KIND+1) + POINT_VARIABLE]+=$game_variables[actor_id*(POINT_KIND+1) + POINT_VARIABLE+i]
  52.       $game_variables[actor_id*(POINT_KIND+1) + POINT_VARIABLE+i]=0
  53.     end
  54.   end
  55.  
  56.   def temp_all
  57.     r = 0
  58.     for i in 0 .. POINT_KIND-1
  59.       r+=$temp_point[i]
  60.     end
  61.     return r
  62.   end
  63.  
  64.   def point_add_param(actor_id)
  65.     case actor_id
  66.     when 1
  67.       #分别对应增加       [MHP,MMP,物攻,物防,魔攻,魔防,敏捷,幸运]
  68.       return [[0 ,  0,   12,  0,   0,   0,   0,   0],     #体力
  69.               [0  , 0,   0,  0,   12,   0,   0,   0],     #精神
  70.               [0  ,  0,   0,  9,   0,   9,   0,   0],     #力量
  71.               [0  ,  0,   0,  0,   0,   0,   15,   0],     #魔力
  72.              ]
  73.     else
  74.       return POINT_ADD_PARAM
  75.     end
  76.   end
  77.  
  78.   def point_add_xparam(actor_id)
  79.     case actor_id
  80.     when 1
  81.       #分别对应增加 [物理命中,物理闪避,必杀,必杀闪避,魔法闪避,魔法反射,物理反击,HP再生,Mp再生,Tp再生]
  82.       return [[0 , 0, 0, 0, 0, 0, 0, 0, 0, 0],
  83.               [0 , 0, 0, 0, 0, 0, 0, 0, 0, 0],
  84.               [0 , 0, 0, 0, 0, 0, 0, 0, 0, 0],
  85.               [0 , 0, 0, 0, 0, 0, 0, 0, 0, 0],
  86.              ]
  87.     else
  88.       return POINT_ADD_XPARAM
  89.     end
  90.   end
  91. end
  92. $temp_point = []
  93. for i in 0 .. Point_Tree::POINT_KIND-1
  94.   $temp_point.push(0)
  95. end
  96.  
  97. class Game_Actor < Game_Battler
  98.   include Point_Tree
  99.   alias level_up_tre level_up
  100.   def level_up
  101.     level_up_tre
  102.     @hp += mhp
  103.     @mp += mmp
  104.     $game_variables[self.id*(POINT_KIND+1) + POINT_VARIABLE] += LEVEL_UP_POINT
  105.   end
  106.   def point_plus(param_id)
  107.     r=0
  108.     for i in 0 .. POINT_KIND-1
  109.       r+=$game_variables[self.id*(POINT_KIND+1) + POINT_VARIABLE+i+1]*point_add_param(@actor_id)[i][param_id]
  110.     end
  111.     return r
  112.   end
  113.  
  114.   alias point_base_param param
  115.  
  116.   def param(param_id)
  117.     value = param_base(param_id) + param_plus(param_id) + point_plus(param_id)
  118.     value *= param_rate(param_id) * param_buff_rate(param_id)
  119.     [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
  120.   end
  121.   def xparam(xparam_id)
  122.     xp = super(xparam_id)
  123.     for i in 0 .. POINT_KIND-1
  124.       xp+=($game_variables[self.id*(POINT_KIND+1) + POINT_VARIABLE+i+1]*point_add_xparam(@actor_id)[i][xparam_id]/10000.0)
  125.     end
  126.     return xp
  127.   end
  128.   def item_apply(user, item)
  129.     super(user, item)
  130.     if item.id == RESET_ITEM and item.is_a?(RPG::Item)
  131.       reset(@actor_id)
  132.       self.hp = [self.hp,self.mhp].min
  133.       self.mp = [self.mp,self.mmp].min
  134.     end
  135.   end
  136. end
  137.  
  138. class Window_Point_Command < Window_Command
  139.  
  140.   include Point_Tree
  141.   #--------------------------------------------------------------------------
  142.   # ● 初始化指令选择位置(类方法)
  143.   #--------------------------------------------------------------------------
  144.   def self.init_command_position
  145.     @@last_command_symbol = nil
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● 初始化对象
  149.   #--------------------------------------------------------------------------
  150.   def initialize(actor)
  151.     @status_window = nil
  152.     @actor = actor
  153.     super(0,0)
  154.     select_last
  155.   end
  156.   def actor=(actor)
  157.     return if @actor == actor
  158.     @actor = actor
  159.     refresh
  160.   end
  161.   def status_window=(status_window)
  162.     return if @status_window == status_window
  163.     @status_window = status_window
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 获取窗口的宽度
  167.   #--------------------------------------------------------------------------
  168.   def window_width
  169.     return 160
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● 获取显示行数
  173.   #--------------------------------------------------------------------------
  174.   def visible_line_number
  175.     item_max
  176.   end
  177.   def get_actor_point(id)
  178.     s = $game_variables[@actor.id*(POINT_KIND+1)+POINT_VARIABLE+id+1].to_s
  179.     return "("+s+")+"+$temp_point[id].to_s
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ● 生成指令列表
  183.   #--------------------------------------------------------------------------
  184.   def make_command_list
  185.     for i in 0 .. POINT_KIND-1
  186.       add_command(STR_POINT[i]   + get_actor_point(i)  , :point_add  ,add_enabled)
  187.     end
  188.     add_command("确定",  :point_ok)
  189.     add_command("取消",  :point_cancle)
  190.   end
  191.   #--------------------------------------------------------------------------
  192.   # ● 按下确定键时的处理
  193.   #--------------------------------------------------------------------------
  194.   def process_ok
  195.     @@last_command_symbol = current_symbol
  196.     super
  197.   end
  198.   #--------------------------------------------------------------------------
  199.   # ● 返回最后一个选项的位置
  200.   #--------------------------------------------------------------------------
  201.   def select_last
  202.     select_symbol(@@last_command_symbol)
  203.   end
  204.  
  205.   def add_enabled
  206.     temp_all < $game_variables[@actor.id*(POINT_KIND+1) + POINT_VARIABLE]
  207.   end
  208.  
  209.   def update_help
  210.     @help_window.set_text(self.index+1) if @help_window
  211.     @status_window.index = self.index if @status_window
  212.   end
  213.  
  214.   #--------------------------------------------------------------------------
  215.   # ● 光标向左移动
  216.   #--------------------------------------------------------------------------
  217.   def cursor_left(param)
  218.     call_handler(:LEFT)
  219.   end
  220.   #--------------------------------------------------------------------------
  221.   # ● 光标向右移动
  222.   #--------------------------------------------------------------------------
  223.   def cursor_right(param)
  224.     call_handler(:RIGHT)
  225.   end
  226. end
  227.  
  228. if !ADJUST_X
  229. #帮助窗口
  230. class Window_Point_Help < Window_Base
  231.   include Point_Tree
  232.   def initialize(x,y,w,h)
  233.     super(x, y, w, h)
  234.   end
  235.  
  236.   def set_text(id)
  237.     contents.clear
  238.     if id <= POINT_KIND
  239.       text = "\\}提升一点该属性"
  240.     elsif id == POINT_KIND+1
  241.       text = "\\}确认此次加点分配"
  242.     elsif  id == POINT_KIND+2
  243.       text = "\\}取消此次加点分配"
  244.     end
  245.     draw_text_ex(8, 8, text)
  246.   end
  247. end
  248. end
  249.  
  250.  
  251. #角色状态窗口
  252. class Window_Point_Actor < Window_Base
  253.   include Point_Tree
  254.  
  255.  
  256.   def initialize(actor)
  257.     super(160, 0, Graphics.width - 160, Graphics.height)
  258.     @actor = actor
  259.     @index = 0
  260.     refresh
  261.   end
  262.   def actor=(actor)
  263.     return if @actor == actor
  264.     @actor = actor
  265.     refresh
  266.   end
  267.   def index=(index)
  268.     return if @index == index
  269.     @index = index
  270.     refresh
  271.   end
  272.   def line_height
  273.     return 24
  274.   end
  275.   def refresh
  276.     contents.clear
  277.     contents.font.size = 32
  278.     draw_actor_name(@actor, 100, 0)
  279.     draw_actor_class(@actor, 240, 0)
  280.     draw_actor_face(@actor, 2, 0)
  281.     contents.font.size = 20
  282.     draw_actor_level(@actor, 102,  24)
  283.     draw_actor_point(100,48)
  284.     contents.font.size = 16
  285.     draw_actor_param_point(8,16 * 6)
  286.     draw_actor_xparam_point(8,16 * 14)
  287.     draw_text(8,100,172,24,"←→:切换角色")
  288.   end
  289.   def draw_actor_point(x,y)
  290.     draw_text(x,y,200,line_height,"  未分配"+POINT_NAME + ":" + $game_variables[@actor.id*(POINT_KIND+1) + POINT_VARIABLE].to_s)
  291.     draw_text(x,y+line_height,200,line_height,"此次分配"+POINT_NAME + ":" + temp_all.to_s)
  292.   end
  293.   def draw_actor_param_point(x,y)
  294.     8.times {|i| draw_actor_param_to_s(x,y,i)}
  295.   end
  296.   def draw_actor_xparam_point(x,y)
  297.     10.times {|i| draw_actor_xparam_to_s(x,y,i)}
  298.   end
  299.  
  300.   def draw_actor_param_to_s(x,y,param_id)
  301.     a=0
  302.     for i in 0 .. POINT_KIND-1
  303.       a+=$temp_point[i]*point_add_param(@actor.id)[i][param_id]
  304.     end
  305.     s1 = Vocab::param(param_id)
  306.     s2 = @actor.param(param_id).to_s
  307.     s3 = (@actor.param(param_id) + a).to_s
  308.     if @index < POINT_KIND
  309.       if point_add_param(@actor.id)[@index][param_id]==0
  310.         s4 = ""
  311.       else
  312.         s4 = "+" + point_add_param(@actor.id)[@index][param_id].to_s
  313.       end
  314.     else
  315.       s4 = ""
  316.     end
  317.  
  318.     change_color(system_color)
  319.     draw_text(x,y+16*param_id,100,line_height,s1)
  320.     change_color(normal_color)
  321.     s2+= " →"
  322.     draw_text(x+82,y+16*param_id,120,line_height,s2,2)
  323.     contents.font.color = Color.new(0,255,0)
  324.     draw_text(x+150,y+16*param_id,100,line_height,s3,2)
  325.     contents.font.color = Color.new(0,255,0)
  326.     contents.font.size = 14
  327.     draw_text(x+266,y+16*param_id,100,line_height,s4,2)
  328.     contents.font.size = 16
  329.   end
  330.  
  331.   def draw_actor_xparam_to_s(x,y,xparam_id)
  332.     a=0.00
  333.     for i in 0 .. POINT_KIND-1
  334.       a+=($temp_point[i]*point_add_xparam(@actor.id)[i][xparam_id]/10000.0)
  335.     end
  336.     s1 = XARAM_NAME[xparam_id]
  337.     s2 = sprintf("%03.2f%%",@actor.xparam(xparam_id)*100)
  338.     s3 = sprintf("%03.2f%%",(@actor.xparam(xparam_id) + a)*100)
  339.  
  340.     if @index < POINT_KIND
  341.       if point_add_xparam(@actor.id)[@index][xparam_id]==0
  342.         s4=""
  343.       else
  344.         s4 = sprintf("+%03.2f%%",point_add_xparam(@actor.id)[@index][xparam_id]/100.0)
  345.       end
  346.     else
  347.       s4 = ""
  348.     end
  349.  
  350.     change_color(system_color)
  351.     draw_text(x,y+16*xparam_id,100,line_height,s1)
  352.     change_color(normal_color)
  353.     s2+= " →"
  354.     draw_text(x+82,y+16*xparam_id,150,line_height,s2,2)
  355.     change_color(system_color)
  356.     draw_text(x+150,y+16*xparam_id,120,line_height,s3,2)
  357.     change_color(normal_color)
  358.     contents.font.size = 14
  359.     draw_text(x+266,y+16*xparam_id,100,line_height,s4)
  360.     contents.font.size = 16
  361.  
  362.   end
  363. end
  364.  
  365. class Scene_Point < Scene_MenuBase
  366.   include Point_Tree
  367.   def start
  368.     super
  369.     Window_Point_Command::init_command_position
  370.     create_background
  371.     @actor = $game_party.menu_actor
  372.     create_command_window
  373.     create_status_window
  374.     create_help_window
  375.     @command_window.activate
  376.   end
  377.   def terminate
  378.     super
  379.     dispose_background
  380.   end
  381.  
  382.   def create_command_window
  383.     @command_window = Window_Point_Command.new(@actor)
  384.     @command_window.set_handler(:cancel,      method(:return_scene))
  385.     @command_window.set_handler(:RIGHT,    method(:next_actor))
  386.     @command_window.set_handler(:LEFT,      method(:prev_actor))
  387.     @command_window.set_handler(:point_add,   method(:add_point))
  388.     @command_window.set_handler(:point_ok,    method(:add_ok))
  389.     @command_window.set_handler(:point_cancle,method(:add_cancle))
  390.  
  391.   end
  392.   def return_scene
  393.     add_cancle
  394.     SceneManager.return
  395.   end
  396.   def create_status_window
  397.     @status_window = Window_Point_Actor.new(@actor)
  398.     @command_window.status_window = @status_window
  399.   end
  400.   def create_help_window
  401.     @help_window = Window_Point_Help.new(0,@command_window.height,160,[email]Graphics.height-@command_window.height[/email])
  402.     @help_window.viewport = @viewport
  403.     @command_window.help_window = @help_window
  404.   end
  405.  
  406.   def add_point
  407.     if temp_all >= $game_variables[@actor.id*(POINT_KIND+1) + POINT_VARIABLE]
  408.       @command_window.activate
  409.       return
  410.     end
  411.     $temp_point[@command_window.index] += 1
  412.     @status_window.refresh
  413.     @command_window.refresh
  414.     @command_window.activate
  415.   end
  416.  
  417.  
  418.   def add_ok
  419.     for i in 0 .. POINT_KIND-1
  420.       $game_variables[@actor.id*(POINT_KIND+1) + POINT_VARIABLE+i+1] += $temp_point[i]
  421.     end
  422.     $game_variables[@actor.id*(POINT_KIND+1) + POINT_VARIABLE] -= temp_all
  423.     add_cancle
  424.   end
  425.  
  426.   def add_cancle
  427.     for i in 0 .. POINT_KIND-1
  428.       $temp_point[i]=0
  429.     end
  430.     @status_window.refresh
  431.     @command_window.refresh
  432.     @command_window.activate
  433.   end
  434.  
  435.  
  436.   def next_actor
  437.     @actor = $game_party.menu_actor_next
  438.     on_actor_change
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # ● 切换到上一个角色
  442.   #--------------------------------------------------------------------------
  443.   def prev_actor
  444.     @actor = $game_party.menu_actor_prev
  445.     on_actor_change
  446.   end
  447.   #--------------------------------------------------------------------------
  448.   # ● 切换角色
  449.   #--------------------------------------------------------------------------
  450.   def on_actor_change
  451.     add_cancle
  452.     @status_window.actor = @actor
  453.     @command_window.actor = @actor
  454.     @command_window.activate
  455.   end
  456.  
  457.  
  458. end
  459.  
  460. class Window_MenuCommand < Window_Command
  461.   alias add_original_commands_old add_original_commands
  462.   def add_original_commands
  463.     add_original_commands_old
  464.     add_command(Point_Tree::ADDPOINT,    :addpoint)
  465.   end
  466. end
  467.  
  468. class Scene_Menu < Scene_MenuBase
  469.   alias create_command_window_old create_command_window
  470.   def create_command_window
  471.     create_command_window_old
  472.     @command_window.set_handler(:addpoint,method(:on_ok))
  473.   end
  474.   def on_ok
  475.     SceneManager.call(Scene_Point)
  476.   end
  477. end
  478.  
  479.  
  480.  
  481. class Scene_ItemBase < Scene_MenuBase
  482.   def item_usable?
  483.     if item.id == Point_Tree::RESET_ITEM
  484.       return true
  485.     end
  486.     user.usable?(item) && item_effects_valid?
  487.   end
  488. end
  489.  
  490. #==============================================================================
  491. #
  492. # ▼ 以下为我的修改,主要为了适应1024*576分辨率。By风宥雪
  493. #
  494. #==============================================================================
  495. if ADJUST_X
  496. #帮助窗口
  497. class Window_Point_Help < Window_Help
  498.   include Point_Tree
  499.   def set_text(id)
  500.     contents.clear
  501.     if id <= POINT_KIND
  502.       text = "提升一点该属性"
  503.     elsif id == POINT_KIND+1
  504.       text = "确认此次加点分配"
  505.     elsif  id == POINT_KIND+2
  506.       text = "取消此次加点分配"
  507.     end
  508.     draw_text_ex(8, 8, text)
  509.   end
  510. end
  511. #加点命令窗口
  512. class Window_Point_Command < Window_Command
  513.   #--------------------------------------------------------------------------
  514.   # ● 初始化对象
  515.   #--------------------------------------------------------------------------
  516.   def initialize(actor)
  517.     @status_window = nil
  518.     @actor = actor
  519.     super(ADJUST_X,ADJUST_Y)
  520.     select_last
  521.   end
  522.   #--------------------------------------------------------------------------
  523.   # ● 获取窗口的高度
  524.   #--------------------------------------------------------------------------
  525.   def window_height
  526.     ADJUST_CY
  527.   end
  528. end
  529. #角色状态窗口
  530. class Window_Point_Actor < Window_Base
  531.   def initialize(actor)
  532.     super(160+ADJUST_X, ADJUST_Y, ADJUST_CX - 160, ADJUST_CY)
  533.     @actor = actor
  534.     @index = 0
  535.     refresh
  536.   end
  537.   #基础属性
  538.    def draw_actor_param_to_s(x,y,param_id)
  539.     #坐标下调一点
  540.     y += 25
  541.     a=0
  542.     for i in 0 .. POINT_KIND-1
  543.       a+=$temp_point[i]*point_add_param(@actor.id)[i][param_id]
  544.     end
  545.     #属性名称
  546.     s1 = Vocab::param(param_id)
  547.     #当前值
  548.     s2 = @actor.param(param_id).to_s
  549.     #新值
  550.     s3 = (@actor.param(param_id) + a).to_s
  551.     #加点效果
  552.     if @index < POINT_KIND
  553.       if point_add_param(@actor.id)[@index][param_id]==0
  554.         s4 = ""
  555.       else
  556.         s4 = "+" + point_add_param(@actor.id)[@index][param_id].to_s
  557.       end
  558.     else
  559.       s4 = ""
  560.     end
  561.     #特殊属性
  562.     change_color(system_color)
  563.     draw_text(x,y+16*param_id,100,line_height,s1)
  564.     change_color(normal_color)
  565.     s2+= " →"
  566.     draw_text(x+52,y+16*param_id,150,line_height,s2,2)
  567.     contents.font.color = Color.new(0,255,0) if a > 0
  568.     contents.font.bold = true
  569.     draw_text(x+150,y+16*param_id,120,line_height,s3,2)
  570.     #contents.font.color = Color.new(0,255,0)
  571.     #contents.font.bold = true
  572.     draw_text(250,y+16*param_id,100,line_height,s4,2)
  573.     contents.font.bold = false
  574.   end
  575.  
  576.   def draw_actor_xparam_to_s(x,y,xparam_id)
  577.     #坐标下调一点
  578.     y += 25
  579.     a=0.00
  580.     for i in 0 .. POINT_KIND-1
  581.       a+=($temp_point[i]*point_add_xparam(@actor.id)[i][xparam_id]/10000.0)
  582.     end
  583.     s1 = XARAM_NAME[xparam_id]
  584.     s2 = sprintf("%03.2f%%",@actor.xparam(xparam_id)*100)
  585.     s3 = sprintf("%03.2f%%",(@actor.xparam(xparam_id) + a)*100)
  586.  
  587.     if @index < POINT_KIND
  588.       if point_add_xparam(@actor.id)[@index][xparam_id]==0
  589.         s4=""
  590.       else
  591.         s4 = sprintf("+%03.2f%%",point_add_xparam(@actor.id)[@index][xparam_id]/100.0)
  592.       end
  593.     else
  594.       s4 = ""
  595.     end
  596.     change_color(system_color)
  597.     draw_text(x,y+16*xparam_id,100,line_height,s1)
  598.     change_color(normal_color)
  599.     s2+= " →"
  600.     draw_text(x+52,y+16*xparam_id,150,line_height,s2,2)
  601.     contents.font.color = Color.new(0,255,0)  if a > 0
  602.     contents.font.bold = true
  603.     draw_text(x+150,y+16*xparam_id,120,line_height,s3,2)
  604.     #contents.font.color = Color.new(0,255,0)
  605.     #contents.font.bold = true
  606.     draw_text(250,y+16*xparam_id,100,line_height,s4,2)
  607.     contents.font.bold = false
  608.   end
  609. end
  610.  
  611. class Scene_Point < Scene_MenuBase
  612.   def create_help_window
  613.     @help_window = Window_Point_Help.new()
  614.     @help_window.viewport = @viewport
  615.     @command_window.help_window = @help_window
  616.   end
  617. end
  618.  
  619. end




===============================================================================================================





RUBY 代码复制
  1. #encoding:utf-8
  2. #===========================================================================
  3. #          RMVA 豪华型技能加点|技能被动效果:        v1.05
  4. #                       By希忆 66rpg.com
  5. #                                                 转载或修改请保留此类信息
  6. #===========================================================================
  7. # 在游戏系统类的实现
  8. #
  9. # 完工了,大概
  10. #===========================================================================
  11. #角色类,新增一堆方法。
  12. class Game_Actor < Game_Battler
  13.  
  14.   #初始化角色
  15.   #@skill_level:存放技能等级数据的哈希表,技能id=>技能等级
  16.   #@sp:剩余技能点
  17.   alias setup_201410131453 setup
  18.   def setup(actor_id)
  19.     @skill_level=Hash.new(0)
  20.     setup_201410131453(actor_id)
  21.     @sp = (@level-1) * SkillLevel::LEVELUPSP + SkillLevel::INITIALSP
  22.     auto_skill_levelup if self.class.auto_sp
  23.   end
  24.  
  25.   #读取技能点的方法,如果是自动升级技能的职业,则没必要有技能点
  26.   def sp
  27.     return 0 if self.class.auto_sp
  28.     @sp
  29.   end
  30.  
  31.   #读取技能基础等级,
  32.   #锁定技能等级优先度最高,
  33.   #链接技能等级次之,这个我好像在计算技能最终等级的方法里面又来了一遍。
  34.   #主要是技能基础等级是升级技能的窗口看到的等级,最终等级是使用技能的窗口。
  35.   def skill_basic_level(skill_id)
  36.     return 0 if skill_id == 0
  37.     lock = $data_skills[skill_id].lock_level
  38.     return lock if lock != 0
  39.     lnk = $data_skills[skill_id].link_skill
  40.     return skill_basic_level(lnk) if lnk != 0
  41.     @skill_level[skill_id]
  42.   end
  43.  
  44.   #获取装备增加技能的等级之和
  45.   def skill_plus_level(skill_id)
  46.     self.equips.compact.inject(0){|skl,eqp| skl+eqp.add_skill(skill_id)}
  47.   end
  48.  
  49.   #读取技能最终等级,如果技能基础等级为零,则不加装备提升直接等于零。
  50.   #最后返回基础等级+装备附加与技能最大等级中的小值
  51.   def skill_level(skill_id)
  52.     return 0 if skill_id == 0
  53.     lock = $data_skills[skill_id].lock_level
  54.     return lock if lock != 0
  55.     lnk = $data_skills[skill_id].link_skill
  56.     return skill_level(lnk) if lnk != 0
  57.     return 0 unless @skills.include?(skill_id)
  58.     return 0 if skill_basic_level(skill_id) == 0
  59.     [skill_basic_level(skill_id) + skill_plus_level(skill_id) ,\
  60.     $data_skills[skill_id].max_level].min
  61.   end
  62.  
  63.   #升一级技能技能能升级就升级,返回成功,否则返回失败
  64.   def level_up_skill(skill_id)
  65.     skl = $data_skills[skill_id]
  66.     if skill_can_levelup?(skl)
  67.       @sp -= skl.sp_cost
  68.       @skill_level[skill_id] += 1
  69.       return true
  70.     else
  71.       return false
  72.     end
  73.   end
  74.  
  75.   #初始化角色时初始化技能的方法,
  76.   #这里是不管默认的技能设定直接加载能学到的所有技能,也就是职业列表下的那些。
  77.   def init_skills
  78.     @skills = []
  79.     self.class.learnings.each do |learning|
  80.       @skills.push(learning.skill_id)
  81.     end
  82.     @skills.sort!
  83.   end
  84.  
  85.   #主要用在技能列表的窗口里的。确保只有技能等级为1级及以上的技能才能显示。
  86.   def has_skill?(skill)
  87.     skills.include?(skill) && skill_basic_level(skill.id) > 0
  88.   end
  89.  
  90.   #判断是否学习了技能,同样要确保只有技能等级为1级及以上的技能才能显示。
  91.   #和上面的区别是上面的可以有装备附带,状态附带的技能等级不为0的技能
  92.   #这里只能是职业列表下“领悟”的技能,装备状态附带的都不算
  93.   def skill_learn?(skill)
  94.     skill.is_a?(RPG::Skill) && @skills.include?(skill.id) && skill_basic_level(skill.id) > 0
  95.   end
  96.  
  97.   #判断前置技能是否都满足
  98.   def skill_former_match?(skill)
  99.     skill.former.each do |former|
  100.       return false unless skill_basic_level(former[0]) >= former[1]
  101.     end
  102.     true
  103.   end
  104.  
  105.   #判断技能是否已经学到精通了、
  106.   def skill_max_learn?(skill)
  107.     skill_basic_level(skill.id) == skill.max_learn
  108.   end
  109.  
  110.   #计算学习下一等级的技能所需要的人物等级
  111.   #如果精通了return false【感觉好像有点奇葩。。。】
  112.   def skill_next_level(skill)
  113.     return false if skill_max_learn?(skill)
  114.     skill.learn_level[0] + skill_basic_level(skill.id) * skill.learn_level[1]
  115.   end
  116.  
  117.   #技能能否升级?首先看是否锁定,是否链接,是否精通,
  118.   #再看等级是否符合学习下一级,sp是否足够,前置技能是否满足要求。
  119.   def skill_can_levelup?(skill)
  120.     return false if skill.lock_level != 0
  121.     return false if skill.link_skill != 0
  122.     return false if skill_max_learn?(skill)
  123.     @level >= skill_next_level(skill) && @sp >= skill.sp_cost && skill_former_match?(skill)
  124.   end
  125.  
  126.   #好像没什么用处。。。当初修改的用意是直接设置技能等级,后来觉得不好控制。。。
  127.   #反正就放着吧,不去管它好了
  128.   def learn_skill(skill_id,sk_level=0)
  129.     unless skill_learn?($data_skills[skill_id])
  130.       @skills.push(skill_id)
  131.       @skills.sort!
  132.       @skill_level[skill_id]=sk_level unless @skill_level.has_key?(skill_id)
  133.     end
  134.   end
  135.  
  136.   #自动升级技能。
  137.   def auto_skill_levelup
  138.     @skills.each do |skill|
  139.       skl=$data_skills[skill]
  140.       if self.class.auto_sp
  141.         while skill_next_level(skl) && skill_next_level(skl) <= @level do
  142.           @skill_level[skill] += 1
  143.         end
  144.       elsif skl.auto_levelup
  145.         while level_up_skill(skill) do
  146.         end
  147.       end
  148.     end
  149.   end
  150.  
  151.   #升级时发生的事情,等级+1,sp增加,如果是自动升级技能的职业则自动升级技能
  152. #  alias skill_system_levelup level_up
  153.   def level_up
  154. #    skill_system_levelup
  155.     @level += 1
  156.     @sp += SkillLevel::LEVELUPSP
  157.     auto_skill_levelup
  158.   end
  159.  
  160.   #被动技能提升的基础属性(加法叠加的部分)
  161.   #SkillLevel.formula:带入公式计算。
  162.   def skill_plus(param_id)
  163.     skills.inject(0) do |plu,skl|
  164.       plu + SkillLevel.formula(self.skill_level(skl.id),skl.param_add(param_id))
  165.     end
  166.   end
  167.  
  168.   #被动技能提升的基础属性倍率(乘法叠加)
  169.   def skill_rate(param_id)
  170.     skills.inject(1.00) do |plu,skl|
  171.       plu * SkillLevel.formula(self.skill_level(skl.id),skl.param_rate(param_id))
  172.     end
  173.   end
  174.  
  175.   #被动技能影响的属性抗性(乘法叠加)
  176.   def skill_element_rate(element_id)
  177.     skills.inject(1.00) do |plu,skl|
  178.       plu * SkillLevel.formula(self.skill_level(skl.id),skl.element_rate(element_id))
  179.     end
  180.   end
  181.  
  182.   #状态提升的基础属性(加法叠加的部分)
  183.   def state_param_plus(param_id)
  184.     states.inject(0) do |plu,sta|
  185.       plu + SkillLevel.formula(@state_level[sta.id],sta.param_add(param_id))
  186.     end
  187.   end
  188.   #状态提升的基础属性倍率(乘法叠加)
  189.   def state_param_rate(param_id)
  190.     states.inject(1.00) do |plu,sta|
  191.       plu * SkillLevel.formula(@state_level[sta.id],sta.param_rate(param_id))
  192.     end
  193.   end
  194.   #状态额外影响的属性抗性(乘法叠加)
  195.   def state_element_rate(element_id)
  196.     states.inject(1.00) do |plu,sta|
  197.       plu * SkillLevel.formula(@state_level[sta.id],sta.element_rate(element_id))
  198.     end
  199.   end
  200.  
  201.   #基础属性的计算,添加了被动技能的提升,按默认的先加后乘
  202.   def param(param_id)
  203.     value = param_base(param_id) + param_plus(param_id) +
  204.             skill_plus(param_id) + state_param_plus(param_id)
  205.     value *= param_rate(param_id) * param_buff_rate(param_id) *
  206.              skill_rate(param_id) * state_param_rate(param_id)
  207.     [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
  208.   end
  209.  
  210.   #状态影响的附加属性xparam
  211.   def state_xparam(xparam_id)
  212.     states.inject(0.0) do |plu,sta|
  213.       plu + SkillLevel.formula(@state_level[sta.id],sta.xparam(xparam_id))
  214.     end
  215.   end
  216.   #附加属性xparam的计算,命中暴击什么的,迭代加算。
  217.   def xparam(xparam_id)
  218.     state_xparam(xparam_id) + @skills.inject(super(xparam_id)) do |plu,skl|
  219.       plu + SkillLevel.formula(self.skill_level(skl),$data_skills[skl].xparam(xparam_id))
  220.     end
  221.   end
  222.  
  223.   #状态影响特殊属性sparam的计算
  224.   def state_sparam(sparam_id)
  225.     states.inject(1.0) do |plu,sta|
  226.       plu * SkillLevel.formula(@state_level[sta.id],sta.sparam(sparam_id))
  227.     end
  228.   end
  229.   #特殊属性sparam的计算,经验值比率什么的,迭代连乘计算。
  230.   def sparam(sparam_id)
  231.     state_sparam(sparam_id)*skills.inject(super(sparam_id)) do |plu,skl|
  232.       plu * SkillLevel.formula(self.skill_level(skl.id),skl.sparam(sparam_id))
  233.     end
  234.   end
  235.  
  236.   #技能消耗mp由于技能等级修正的倍率,
  237.   #反正就是到SkillLevel.formula找对应编号的公式。
  238.   def skill_mp_rate(skill)
  239.     SkillLevel.formula(skill_level(skill.id),skill.mp_type)
  240.   end
  241.  
  242.   #计算最终技能消耗mp的量
  243.   def skill_mp_cost(skill)
  244.     (skill.mp_cost * mcr * skill_mp_rate(skill)).to_i
  245.   end
  246.  
  247.   #计算暴击伤害倍率super:Game_Battler中的critical_rate,返回1.5
  248.   #人物提升,职业提升,被动技能修正和装备提升
  249.   def critical_rate
  250.     v = super
  251.     v *= (1.0 + self.actor.critical_rate/100.0)
  252.     v *= (1.0 + self.class.critical_rate/100.0)
  253.     v *= skills.inject(1.00) do |plu,skl|
  254.       plu * SkillLevel.formula(self.skill_level(skl.id),skl.critical_rate)
  255.     end
  256.     v*equips.compact.inject(1.00){ |rat,equip| rat*(1.00+equip.critical_rate/100.0) }
  257.   end
  258.  
  259.   #属性伤害修正。
  260.   def element_rate(element_id)
  261.     super(element_id) * skill_element_rate(element_id) * state_element_rate(element_id)
  262.   end
  263.  
  264.   #被动技能影响的属性强化效果。
  265.   def skill_element_damage(element_id)
  266.     skills.inject(1.00) do |plu,skl|
  267.       plu * SkillLevel.formula(self.skill_level(skl.id),skl.element_damage(element_id))
  268.     end
  269.   end
  270.  
  271.   def state_element_damage(element_id)
  272.     states.inject(1.00) do |plu,sta|
  273.       plu * SkillLevel.formula(@state_level[sta.id],sta.element_damage(element_id))
  274.     end
  275.   end
  276.  
  277.   #基础属性强化,角色备注和职业备注修正。
  278.   def basic_element_damage(element_id)
  279.     (1.0 + self.actor.element_damage(element_id)/100.0) *
  280.     (1.0 + self.class.element_damage(element_id)/100.0)
  281.   end
  282.  
  283.   #计算最终属性强化基础技能装备迭代连乘
  284.   def element_damage(element_id)
  285.     basic_element_damage(element_id) *
  286.     equips.compact.inject(skill_element_damage(element_id)) do |rat,equip|
  287.       rat*(1.00+equip.element_damage(element_id)/100.0)
  288.     end
  289.   end
  290.  
  291.   #受到hp伤害转移给mp的比例,遍历计算并返回最大值
  292.   def damage_convert
  293.     skl = skills.collect{|sk| sk = SkillLevel.formula(self.skill_level(sk.id),sk.damage_convert)}
  294.     sta = states.collect{|st| st = SkillLevel.formula(@state_level[st.id],st.damage_convert)}
  295.     (skl+sta).max
  296.   end
  297.  
  298.   #洗技能了,
  299.   alias item_apply_201411181846 item_apply
  300.   def item_apply(user, item)
  301.     item_apply_201411181846(user, item)
  302.     if item.is_a?(RPG::Item) and item.id == SkillLevel::RESETITEM
  303.       if self.reset_skill
  304.         self.hp = [self.hp,self.mhp].min
  305.         self.mp = [self.mp,self.mmp].min
  306.       end
  307.     end
  308.   end
  309.  
  310.   #洗技能的方法
  311.   def reset_skill
  312.     return false if self.class.auto_sp
  313.     @sp = (@level-1) * SkillLevel::LEVELUPSP + SkillLevel::INITIALSP
  314.     @skills.each  { |skill| @skill_level[skill]=0 }
  315.     return true
  316.   end
  317.  
  318. end
  319.  
  320. #有关洗点水的使用判断,想和上面洗点放在一起。于是没有放进场景相关。
  321. class Scene_ItemBase < Scene_MenuBase
  322.   def item_usable?
  323.     if item.id == SkillLevel::RESETITEM
  324.       return false if item_target_actors[0].class.auto_sp
  325.       return true
  326.     end
  327.     user.usable?(item) && item_effects_valid?
  328.   end
  329. end
  330.  
  331. class Game_Enemy
  332.   #敌人属性强化
  333.   def element_damage(id)
  334.     1.0 + self.enemy.element_damage(id)/100.0
  335.   end
  336.   #敌人暴击倍率 super:Game_Battler定义的critical_rate,返回1.5
  337.   def critical_rate
  338.     super * (1+self.enemy.element_damage/100.0)
  339.   end
  340.   #敌人的技能等级,要么锁定,要么1
  341.   def skill_level(skill_id)
  342.     lock = $data_skills[skill_id].lock_level if $data_skills[skill_id]
  343.     return lock if lock != 0
  344.     return 1
  345.   end
  346.     #状态提升的基础属性(加法叠加的部分)
  347.   def state_param_plus(param_id)
  348.     states.inject(0) do |plu,sta|
  349.       plu + SkillLevel.formula(@state_level[sta.id],sta.param_add(param_id))
  350.     end
  351.   end
  352.   #状态提升的基础属性倍率(乘法叠加)
  353.   def state_param_rate(param_id)
  354.     states.inject(1.00) do |plu,sta|
  355.       plu * SkillLevel.formula(@state_level[sta.id],sta.param_rate(param_id))
  356.     end
  357.   end
  358.   #状态额外影响的属性抗性(乘法叠加)
  359.   def state_element_rate(element_id)
  360.     states.inject(1.00) do |plu,sta|
  361.       plu * SkillLevel.formula(@state_level[sta.id],sta.element_rate(element_id))
  362.     end
  363.   end
  364.  
  365.   #基础属性的计算,添加了被动技能的提升,按默认的先加后乘
  366.   def param(param_id)
  367.     value = param_base(param_id) + param_plus(param_id) +
  368.             state_param_plus(param_id)
  369.     value *= param_rate(param_id) * param_buff_rate(param_id) *
  370.              state_param_rate(param_id)
  371.     [[value, param_max(param_id)].min, param_min(param_id)].max.to_i
  372.   end
  373.  
  374.   #状态影响的附加属性xparam
  375.   def state_xparam(xparam_id)
  376.     states.inject(0.0) do |plu,sta|
  377.       plu + SkillLevel.formula(@state_level[sta.id],sta.xparam(xparam_id))
  378.     end
  379.   end
  380.   #附加属性xparam的计算,命中暴击什么的,迭代加算。
  381.   def xparam(xparam_id)
  382.     state_xparam(xparam_id) + super(xparam_id)
  383.   end
  384.  
  385.   #状态影响特殊属性sparam的计算
  386.   def state_sparam(sparam_id)
  387.     states.inject(1.0) do |plu,sta|
  388.       plu * SkillLevel.formula(@state_level[sta.id],sta.sparam(sparam_id))
  389.     end
  390.   end
  391.   #特殊属性sparam的计算,经验值比率什么的,迭代连乘计算。
  392.   def sparam(sparam_id)
  393.     super(sparam_id)*state_sparam(sparam_id)
  394.   end
  395.   def state_element_damage(element_id)
  396.     states.inject(1.00) do |plu,sta|
  397.       plu * SkillLevel.formula(@state_level[sta.id],sta.element_damage(element_id))
  398.     end
  399.   end
  400.   def element_rate(element_id)
  401.     super(element_id) * state_element_rate(element_id)
  402.   end
  403. end
  404.  
  405.  
  406.  
  407. class Game_Battler < Game_BattlerBase
  408.  
  409.   #attr_reader :state_level
  410.   #@state_level 保存状态等级的数组
  411.   alias initialize_201410131453 initialize
  412.   def initialize
  413.     initialize_201410131453
  414.     @state_level = Hash.new(0)
  415.   end
  416.  
  417.   #属性修正的计算,将使用者属性强化也计算在内的
  418.   def item_element_rate(user, item)
  419.     if item.damage.element_id < 0
  420.       user.atk_elements.empty? ? 1.0 : elements_max_rate(user)
  421.     else
  422.       element_rate(item.damage.element_id)*user.element_damage(item.damage.element_id)
  423.     end
  424.   end
  425.  
  426.   #将使用者属性强化也计算在内的最有效属性。
  427.   def elements_max_rate(user)
  428.     user.atk_elements.inject([0.0]) {|r, i| r.push(element_rate(i)*user.element_damage(i)) }.max
  429.   end
  430.  
  431.   def damage_convert #受到hp伤害转移给mp的比例
  432.     0
  433.   end
  434.  
  435.   #计算伤害,SkillLevel.formula找公式算修正。
  436.   def make_damage_value(user, item)
  437.     value = item.damage.eval(user, self, $game_variables)
  438.     if item.is_a?(RPG::Skill)
  439.       value *= SkillLevel.formula(user.skill_level(item.id),item.damage_increase_type)
  440.     end
  441.  
  442.     value *= item_element_rate(user, item)
  443.     value *= pdr if item.physical?
  444.     value *= mdr if item.magical?
  445.     value *= rec if item.damage.recover?
  446.     value = apply_critical(value,user) if @result.critical
  447.     value = apply_variance(value, item.damage.variance)
  448.     value = apply_guard(value)
  449.  
  450.     if value > 0 && damage_convert > 0
  451.       valmp = [(value*damage_convert).to_i,self.mp].min
  452.       self.mp -= valmp
  453.       value -= valmp
  454.     end
  455.     @result.make_damage(value.to_i, item)
  456.   end
  457.  
  458.   #计算暴击修正,添加了参数user
  459.   def apply_critical(value,user)
  460.     value * user.critical_rate
  461.   end
  462.  
  463.   #基础暴击修正
  464.   def critical_rate
  465.     1.5
  466.   end
  467.  
  468.   #状态附加,添加参数user,写的有点奇怪。如果有明确的user,
  469.   #就提取技能等级user.skill_level($data_states[state_id].link_skill)
  470.   #然后按SkillLevel.formula公式算得到附加概率,如果随机数比概率大(算是失败)
  471.   #就直接返回,再下去按部就班如果没有状态就附加新状态,如果有明确的user,
  472.   #状态的等级就等于之前提取的技能等级,否则为1。
  473.   def add_state(state_id,user = nil)
  474.     if state_addable?(state_id)
  475.       if user != nil
  476.         lv = user.skill_level($data_states[state_id].link_skill)
  477.       else
  478.         lv = 1
  479.       end
  480.       return if rand > SkillLevel.formula(lv,$data_states[state_id].chance)
  481.       add_new_state(state_id) unless state?(state_id)
  482.       if user != nil
  483.         @state_level[state_id] = lv
  484.       else
  485.         @state_level[state_id] = 1
  486.       end
  487.       reset_state_counts(state_id)
  488.       @result.added_states.push(state_id).uniq!
  489.     end
  490.   end
  491.  
  492.   def item_effect_add_state_attack(user, item, effect)
  493.     user.atk_states.each do |state_id|
  494.       chance = effect.value1
  495.       chance *= state_rate(state_id)
  496.       chance *= user.atk_states_rate(state_id)
  497.       chance *= luk_effect_rate(user)
  498.       if rand < chance
  499.         add_state(state_id,user)
  500.         @result.success = true
  501.       end
  502.     end
  503.   end
  504.  
  505.   def item_effect_add_state_normal(user, item, effect)
  506.     chance = effect.value1
  507.     chance *= state_rate(effect.data_id) if opposite?(user)
  508.     chance *= luk_effect_rate(user)      if opposite?(user)
  509.     if rand < chance
  510.       add_state(effect.data_id,user)
  511.       @result.success = true
  512.     end
  513.   end
  514.  
  515. end



就是升级没有人物加点的加点数,只有技能升级的技能点,搞了很久,找不到解决的办法,望高手帮我解决一下

Lv1.梦旅人

梦石
0
星屑
180
在线时间
829 小时
注册时间
2010-6-26
帖子
671
2
发表于 2015-6-6 19:28:03 | 只看该作者
看了一眼,试过上下调换顺序么

点评

不行的,会导致其他冲突  发表于 2015-6-10 11:47

评分

参与人数 1星屑 +132 收起 理由
VIPArcher + 132 我很赞同

查看全部评分

新手们!不要被看扁了!我们也会用论坛搜索,我们也会自己找脚本,我们也会自己点击关闭按钮旁边的小问号!
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1881
在线时间
414 小时
注册时间
2012-7-30
帖子
82
3
发表于 2015-6-6 20:14:19 | 只看该作者
在游戏系统类的153行level_up函数里加上$game_variables[self.id*(POINT_KIND+1) + POINT_VARIABLE] += LEVEL_UP_POINT

点评

请问具体是怎么添加的,我试了一下,就报错了。是直接把@level += 1中的1去掉,然后复制。还是直接复制在后面了?  发表于 2015-7-3 20:37
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
1187
在线时间
12 小时
注册时间
2015-7-22
帖子
4
4
发表于 2015-7-29 11:20:44 | 只看该作者
用那个非变量版然后把加属性点的放在下面
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 18:56

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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