Project1

标题: 对死亡队员使用物品或魔法问题 [打印本页]

作者: hypnos0421    时间: 2009-4-24 20:59
标题: 对死亡队员使用物品或魔法问题
默认的时候是对已经死亡的队员使用除了回复物品以外的道具后直接判定到其他队员身上
但是我想改成 任何道具都能对死亡单位使用 回复魔法也一样
只是除了复活道具以外的全部无效化(帮死人+血就是浪费血瓶)
而不是+到其他队员的身上
向大家求助了!谢谢! [LINE]1,#dddddd[/LINE]版务信息:版主帮忙结贴~
作者: 紫苏    时间: 2009-4-29 15:46
默认是这样的:
无论是技能还是物品,它们的目标对象都会在 Scene_Battle 的 set_target_battlers 中被过滤~当范围是己方单体的时候会调用 Game_Party 的 smooth_target_actor 过滤目标
如果玩家选择的目标不存在、被隐藏、或者满足 (hp <= 0 而又不是无敌状态) 的话,那么这个目标就会被过滤掉,转而到从队伍开头搜索满足以上条件的其他队员~

所以需要修改的就在 set_target_battlers 行动方是玩家、目标是己方单体的分歧下,去掉目标的过滤而直接将目标设为玩家选择的目标队员(红色部分):
class Scene_Battle
  def set_target_battlers(scope)
    # 行动方的战斗者是敌人的情况下
    if @active_battler.is_a?(Game_Enemy)
      # 效果范围分支
      case scope
      when 1  # 敌单体
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_party.smooth_target_actor(index))
      when 2  # 敌全体
        for actor in $game_party.actors
          if actor.exist?
            @target_battlers.push(actor)
          end
        end
      when 3  # 我方单体
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_troop.smooth_target_enemy(index))
      when 4  # 我方全体
        for enemy in $game_troop.enemies
          if enemy.exist?
            @target_battlers.push(enemy)
          end
        end
      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
      when 6  # 我方全体 (HP 0)
        for enemy in $game_troop.enemies
          if enemy != nil and enemy.hp0?
            @target_battlers.push(enemy)
          end
        end
      when 7  # 使用者
        @target_battlers.push(@active_battler)
      end
    end
    # 行动方的战斗者是角色的情况下
    if @active_battler.is_a?(Game_Actor)
      # 效果范围分支
      case scope
      when 1  # 敌单体
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_troop.smooth_target_enemy(index))
      when 2  # 敌全体
        for enemy in $game_troop.enemies
          if enemy.exist?
            @target_battlers.push(enemy)
          end
        end
      when 3  # 我方单体
        index = @active_battler.current_action.target_index
        #@target_battlers.push($game_party.smooth_target_actor(index))
        actors = $game_party.actors
        actor = actors[index]
        # 如果玩家选择的 actor 不存在(中途离队)
        if actor == nil
          # 从队伍开头搜索第一个存在的队员作为目标
          for i in actors
            if i != nil
              actor = i
              break
            end
          end
        end
        @target_battlers.push(actor)

      when 4  # 我方全体
        for actor in $game_party.actors
          if actor.exist?
            @target_battlers.push(actor)
          end
        end
      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
      when 6  # 我方全体 (HP 0)
        for actor in $game_party.actors
          if actor != nil and actor.hp0?
            @target_battlers.push(actor)
          end
        end
      when 7  # 使用者
        @target_battlers.push(@active_battler)
      end
    end
  end
end
[LINE]1,#dddddd[/LINE]系统信息:本贴由本区版主认可为正确答案,66RPG感谢您的热情解答~




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