Project1

标题: ~~~~~~~~汗刚发现的一个脚本问题 [打印本页]

作者: 84671379    时间: 2010-8-29 01:55
提示: 作者被禁止或删除 内容自动屏蔽
作者: oОS+WEi    时间: 2010-8-29 11:57
把这个覆盖掉原来的 Game_Battler 1
  1. # ————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载请保留此信息
  3. # ————————————————————————————————


  4. #==========================================================================
  5. # ■ Game_Battler (分割定义 1)
  6. #--------------------------------------------------------------------------
  7. #  处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
  8. # 超级类来使用。
  9. #==========================================================================

  10. class Game_Battler
  11.   #----------------------------------------------------------------------
  12.   # ● 定义实例变量
  13.   #----------------------------------------------------------------------
  14.   attr_reader   :battler_name             # 战斗者 文件名
  15.   attr_reader   :battler_hue              # 战斗者 色相
  16.   attr_reader   :hp                       # HP
  17.   attr_reader   :sp                       # SP
  18.   attr_reader   :states                   # 状态
  19.   attr_accessor :hidden                   # 隐藏标志
  20.   attr_accessor :immortal                 # 不死身标志
  21.   attr_accessor :damage_pop               # 显示伤害标志
  22.   attr_accessor :damage                   # 伤害值
  23.   attr_accessor :critical                 # 会心一击标志
  24.   attr_accessor :animation_id             # 动画 ID
  25.   attr_accessor :animation_hit            # 动画 击中标志
  26.   attr_accessor :white_flash              # 白色屏幕闪烁标志
  27.   attr_accessor :blink                    # 闪烁标志
  28.   #----------------------------------------------------------------------
  29.   # ● 初始化对像
  30.   #----------------------------------------------------------------------
  31.   def initialize
  32.     @battler_name = ""
  33.     @battler_hue = 0
  34.     @hp = 0
  35.     @sp = 0
  36.     @states = []
  37.     @states_turn = {}
  38.     @maxhp_plus = 0
  39.     @maxsp_plus = 0
  40.     @str_plus = 0
  41.     @dex_plus = 0
  42.     @agi_plus = 0
  43.     @int_plus = 0
  44.     @hidden = false
  45.     @immortal = false
  46.     @damage_pop = false
  47.     @damage = nil
  48.     @critical = false
  49.     @animation_id = 0
  50.     @animation_hit = false
  51.     @white_flash = false
  52.     @blink = false
  53.     @current_action = Game_BattleAction.new
  54.   end
  55.   #----------------------------------------------------------------------
  56.   # ● 获取 MaxHP
  57.   #----------------------------------------------------------------------
  58.   def maxhp
  59.     n = [[base_maxhp + @maxhp_plus, 1].max, 999999].min
  60.     for i in @states
  61.       n *= $data_states[i].maxhp_rate / 100.0
  62.     end
  63.     n = [[Integer(n), 1].max, 999999].min
  64.     return n
  65.   end

  66.   #----------------------------------------------------------------------
  67.   # ● 获取 MaxSP
  68.   #----------------------------------------------------------------------
  69.   def maxsp
  70.     n = [[base_maxsp + @maxsp_plus, 0].max, 999999].min
  71.     for i in @states
  72.       n *= $data_states[i].maxsp_rate / 100.0
  73.     end
  74.     n = [[Integer(n), 0].max, 999999].min
  75.     return n
  76.   end
  77.   #---------------------------------------------------------------------
  78.   # ● 获取力量
  79.   #---------------------------------------------------------------------
  80.   def str
  81.     n = [[base_str + @str_plus, 1].max, 999].min
  82.     for i in @states
  83.       n *= $data_states[i].str_rate / 100.0
  84.     end
  85.     n = [[Integer(n), 1].max, 999].min
  86.     return n
  87.   end
  88.   #----------------------------------------------------------------------
  89.   # ● 获取灵巧
  90.   #----------------------------------------------------------------------
  91.   def dex
  92.     n = [[base_dex + @dex_plus, 1].max, 999].min
  93.     for i in @states
  94.       n *= $data_states[i].dex_rate / 100.0
  95.     end
  96.     n = [[Integer(n), 1].max, 999].min
  97.     return n
  98.   end
  99.   #----------------------------------------------------------------------
  100.   # ● 获取速度
  101.   #----------------------------------------------------------------------
  102.   def agi
  103.     n = [[base_agi + @agi_plus, 1].max, 999].min
  104.     for i in @states
  105.       n *= $data_states[i].agi_rate / 100.0
  106.     end
  107.     n = [[Integer(n), 1].max, 999].min
  108.     return n
  109.   end
  110.   #------------------------------------------------------------------------
  111.   # ● 获取魔力
  112.   #------------------------------------------------------------------------
  113.   def int
  114.     n = [[base_int + @int_plus, 1].max, 999].min
  115.     for i in @states
  116.       n *= $data_states[i].int_rate / 100.0
  117.     end
  118.     n = [[Integer(n), 1].max, 999].min
  119.     return n
  120.   end
  121.   #------------------------------------------------------------------------
  122.   # ● 设置 MaxHP
  123.   #     maxhp : 新的 MaxHP
  124.   #------------------------------------------------------------------------
  125.   def maxhp=(maxhp)
  126.     @maxhp_plus += maxhp - self.maxhp
  127.     @maxhp_plus = [[@maxhp_plus, -9999].max, 9999].min
  128.     @hp = [@hp, self.maxhp].min
  129.   end
  130.   #------------------------------------------------------------------------
  131.   # ● 设置 MaxSP
  132.   #     maxsp : 新的 MaxSP
  133.   #------------------------------------------------------------------------
  134.   def maxsp=(maxsp)
  135.     @maxsp_plus += maxsp - self.maxsp
  136.     @maxsp_plus = [[@maxsp_plus, -999999].max, 999999].min
  137.     @sp = [@sp, self.maxsp].min
  138.   end
  139.   #------------------------------------------------------------------------
  140.   # ● 设置力量
  141.   #     str : 新的力量
  142.   #------------------------------------------------------------------------
  143.   def str=(str)
  144.     @str_plus += str - self.str
  145.     @str_plus = [[@str_plus, -999].max, 999].min
  146.   end
  147.   #------------------------------------------------------------------------
  148.   # ● 设置灵巧
  149.   #     dex : 新的灵巧
  150.   #------------------------------------------------------------------------
  151.   def dex=(dex)
  152.     @dex_plus += dex - self.dex
  153.     @dex_plus = [[@dex_plus, -999].max, 999].min
  154.   end
  155.   #------------------------------------------------------------------------
  156.   # ● 设置速度
  157.   #     agi : 新的速度
  158.   #------------------------------------------------------------------------
  159.   def agi=(agi)
  160.     @agi_plus += agi - self.agi
  161.     @agi_plus = [[@agi_plus, -999].max, 999].min
  162.   end
  163.   #------------------------------------------------------------------------
  164.   # ● 设置魔力
  165.   #     int : 新的魔力
  166.   #------------------------------------------------------------------------
  167.   def int=(int)
  168.     @int_plus += int - self.int
  169.     @int_plus = [[@int_plus, -999].max, 999].min
  170.   end
  171.   #------------------------------------------------------------------------
  172.   # ● 获取命中率
  173.   #------------------------------------------------------------------------
  174.   def hit
  175.     n = 100
  176.     for i in @states
  177.       n *= $data_states[i].hit_rate / 100.0
  178.     end
  179.     return Integer(n)
  180.   end
  181.   #------------------------------------------------------------------------
  182.   # ● 获取攻击力
  183.   #------------------------------------------------------------------------
  184.   def atk
  185.     n = base_atk + base_str + @str_plus.to_i
  186.     for i in @states
  187.       n *= $data_states[i].atk_rate / 100.0
  188.     end
  189.     return Integer(n)
  190.   end
  191.   #------------------------------------------------------------------------
  192.   # ● 获取物理防御
  193.   #------------------------------------------------------------------------
  194.   def pdef
  195.     n = base_pdef + base_dex + @dex_plus.to_i
  196.     for i in @states
  197.       n *= $data_states[i].pdef_rate / 100.0
  198.     end
  199.     return Integer(n)
  200.   end
  201.   #------------------------------------------------------------------------
  202.   # ● 获取魔法防御
  203.   #------------------------------------------------------------------------
  204.   def mdef
  205.     n = base_mdef + base_int + @int_plus.to_i
  206.     for i in @states
  207.       n *= $data_states[i].mdef_rate / 100.0
  208.     end
  209.     return Integer(n)
  210.   end
  211.   #------------------------------------------------------------------------
  212.   # ● 获取回避修正
  213.   #------------------------------------------------------------------------
  214.   def eva
  215.     n = base_eva + base_agi + @agi_plus.to_i
  216.     for i in @states
  217.       n += $data_states[i].eva
  218.     end
  219.     return n
  220.   end
  221.   #------------------------------------------------------------------------
  222.   # ● 更改 HP
  223.   #     hp : 新的 HP
  224.   #------------------------------------------------------------------------
  225.   def hp=(hp)
  226.     @hp = [[hp, maxhp].min, 0].max
  227.     # 解除附加的战斗不能状态
  228.     for i in 1...$data_states.size
  229.       if $data_states[i].zero_hp
  230.         if self.dead?
  231.           add_state(i)
  232.         else
  233.           remove_state(i)
  234.         end
  235.       end
  236.     end
  237.   end
  238.   #------------------------------------------------------------------------
  239.   # ● 更改 SP
  240.   #     sp : 新的 SP
  241.   #------------------------------------------------------------------------
  242.   def sp=(sp)
  243.     @sp = [[sp, maxsp].min, 0].max
  244.   end
  245.   #------------------------------------------------------------------------
  246.   # ● 全回复
  247.   #------------------------------------------------------------------------
  248.   def recover_all
  249.     @hp = maxhp
  250.     @sp = maxsp
  251.     for i in @states.clone
  252.       remove_state(i)
  253.     end
  254.   end
  255.   #------------------------------------------------------------------------
  256.   # ● 获取当前的动作
  257.   #------------------------------------------------------------------------
  258.   def current_action
  259.     return @current_action
  260.   end
  261.   #------------------------------------------------------------------------
  262.   # ● 确定动作速度
  263.   #------------------------------------------------------------------------
  264.   def make_action_speed
  265.     @current_action.speed = agi + rand(10 + agi / 4)
  266.   end
  267.   #------------------------------------------------------------------------
  268.   # ● 战斗不能判定
  269.   #------------------------------------------------------------------------
  270.   def dead?
  271.     return (@hp == 0 and not @immortal)
  272.   end
  273.   #------------------------------------------------------------------------
  274.   # ● 存在判定
  275.   #------------------------------------------------------------------------
  276.   def exist?
  277.     return (not @hidden and (@hp > 0 or @immortal))
  278.   end
  279.   #------------------------------------------------------------------------
  280.   # ● HP 0 判定
  281.   #------------------------------------------------------------------------
  282.   def hp0?
  283.     return (not @hidden and @hp == 0)
  284.   end
  285.   #------------------------------------------------------------------------
  286.   # ● 可以输入命令判定
  287.   #------------------------------------------------------------------------
  288.   def inputable?
  289.     return (not @hidden and restriction <= 1)
  290.   end
  291.   #------------------------------------------------------------------------
  292.   # ● 可以行动判定
  293.   #------------------------------------------------------------------------
  294.   def movable?
  295.     return (not @hidden and restriction < 4)
  296.   end
  297.   #------------------------------------------------------------------------
  298.   # ● 防御中判定
  299.   #------------------------------------------------------------------------
  300.   def guarding?
  301.     return (@current_action.kind == 0 and @current_action.basic == 1)
  302.   end
  303.   #------------------------------------------------------------------------
  304.   # ● 休止中判定
  305.   #------------------------------------------------------------------------
  306.   def resting?
  307.     return (@current_action.kind == 0 and @current_action.basic == 3)
  308.   end
  309. end
