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

Project1

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

[已经过期] RTAB反击,格挡,致伤的脚本

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2258
在线时间
176 小时
注册时间
2018-5-11
帖子
144
跳转到指定楼层
1
发表于 2020-8-9 12:35:26 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
找到了一个这样的,不过已经被添加过一些其他的东西了。有没有大佬有这个的原版脚本啊?


# RATB反击脚本 Zunk 2010 07 12
# 请放在RATB统一CP的脚本后面

# 修改了Game_Party脚本来适应本脚本 2010 09 10

# 配合天赋中的force_action更新了反击逻辑 2010 09 30

#2011 09 13
#反击穿透属性
CONTER_PENETRATIVE_ELEMENT = 75 #真剑

#反击穿透状态
#攻击者持有这些状态时不会被反击
CONTER_PENETRATIVE_STATES = [163] #真剑

#========================================================================
# ■ Game_Battler (分割定義 1)
#========================================================================
class Game_Battler
  attr_accessor :current_action
  attr_accessor :luoxi_flag #洛熙反击标记
  attr_accessor :counter_flag #反击中标记
  attr_accessor :counter_target #反击目标信息
  attr_accessor :counter_damage #反击前收到的总攻击
  attr_accessor :counter_animation_id #反击时动画
  attr_accessor :counter_performed #反击实施中标记
  attr_accessor :counter_times #反击倍数

  ########################################################
  #反击状态设置
  #已弃用COUNTER_ANIMATION_ID = nil #  反击发动时的动画ID
  #反击状态不可叠加,ID大的状态会覆盖ID小的状态
  
  COUNTER_STATES = {}
  #COUNTER_STATES[反击状态编号] =
  # [反击率,我方使用时的反击倍数,敌方使用时的反击倍数,
  # 反击发动前的动画ID,反击发动时的动画ID,
  # 反击使用的技能ID(不设定则为普攻),
  # 是否允许咏唱中反击(默认为允许,设置为false表示不容许)]
  
  COUNTER_STATES[20] = [50,0.01,0.01,10,nil] # 普通反击
  COUNTER_STATES[180] = [100,0.5,0.5,990,nil,839] # 反震
  COUNTER_STATES[181] = [20,2,2,nil,nil] # 复仇
  COUNTER_STATES[208] = [100,0.01,0.01,nil,nil,721] #丝绢牢笼
  COUNTER_STATES[305] = [100,1.5,1.5,nil,nil,1052] #太极轮
