Project1

标题: 被动技能 [打印本页]

作者: 恐惧剑刃    时间: 2014-1-27 02:34
标题: 被动技能
相关脚本。。我承认很简单
  1. #==============================================================================
  2. # ■ Game_Actor
  3. #------------------------------------------------------------------------------
  4. # 被动技能
  5. # 设置:
  6. # 可能使用时必须为 【不能使用】
  7. # 除过回避,分散度和威力以外,其余参数都将提升角色的相关能力
  8. # 比如 你设置 速度 F 的值为 100 那么该被动技能就会给角色增加 100 的速度!
  9. # 特殊:
  10. # 消费SP => HP
  11. # 命中率 => MP(SP)
  12. #==============================================================================

  13. class Game_Actor < Game_Battler
  14.   #--------------------------------------------------------------------------
  15.   # ● 获取 MaxHP
  16.   #--------------------------------------------------------------------------
  17.   def maxhp
  18.     n = [[base_maxhp + @maxhp_plus, 1].max, 9999].min
  19.     for i in @states
  20.       n *= $data_states[i].maxhp_rate / 100.0
  21.     end
  22.     n = [[Integer(n), 1].max, 9999].min
  23.    
  24.     @skills.each do |i|
  25.       if $data_skills[i].occasion == 3 and
  26.         $data_skills[i].hit > 0
  27.         n += $data_skills[i].hit
  28.       end
  29.     end
  30.     n = [n, 9999].min
  31.    
  32.     return n
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # ● 获取基本 MaxSP
  36.   #--------------------------------------------------------------------------
  37.   def base_maxsp
  38.     n = $data_actors[@actor_id].parameters[1, @level]
  39.     @skills.each do |i|
  40.       if $data_skills[i].occasion == 3 and
  41.         $data_skills[i].sp_cost > 0
  42.         n += $data_skills[i].sp_cost
  43.       end
  44.     end
  45.     return n
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● 获取基本力量
  49.   #--------------------------------------------------------------------------
  50.   def base_str
  51.     n = $data_actors[@actor_id].parameters[2, @level]
  52.     weapon = $data_weapons[@weapon_id]
  53.     armor1 = $data_armors[@armor1_id]
  54.     armor2 = $data_armors[@armor2_id]
  55.     armor3 = $data_armors[@armor3_id]
  56.     armor4 = $data_armors[@armor4_id]
  57.     n += weapon != nil ? weapon.str_plus : 0
  58.     n += armor1 != nil ? armor1.str_plus : 0
  59.     n += armor2 != nil ? armor2.str_plus : 0
  60.     n += armor3 != nil ? armor3.str_plus : 0
  61.     n += armor4 != nil ? armor4.str_plus : 0
  62.    
  63.     @skills.each do |i|
  64.       if $data_skills[i].occasion == 3 and
  65.         $data_skills[i].str_f > 0
  66.         n += $data_skills[i].str_f
  67.       end
  68.     end
  69.    
  70.     return [[n, 1].max, 999].min
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ● 获取基本灵巧
  74.   #--------------------------------------------------------------------------
  75.   def base_dex
  76.     n = $data_actors[@actor_id].parameters[3, @level]
  77.     weapon = $data_weapons[@weapon_id]
  78.     armor1 = $data_armors[@armor1_id]
  79.     armor2 = $data_armors[@armor2_id]
  80.     armor3 = $data_armors[@armor3_id]
  81.     armor4 = $data_armors[@armor4_id]
  82.     n += weapon != nil ? weapon.dex_plus : 0
  83.     n += armor1 != nil ? armor1.dex_plus : 0
  84.     n += armor2 != nil ? armor2.dex_plus : 0
  85.     n += armor3 != nil ? armor3.dex_plus : 0
  86.     n += armor4 != nil ? armor4.dex_plus : 0
  87.    
  88.     @skills.each do |i|
  89.       if $data_skills[i].occasion == 3 and
  90.         $data_skills[i].dex_f > 0
  91.         n += $data_skills[i].dex_f
  92.       end
  93.     end
  94.    
  95.     return [[n, 1].max, 999].min
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● 获取基本速度
  99.   #--------------------------------------------------------------------------
  100.   def base_agi
  101.     n = $data_actors[@actor_id].parameters[4, @level]
  102.     weapon = $data_weapons[@weapon_id]
  103.     armor1 = $data_armors[@armor1_id]
  104.     armor2 = $data_armors[@armor2_id]
  105.     armor3 = $data_armors[@armor3_id]
  106.     armor4 = $data_armors[@armor4_id]
  107.     n += weapon != nil ? weapon.agi_plus : 0
  108.     n += armor1 != nil ? armor1.agi_plus : 0
  109.     n += armor2 != nil ? armor2.agi_plus : 0
  110.     n += armor3 != nil ? armor3.agi_plus : 0
  111.     n += armor4 != nil ? armor4.agi_plus : 0
  112.    
  113.     @skills.each do |i|
  114.       if $data_skills[i].occasion == 3 and
  115.         $data_skills[i].agi_f > 0
  116.         n += $data_skills[i].agi_f
  117.       end
  118.     end
  119.    
  120.     return [[n, 1].max, 999].min
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ● 获取基本魔力
  124.   #--------------------------------------------------------------------------
  125.   def base_int
  126.     n = $data_actors[@actor_id].parameters[5, @level]
  127.     weapon = $data_weapons[@weapon_id]
  128.     armor1 = $data_armors[@armor1_id]
  129.     armor2 = $data_armors[@armor2_id]
  130.     armor3 = $data_armors[@armor3_id]
  131.     armor4 = $data_armors[@armor4_id]
  132.     n += weapon != nil ? weapon.int_plus : 0
  133.     n += armor1 != nil ? armor1.int_plus : 0
  134.     n += armor2 != nil ? armor2.int_plus : 0
  135.     n += armor3 != nil ? armor3.int_plus : 0
  136.     n += armor4 != nil ? armor4.int_plus : 0
  137.    
  138.     @skills.each do |i|
  139.       if $data_skills[i].occasion == 3 and
  140.         $data_skills[i].int_f > 0
  141.         n += $data_skills[i].int_f
  142.       end
  143.     end
  144.    
  145.     return [[n, 1].max, 999].min
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● 获取基本攻击力
  149.   #--------------------------------------------------------------------------
  150.   def base_atk
  151.     weapon = $data_weapons[@weapon_id]
  152.    
  153.     n = weapon != nil ? weapon.atk : 0
  154.     @skills.each do |i|
  155.       if $data_skills[i].occasion == 3 and
  156.         $data_skills[i].atk_f > 0
  157.         n += $data_skills[i].atk_f
  158.       end
  159.     end
  160.    
  161.     return n
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● 获取基本物理防御
  165.   #--------------------------------------------------------------------------
  166.   def base_pdef
  167.     weapon = $data_weapons[@weapon_id]
  168.     armor1 = $data_armors[@armor1_id]
  169.     armor2 = $data_armors[@armor2_id]
  170.     armor3 = $data_armors[@armor3_id]
  171.     armor4 = $data_armors[@armor4_id]
  172.     pdef1 = weapon != nil ? weapon.pdef : 0
  173.     pdef2 = armor1 != nil ? armor1.pdef : 0
  174.     pdef3 = armor2 != nil ? armor2.pdef : 0
  175.     pdef4 = armor3 != nil ? armor3.pdef : 0
  176.     pdef5 = armor4 != nil ? armor4.pdef : 0
  177.     n = pdef1 + pdef2 + pdef3 + pdef4 + pdef5
  178.    
  179.     @skills.each do |i|
  180.       if $data_skills[i].occasion == 3 and
  181.         $data_skills[i].pdef_f > 0
  182.         n += $data_skills[i].pdef_f
  183.       end
  184.     end
  185.    
  186.     return n
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # ● 获取基本魔法防御
  190.   #--------------------------------------------------------------------------
  191.   def base_mdef
  192.     weapon = $data_weapons[@weapon_id]
  193.     armor1 = $data_armors[@armor1_id]
  194.     armor2 = $data_armors[@armor2_id]
  195.     armor3 = $data_armors[@armor3_id]
  196.     armor4 = $data_armors[@armor4_id]
  197.     mdef1 = weapon != nil ? weapon.mdef : 0
  198.     mdef2 = armor1 != nil ? armor1.mdef : 0
  199.     mdef3 = armor2 != nil ? armor2.mdef : 0
  200.     mdef4 = armor3 != nil ? armor3.mdef : 0
  201.     mdef5 = armor4 != nil ? armor4.mdef : 0
  202.     n = mdef1 + mdef2 + mdef3 + mdef4 + mdef5
  203.    
  204.     @skills.each do |i|
  205.       if $data_skills[i].occasion == 3 and
  206.         $data_skills[i].mdef_f > 0
  207.         n += $data_skills[i].mdef_f
  208.       end
  209.     end
  210.    
  211.     return n
  212.   end
  213. end
复制代码
被动技能.rar (228.16 KB, 下载次数: 227)
作者: szzyc0    时间: 2014-1-27 16:42
只是一些提高能力的被动技能……没有更强大的功能了
作者: 玄胄武甲    时间: 2014-2-1 21:05
这玩意儿用处确实不大……不过还是辛苦LZ了
作者: chd114    时间: 2014-2-2 18:47
···概率触发的被动怎么办···




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