复制代码

作者: RXVincent    时间: 2010-8-29 12:20
这个是上次我帮小柯改的……要求一模一样
覆盖原脚本
  1. #=========================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #=========================================================================

  4. # 空手的攻击防御力           by Claimh
  5. #------------------------------------------------------------------
  6. # http://www.k3.dion.ne.jp/~claimh/
  7. #========================================================================

  8. module Arm_Element
  9.   ARM_ATK = []
  10.   ARM_PDEF = []
  11.   ARM_MDEF = []
  12.   ARM_ELEMENT = []
  13.   ARM_ELE_PLUS = []
  14.   ARM_ELE_MINUS = []
  15.   ARM_ANIMATION1 = []
  16.   ARM_ANIMATION2 = []
  17.   #===================================================================
  18.   # 自定义开始
  19.   #====================================================================
  20.   # 空手时1号角色攻击力与力量值的百分比关系(100%)
  21.   ARM_ATK[1] = 1
  22.   # 空手时2号角色攻击力与力量值的百分比关系(100%),以下类推,不一一举例。
  23.   ARM_ATK[2] = 1
  24.   ARM_ATK[3] = 1

  25.   # 空手时1号角色防御力与灵巧值的百分比关系(100%)
  26.   ARM_PDEF[1] = 1
  27.   ARM_PDEF[2] = 1
  28.   ARM_PDEF[3] = 1

  29.   # 空手时1号角色魔法防御力与速度值的百分比关系(100%)
  30.   ARM_MDEF[1] = 1
  31.   ARM_MDEF[2] = 1
  32.   ARM_MDEF[3] = 1

  33.   # 空手时攻击方动画编号
  34.   ARM_ANIMATION1[3] = 2

  35.   # 空手时挨打方动画编号
  36.   ARM_ANIMATION2[1] = 7
  37.   ARM_ANIMATION2[2] = 12
  38.   ARM_ANIMATION2[3] = 45

  39.   #————以下几个慎用,是空手时的属性增减,不推荐修改

  40.   ARM_ELEMENT[1] = [1]
  41.   ARM_ELE_PLUS[1] = []
  42.   ARM_ELE_MINUS[1] = []
  43. end

  44. class Game_Actor < Game_Battler
  45.   include Arm_Element
  46.   #--------------------------------------------------------------------
  47.   #------------------------------------------------------------------
  48.   alias base_atk_arm base_atk
  49.   def base_atk
  50.     if @weapon_id == 0 and ARM_ATK[@actor_id] != nil
  51.       return $game_actors[@actor_id].str * ARM_ATK[@actor_id]
  52.     end
  53.     return base_atk_arm + $game_actors[@actor_id].str * ARM_ATK[@actor_id]
  54.   end

  55.   #--------------------------------------------------------------------
  56.   #-------------------------------------------------------------------
  57.   alias base_pdef_arm base_pdef
  58.   def base_pdef
  59.     if @weapon_id == 0 and ARM_PDEF[@actor_id] != nil
  60.       return base_pdef_arm + $game_actors[@actor_id].dex * ARM_PDEF[@actor_id]
  61.     end
  62.     return base_pdef_arm + $game_actors[@actor_id].dex * ARM_PDEF[@actor_id]
  63.   end

  64.   #--------------------------------------------------------------------
  65.   #--------------------------------------------------------------------
  66.   alias base_mdef_arm base_mdef
  67.   def base_mdef
  68.     if @weapon_id == 0 and ARM_MDEF[@actor_id] != nil
  69.       return base_mdef_arm + $game_actors[@actor_id].agi * ARM_MDEF[@actor_id]
  70.     end
  71.     return base_mdef_arm + $game_actors[@actor_id].agi * ARM_MDEF[@actor_id]
  72.   end

  73.   #------------------------------------------------------------------
  74.   #--------------------------------------------------------------
  75.   alias element_set_arm element_set
  76.   def element_set
  77.     if @weapon_id == 0 and ARM_ELEMENT[@actor_id] != []
  78.       return ARM_ELEMENT[@actor_id]
  79.     end
  80.     return element_set_arm
  81.   end

  82.   #-----------------------------------------------------------------
  83.   #-------------------------------------------------------------------
  84.   alias plus_state_set_arm plus_state_set
  85.   def plus_state_set
  86.     if @weapon_id == 0 and ARM_ELE_PLUS[@actor_id] != []
  87.       return ARM_ELE_PLUS[@actor_id]
  88.     end
  89.     return plus_state_set_arm
  90.   end

  91.   #-------------------------------------------------------------------
  92.   #------------------------------------------------------------------
  93.   alias minus_state_set_arm minus_state_set
  94.   def minus_state_set
  95.     if @weapon_id == 0 and ARM_ELE_MINUS[@actor_id] != []
  96.       return ARM_ELE_MINUS[@actor_id]
  97.     end
  98.     return minus_state_set_arm
  99.   end

  100.   #------------------------------------------------------------------
  101.   #-----------------------------------------------------------------
  102.   alias animation1_id_arm animation1_id
  103.   def animation1_id
  104.     if @weapon_id == 0 and ARM_ANIMATION1[@actor_id] != nil
  105.       return ARM_ANIMATION1[@actor_id]
  106.     end
  107.     return animation1_id_arm
  108.   end

  109.   #---------------------------------------------------------------------
  110.   #------------------------------------------------------------------
  111.   alias animation2_id_arm animation2_id
  112.   def animation2_id
  113.     if @weapon_id == 0 and ARM_ANIMATION2[@actor_id] != nil
  114.       return ARM_ANIMATION2[@actor_id]
  115.     end
  116.     return animation2_id_arm
  117.   end
  118. end



  119. #=====================================================================
  120. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  121. #==============================================================
复制代码





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