# COUNTER_STATES[234] = [50,0.01,0.01,749,nil,170] # 脑指纹测谎法
# COUNTER_STATES[235] = [100,0.01,0.01,nil,nil,172,false] # 魔法心切  
  COUNTER_STATES[239] = [100,0.01,0.01,nil,nil,175] # 蔷薇地狱
  #COUNTER_STATES[242] = [100,0.01,0.01,nil,nil,0] # 恋恋触手反击
  COUNTER_STATES[214] = [30,0,0,nil,nil,404] #树魔反击
  #################################
  

  
  ########################################################
  #格挡状态设置
  #已弃用PARRY_ANIMATION_ID = 218  #  格挡发动时的动画ID
  #格挡状态可以叠加
  
  PARRY_STATES = {}
  #PARRY_STATES[格挡状态编号] = [格挡触发几率,格挡后受到伤害百分比,格挡发动时的动画ID,格挡类型(0或nil为格挡伤害,1为格挡治疗,2为全部格挡),格挡特殊效果,格挡类型2(0或nil为全格挡,1为格挡魔法,2为格挡物理)]
  PARRY_STATES[250] = [100,0,998] #最高格挡,圣盾
  PARRY_STATES[117] = [100,150]#脆弱
  PARRY_STATES[118] = [100,50,nil,1] #气绝
  PARRY_STATES[161] = [50,20,563] #嘲讽
  PARRY_STATES[175] = [100,90,nil,1] #骨折
  PARRY_STATES[176] = [100,50,nil,1] #重伤
  PARRY_STATES[177] = [100,5,nil,1] #致命伤
  PARRY_STATES[273] = [100,30,644,0,nil,2]#恶灵免伤70%
  PARRY_STATES[178] = [100,10,644,0,nil,2]#幽灵免伤90%
  PARRY_STATES[179] = [100,50,821,0,nil,2]#机械免伤50%
  PARRY_STATES[210] = [100,20,563,0,nil,2]#蜗牛坚壁免伤80%
  PARRY_STATES[209] = [80,60]#蜗牛壳免伤40%
  PARRY_STATES[242] = [100,151.4,793]#本我
  PARRY_STATES[243] = [100,48.6,790]#超我
  ########################################################
  PARRY_STATES[244] = [100,50.0,1064,nil,"GOLD_TO_DAMAGE"]#金钱抵消伤害
  PARRY_STATES[245] = [100,100.0,1065,nil,"DAMAGE_TO_GOLD"]#伤害转金钱
  ########################################################
  
  alias counter_attack_effect_zunk20100813 attack_effect
  def attack_effect(attacker)
    if attacker.counter_flag and attacker.counter_damage > 0
      attacker.animation.push([attacker.counter_animation_id,true]) unless attacker.counter_animation_id == nil
    end
    counter_attack_effect_zunk20100813(attacker)
  end
  #--------------------------------------------------------------------------
  # ● スキルの効果適用
  #     user  : スキルの使用者 (バトラー)
  #     skill : スキル
  #--------------------------------------------------------------------------
  alias counter_damage_effect_20100712 damage_effect
  def damage_effect(battler, item, skill)
   
    unless item == 2 or self.damage[battler].class == String
      if battler.counter_flag and battler.counter_damage > 0
        counter_bonus = battler.counter_times
        unless counter_bonus == 0
          if self.critical[battler] and battler.is_a?(Game_Actor)
            counter_bonus += self.critical_bonus[battler]
          end
        end
        counter_hurt = battler.counter_damage * counter_bonus
        ####妖梦EX白楼观翼斩
        if battler.weapon_id == 64
          counter_hurt *= 2
        end
        self.damage[battler] += counter_hurt.round
        battler.counter_damage = 0
      end
    end
    counter_damage_effect_20100712(battler, item, skill)
    unless item == 2 or self.damage[battler].class == String
    #避免向自己人反击
    return if battler.is_a?(Game_Actor) and self.is_a?(Game_Actor)
    return if battler.is_a?(Game_Enemy) and self.is_a?(Game_Enemy)
    ####################洛熙的热感应追踪
   
   
    #判断反击
    if battler.state?(159) and $game_actors[5].state?(674)#and self.damage[battler]>0
      if $game_actors[5].movable? and !is_counter_penetrative(battler, skill)
        @luoxi_flag = true
        if counter_flag
        @counter_damage += (self.damage[battler])
        @counter_times = COUNTER_STATES[1024][2]
        end
          if counter_flag != true and battler.counter_flag != true
            #unless $game_actors[5].rtp > 0 and COUNTER_STATES[1024][6] == false
              @counter_flag = true
              @counter_target = [battler,skill]
              @counter_rate = COUNTER_STATES[1024][0]
              @counter_pre_animation_id = COUNTER_STATES[1024][3]
              $game_actors[5].animation.push([@counter_pre_animation_id,true]) unless @counter_pre_animation_id == nil
              @counter_animation_id = COUNTER_STATES[1024][4]
              @counter_skill = COUNTER_STATES[1024][5]
              #@old_atp = [self.atp,self.at,self.rtp,self.rt]     
              @counter_old_action = $game_actors[5].current_action.clone #if @counter_old_action.nil?
              @counter_rt = [$game_actors[5].rt,$game_actors[5].rtp] if @counter_rt.nil?
              @counter_damage = self.damage[battler]
              if battler.is_a?(Game_Actor)
                 @counter_times = COUNTER_STATES[1024][2]
              else
                 @counter_times = (COUNTER_STATES[1024][1])
              end
              #@old_action = self.current_action.dup
            #end #unless
          end  
      end  
    else #state
    ###################
    #判断反击
    if self.damage[battler] > (self.hp/100) or (self.damage[battler] >= 0 and @parry_flag) and !is_counter_penetrative(battler, skill)
        for key in COUNTER_STATES.keys.reverse
          if self.state?(key)
           if counter_flag
             @counter_damage += (self.damage[battler])
             if battler.is_a?(Game_Actor)
                @counter_times = COUNTER_STATES[key][2]
             else
                @counter_times = (COUNTER_STATES[key][1])
             end
           end
           if counter_flag != true and battler.counter_flag != true
            unless  self.rtp > 0 and COUNTER_STATES[key][6] == false
              @counter_flag = true
              @counter_target = [battler,skill]
              @counter_rate = COUNTER_STATES[key][0]
              @counter_pre_animation_id = COUNTER_STATES[key][3]
              self.animation.push([@counter_pre_animation_id,true]) unless @counter_pre_animation_id == nil
              @counter_animation_id = COUNTER_STATES[key][4]
              @counter_skill = COUNTER_STATES[key][5]
              if COUNTER_STATES[key][5] == 1342 #恋恋反击
                case rand(100)
                when 0..19
                  @counter_skill = 1336
                when 20..34
                  @counter_skill = 1337
                when 35..49
                  @counter_skill = 1338
                when 50..64
                  @counter_skill = 1339
                when 65..79
                  @counter_skill = 1341
                when 80..89
                  @counter_skill = 1343
                else  
                  @counter_skill = 1342  
                end  
              end  
              #@old_atp = [self.atp,self.at,self.rtp,self.rt]     
              @counter_old_action = self.current_action.clone #if @counter_old_action.nil?
              @counter_rt = [self.rt,self.rtp] if @counter_rt.nil?
              @counter_damage = self.damage[battler]
              if battler.is_a?(Game_Actor)
                 @counter_times = COUNTER_STATES[key][2]
              else
                 @counter_times = (COUNTER_STATES[key][1])
              end
              #@old_action = self.current_action.dup
            end
          end
          break
        end
      end
    end
  end
  
   #p battler.counter_damage
   #p self.damage[battler]
  end #state luoxi
   
  end
  
  def counter_attack
    #p "counter_flag"
    #p @counter_flag
    counter_rate = @counter_rate
    ####魂魄妖梦灵巧反击加成
    #if self.is_a?(Game_Actor)
      #if self.id == 5
        #counter_rate += self.dex/50
        
      #end
      
    #end
   
   
    if @counter_flag == true and rand(100) < counter_rate and self.exist?
      @counter_performed = true
     #unless $洛熙反击flag.nil?
      #if $洛熙反击flag != true
      self.make_counter_attack(@counter_target[0],@counter_target[1])
      
    else
      #p "clear_counter"
      clear_counter(false)
    end
  end
  
  def is_counter_penetrative(battler, skill)
    for state_id in CONTER_PENETRATIVE_STATES
      if battler.state?(state_id)
        return true
      end
    end
    if skill.nil?
      set = battler.element_set  
    else
      set = skill.element_set
    end
    if set.include?(CONTER_PENETRATIVE_ELEMENT)
      return true
    else
      return false
    end
  end
  
  #--------------------------------------------------------------------------
  # ● 强制反击行动
  #--------------------------------------------------------------------------
  def make_counter_attack(target,counter_skill)
    index = -2
    kind = 0
    basic = 0
    skill_id = 0
    if target.is_a?(Game_Actor)
      index = $game_party.ordinal(target)
    else
      index = $game_troop.ordinal(target)
    end
    return if index.nil?
    index -= 1
    if @counter_skill.nil? or @counter_skill == 0
      kind = 0
      basic = 0
    else
      kind = 1
      skill_id = @counter_skill
    end
     #这里是阉割的部分,又事件发动改为强制行动
     if self.luoxi_flag == true
       self.luoxi_flag = false
       #p "25"
       for battler in $game_party.actors
        if battler.id == 5
          battler.force_action2(kind,basic,skill_id,index,1)
        end
       end
     else
      
     self.force_action2(kind,basic,skill_id,index,1)
     end
    #trigger_common_event("$触发公共事件的角色.force_action2(#{kind},#{basic},#{skill_id},#{index},1)")
  end
