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

Project1

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

[原创发布] 多秒 - 多体攻击

[复制链接]

Lv1.梦旅人

薄凉看客

梦石
0
星屑
50
在线时间
1269 小时
注册时间
2010-6-20
帖子
1316
跳转到指定楼层
1
发表于 2014-2-10 13:00:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 恋′挂机 于 2014-2-11 10:26 编辑

物品 特技 均支持
想秒几就秒几

rgss1

class Scene_Battle
  def set_target_battlers(item, type)
   
    @多秒_特技 = {} # 初始化多秒功能哈希
    @多秒_物品 = {} # 初始化多秒功能哈希
        
    # ---------------------------
    # 特技多秒 设置
    # ---------------------------
        
    @多秒_特技[57] = 3 # 57号技能 秒3 默认十字斩秒三
   
    # ---------------------------
    # 物品多秒 设置
    # ---------------------------
        
    @多秒_物品[40] = 5 # 40号物品 秒5 设置 : 敌单体即可 HP 回复量 为负值
   
    # ------------------------------------------------------
    # PS 如果设置了多秒 数据库 中效果范围怎么设置都可以
    # 但必须明确是对敌使用还是对同伴使用,并且明确 是否
    # HP 0 时使用!
    # ------------------------------------------------------
   
    if @active_battler.is_a?(Game_Enemy)
      case item.scope
      when 1  # 敌单体
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_party.smooth_target_actor(index))
        敌方秒(0, item, 0, type, $game_party.smooth_target_actor(index))
      when 2  # 敌全体
        index = @active_battler.current_action.target_index
        for actor in $game_party.actors
          if actor.exist?
            @target_battlers.push(actor)
          end
        end
        敌方秒(0, item, 0, type, $game_party.smooth_target_actor(index))
      when 3  # 我方单体
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_troop.smooth_target_enemy(index))
        敌方秒(0, item, 1, type, $game_troop.smooth_target_enemy(index))
      when 4  # 我方全体
        index = @active_battler.current_action.target_index
        for enemy in $game_troop.enemies
          if enemy.exist?
            @target_battlers.push(enemy)
          end
        end
        敌方秒(0, item, 1, type, $game_troop.smooth_target_enemy(index))
      when 5  # 我方单体 (HP 0)
        index = @active_battler.current_action.target_index
        enemy = $game_troop.enemies[index]
        if enemy != nil and enemy.hp0?
          @target_battlers.push(enemy)
        end
        敌方秒(1, item, 1, type, $game_troop.smooth_target_enemy(index))
      when 6  # 我方全体 (HP 0)
        index = @active_battler.current_action.target_index
        for enemy in $game_troop.enemies
          if enemy != nil and enemy.hp0?
            @target_battlers.push(enemy)
          end
        end
        敌方秒(1, item, 1, type, $game_troop.smooth_target_enemy(index))
      when 7  # 使用者
        @target_battlers.push(@active_battler)
      end
    end
    if @active_battler.is_a?(Game_Actor)
      # 效果范围分支
      case item.scope
      when 1  # 敌单体
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_troop.smooth_target_enemy(index))
        我方秒(0, item, 0, type, $game_troop.smooth_target_enemy(index))
      when 2  # 敌全体
        index = @active_battler.current_action.target_index
        for enemy in $game_troop.enemies
          if enemy.exist?
            @target_battlers.push(enemy)
          end
        end
        我方秒(0, item, 0, type, $game_troop.smooth_target_enemy(index))
      when 3  # 我方单体
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_party.smooth_target_actor(index))
        我方秒(0, item, 1, type, $game_party.smooth_target_actor(index))
      when 4  # 我方全体
        index = @active_battler.current_action.target_index
        for actor in $game_party.actors
          if actor.exist?
            @target_battlers.push(actor)
          end
        end
        我方秒(0, item, 1, type, $game_party.smooth_target_actor(index))
      when 5  # 我方单体 (HP 0)
        index = @active_battler.current_action.target_index
        actor = $game_party.actors[index]
        if actor != nil and actor.hp0?
          @target_battlers.push(actor)
        end
        我方秒(1, item, 1, type, $game_party.smooth_target_actor(index))
      when 6  # 我方全体 (HP 0)
        index = @active_battler.current_action.target_index
        for actor in $game_party.actors
          if actor != nil and actor.hp0?
            @target_battlers.push(actor)
          end
        end
        我方秒(1, item, 1, type, $game_party.smooth_target_actor(index))
      when 7  # 使用者
        @target_battlers.push(@active_battler)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 生成特技行动结果
  #--------------------------------------------------------------------------
  def make_skill_action_result
    # 获取特技
    @skill = $data_skills[@active_battler.current_action.skill_id]
    # 如果不是强制行动
    unless @active_battler.current_action.forcing
      # 因为 SP 耗尽而无法使用的情况下
      unless @active_battler.skill_can_use?(@skill.id)
        # 清除强制行动对像的战斗者
        $game_temp.forcing_battler = nil
        # 移至步骤 1
        @phase4_step = 1
        return
      end
    end
    # 消耗 SP
    @active_battler.sp -= @skill.sp_cost
    # 刷新状态窗口
    @status_window.refresh
    # 在帮助窗口显示特技名
    @help_window.set_text(@skill.name, 1)
    # 设置动画 ID
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    # 设置公共事件 ID
    @common_event_id = @skill.common_event_id
    # 设置对像侧战斗者
   
    # ---------------------------------------
    set_target_battlers(@skill, 0)
    # ---------------------------------------
   
    # 应用特技效果
    for target in @target_battlers
      target.skill_effect(@active_battler, @skill)
    end
  end
  #--------------------------------------------------------------------------
  # ● 生成物品行动结果
  #--------------------------------------------------------------------------
  def make_item_action_result
    # 获取物品
    @item = $data_items[@active_battler.current_action.item_id]
    # 因为物品耗尽而无法使用的情况下
    unless $game_party.item_can_use?(@item.id)
      # 移至步骤 1
      @phase4_step = 1
      return
    end
    # 消耗品的情况下
    if @item.consumable
      # 使用的物品减 1
      $game_party.lose_item(@item.id, 1)
    end
    # 在帮助窗口显示物品名
    @help_window.set_text(@item.name, 1)
    # 设置动画 ID
    @animation1_id = @item.animation1_id
    @animation2_id = @item.animation2_id
    # 设置公共事件 ID
    @common_event_id = @item.common_event_id
    # 确定对像
    index = @active_battler.current_action.target_index
    target = $game_party.smooth_target_actor(index)
    # 设置对像侧战斗者
   
    # ---------------------------------------
    set_target_battlers(@item, 1)
    # ---------------------------------------
   
    # 应用物品效果
    for target in @target_battlers
      target.item_effect(@item)
    end
  end
  
  def 敌方秒(n, item, t, type, 目标)
    # ----------------------------------------
    return if @多秒_特技[item.id].nil? and @多秒_物品[item.id].nil?
    @target_battlers = []
    case t
    when 0
      for actor in $game_party.actors
        @target_battlers.push(actor) if actor.exist?
      end
    when 1
      for enemy in $game_troop.enemies
        @target_battlers.push(enemy) if enemy.exist?
      end
    end
    return if @多秒_特技[item.id] >= @target_battlers.size
    while @target_battlers.size > @多秒_特技[item.id]
      a = rand(@target_battlers.size)
      unless a == @target_battlers.size - 1 or
        # 如果用了我发布的嘲讽状态脚本 请把后边的注释去掉!
        @target_battlers[a] == 目标# or @target_battlers[a].state? Wall
        @target_battlers.delete_at(a)
      end
    end
    # -------------------------------------------
  end
  #   参数   是否hp0 项目 对敌还是对友 特技还是物品 目标
  def 我方秒(n, item, t, type, 目标)
    # ----------------------------------------
    return if @多秒_特技[item.id].nil? and @多秒_物品[item.id].nil?
    @target_battlers = []
    case type
    when 0 # 特技
      case t
      when 0
        for enemy in $game_troop.enemies
          case n
          when 0
            @target_battlers.push(enemy) if enemy.exist?
          when 1
            @target_battlers.push(enemy) unless enemy.exist?
          end
        end
      when 1
        for actor in $game_party.actors
          case n
          when 0
            @target_battlers.push(actor) if actor.exist?
          when 1
            @target_battlers.push(actor) unless actor.exist?
          end
        end
      end
      return if @多秒_特技[item.id] >= @target_battlers.size
      while @target_battlers.size > @多秒_特技[item.id]
        a = rand(@target_battlers.size)
        unless a == @target_battlers.size - 1 or
          @target_battlers[a] == 目标
          @target_battlers.delete_at(a)
        end
      end
    when 1 # 物品
      case t
      when 0
        for enemy in $game_troop.enemies
          case n
          when 0
            @target_battlers.push(enemy) if enemy.exist?
          when 1
            @target_battlers.push(enemy) unless enemy.exist?
          end
        end
      when 1
        for actor in $game_party.actors
          case n
          when 0
            @target_battlers.push(actor) if actor.exist?
          when 1
            @target_battlers.push(actor) unless actor.exist?
          end
        end
      end
      return if @多秒_物品[item.id] >= @target_battlers.size
      while @target_battlers.size > @多秒_物品[item.id]
        a = rand(@target_battlers.size)
        unless a == @target_battlers.size - 1 or
          @target_battlers[a] == 目标
          @target_battlers.delete_at(a)
        end
      end
    end
    # ----------------------------------------
  end
  
end

评分

参与人数 1星屑 +2 收起 理由
白魔导师宝儿 + 2 我很赞同

查看全部评分

Lv2.观梦者

梦石
0
星屑
458
在线时间
182 小时
注册时间
2009-7-12
帖子
155
2
发表于 2014-2-10 19:49:19 | 只看该作者
随机选择对象?

点评

你选择的目标 + 随机目标  发表于 2014-2-10 19:52
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-13 03:00

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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