#  def make_counter_attack(target,counter_skill)
#    # 戦闘中でなければ無視
#    unless $game_temp.in_battle
#      return true
#    end
#    # ターン数が 0 なら無視
#    if $game_temp.battle_turn == 0
#      return true
#    end
#    #self.animation.push([COUNTER_ANIMATION_ID,true]) unless COUNTER_ANIMATION_ID == nil
#    # イテレータで処理 (便宜的なもので、複数になることはない)
#    #iterate_battler(@parameters[0], @parameters[1]) do |battler|
#      # バトラーが存在する場合
#      if self.exist?
#        # アクションを設定
#        self.current_action.force_kind = 0
#        self.current_action.force_basic = 0
#        #battler.current_action.force_kind = @parameters[2]
#        #if battler.current_action.force_kind == 0
#        #  battler.current_action.force_basic = @parameters[3]
#        #else
#        #  battler.current_action.force_skill_id = @parameters[3]
#        #end
#        # 行動対象を設定
#        #if @parameters[4] == -2
#        #  if battler.is_a?(Game_Enemy)
#        #    battler.current_action.decide_last_target_for_enemy
#        #  else
#        #    battler.current_action.decide_last_target_for_actor
#        #  end
#        #elsif @parameters[4] == -1
#        #  if battler.is_a?(Game_Enemy)
#        #    battler.current_action.decide_random_target_for_enemy
#        #  else
#        #    battler.current_action.decide_random_target_for_actor
#        #  end
#        #elsif @parameters[4] >= 0
#        #  battler.current_action.target_index = @parameters[4]
#        index = 0
#        if target.is_a?(Game_Actor)
#          index = $game_party.ordinal(target)
#        else
#          index = $game_troop.ordinal(target)
#        end
#        self.current_action.target_index = index - 1
#        #end
#        # アクションが有効かつ [すぐに実行] の場合
#        #if battler.current_action.valid? and @parameters[5] == 1
#          # 強制対象のバトラーを設定
#          $game_temp.forcing_battler = self
#          # インデックスを進める
#          #@index += 1
#          # 終了
#          $scene.cp_meters.refresh(nil,false)
#          return false
#        #elsif battler.current_action.valid? and @parameters[5] == 0
#        #  battler.current_action.forcing = true
#        #end
#      #end
#    end
#    # 継続
#    #return true
#  end
  
  def make_parry
    @parry_hit_flag = true
    @parry_rate = []
    @parry_ani = []
    @parry_type = []
    @parry_effect = []
    for key in PARRY_STATES.keys.reverse
      if self.state?(key)
        parry_rate = PARRY_STATES[key][0]
        ####蕾蒂EX
        if self.weapon_id == 157
          parry_rate += 10
        end
        ####白狼天狗灵巧格挡加成
        if self.is_a?(Game_Actor)
          if self.id == 14
            parry_rate += [self.dex/150,50].min
          end
        end
        if rand(100) < parry_rate
          if key == 131 or key == 306 #招财猫强欲格挡加钱
            $game_variables[959] += 1
          end
          @parry_flag = true
          if key == 192 #电磁护盾
            PARRY_STATES[key][2] = 944+rand(5)
          end  
        #  self.animation.push([PARRY_ANIMATION_ID,true]) unless PARRY_ANIMATION_ID == nil
        #  self.animation.push([PARRY_STATES[key][2],true]) unless PARRY_STATES[key][2] == nil
          @parry_rate.push(PARRY_STATES[key][1])
          @parry_ani.push(PARRY_STATES[key][2])
          @parry_type.push([PARRY_STATES[key][3],PARRY_STATES[key][5]]) #格挡类型
          @parry_effect.push(PARRY_STATES[key][4]) #格挡特殊效果
        end
        #break
      end
    end
  end
  
  def clear_counter(restore_flag)
    return if @counter_flag == false
    if @counter_rt != nil and @counter_old_action != nil and restore_flag == true
      self.current_action = @counter_old_action.clone
      self.rt = @counter_rt[0]
      self.rtp = @counter_rt[1]
    end
    #if @old_atp != nil and restore_flag == true #and @old_action != nil
    #  self.atp = @old_atp[0]
    #  self.at = @old_atp[1]
    #  self.rtp = @old_atp[2]
    #  self.rt = @old_atp[3]
      #self.current_action = @old_action
      #@old_atp = nil
      #@old_action = nil
    #end
    #@old_atp = nil   
    @counter_old_action = nil
    @counter_rt = nil
    @counter_damage = 0
    @counter_flag = false
    @counter_performed = false
    @conter_skill = nil
    @conter_times = nil
  end
  
  def clear_parry
   @parry_hit_flag = false
   @parry_flag = false
  end
end


#==============================================================================
# ■ Scene_Battle (分割定義 4)
#------------------------------------------------------------------------------
#  バトル画面の処理を行うクラスです。
#==============================================================================
# アニメに強さ0のフラッシュが存在した場合、
# 赤:倍率 緑:+スキル?アイテムID でダメージ計算を行う。

class Scene_Battle  
  attr_accessor :counter_list # 反击角色列表

  alias counter_update_phase4_zunk20100712 update_phase4
  def update_phase4
    @counter_list = [] if @counter_list.nil?
    unless @counter_list.empty? or $game_temp.forcing_battler != nil
      actor = @counter_list.shift
        if synthe?(actor).nil?
          unless actor.counter_performed
           #unless actor.luoxi_flag == true
           actor.counter_attack
          else
           
           @counter_list.push(actor)
          end
        else
          actor.clear_counter(false)
        end
     
    end
    #if $game_actors[5].exist? and $game_actors[5].movable? and $game_actors[5].state?(674)   
     # if synthe?($game_actors[5]).nil?
      #    unless $game_actors[5].counter_performed
      #    $game_actors[5].counter_attack
     #     else
     #     @counter_list.push($game_actors[5])
     #     end
     #   else
    #      $game_actors[5].clear_counter(false)
     #   end  
      
    #end      
    counter_update_phase4_zunk20100712
  end
  
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  #--------------------------------------------------------------------------
  alias counter_update_phase4_step6_zunk20100712 update_phase4_step6
  def update_phase4_step6(battler)
    @counter_list = [] if @counter_list.nil?
    for each in $game_party.actors + $game_troop.enemies
      next if each.nil?
      @counter_list.push(each) if each.counter_flag
    end
    for each in $game_party.actors + $game_troop.enemies#battler.target# 更新格挡标记
      next if each.nil?
      each.clear_parry
      ###清除不死标记
      each.force_alive = -1
    end
    #if battler.counter_flag == true
      #p battler.name
    #  battler.clear_counter(true) # 清除反击标记
    #end
    counter_update_phase4_step6_zunk20100712(battler)
    #if battler.counter_flag
    #  counter_attack(battler.counter_target[0],battler.counter_target[1])
    #  battler.clear_counter # 清除反击标记
    #end
  end
  
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  alias counter_refresh_phase_zunk20101001 refresh_phase
  def refresh_phase(battler)
    counter_refresh_phase_zunk20101001(battler)
    ##########################################
    # 强制行动后恢复
    if battler.action_recorded
      battler.resume_action
    end
    ##########################################
    if battler.counter_flag == true
      #p battler.name
      battler.clear_counter(true) # 清除反击标记
    end  
  end
  
  #--------------------------------------------------------------------------
  # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  #--------------------------------------------------------------------------
  alias counter_start_phase3_zunk20100712 start_phase3
  def start_phase3
    counter_start_phase3_zunk20100712
    $game_switches[1085] = false#后排窗口展开
    @active_actor.clear_counter(false)
  end
###


  #--------------------------------------------------------------------------
  # ● スキルの効果適用
  #     user  : スキルの使用者 (バトラー)
  #     skill : スキル
  #--------------------------------------------------------------------------

  
  
end






人生总会有中二的时候,比如现在
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-4-28 08:02

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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