查看: 2278|回复: 2

[已经解决] 大佬们,怎么指定一个单体技能可以选择敌我双方

[复制链接]
梦石
0
星屑
1966
在线时间
112 小时
注册时间
2017-9-5
回帖
157
发表于 2021-9-12 15:23:41 | 显示全部楼层 |阅读模式

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

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

×
va的技能都是只能单向选择敌人或单向选择我方,向弄个敌我双发都能选择的技能
梦石
0
星屑
29901
在线时间
5734 小时
注册时间
2016-3-8
回帖
1653
发表于 2021-9-12 16:27:13 | 显示全部楼层
[pre lang="ruby"]#==============================================================================
#
# ▼ YSA Battle Add-On: 反转目标
# -- Last Updated: 2012.02.19
# -- Level: Easy
# -- 前置脚本:
#  + Yanfly Engine Ace - 战斗系统
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YSA-InvertTargets"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.02.19 - Add notetag <no invert>.
# 2012.01.03 - Fix a critical bug after an inverted skill.
# 2012.01.03 - Started Script and Finished.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# 技能/物品备注
# -----------------------------------------------------------------------------
# <无法反转目标>
# 该技能或物品无法反转目标
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================

module YSA
  module INVERT_TARGETS
   
    # 反转目标键
    INVERT_KEY = :SHIFT
   
  end
end

#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

module YSA
  module REGEXP
  module USABLEITEM
   
    NO_INVERT = /<(?:NO_INVERT|无法反转目标)>/i
   
  end # USABLEITEM
  end # REGEXP
end # YSA

#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager
  
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_invt load_database; end
  def self.load_database
    load_database_invt
    load_notetags_invt
  end
  
  #--------------------------------------------------------------------------
  # new method: load_notetags_invt
  #--------------------------------------------------------------------------
  def self.load_notetags_invt
    groups = [$data_skills, $data_items]
    for group in groups
      for obj in group
        next if obj.nil?
        obj.load_notetags_invt
      end
    end
  end
  
end # DataManager

#==============================================================================
# ■ RPG::UsableItem
#==============================================================================

class RPG::UsableItem < RPG::BaseItem

  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :no_invert
  
  #--------------------------------------------------------------------------
  # common cache: load_notetags_invt
  #--------------------------------------------------------------------------
  def load_notetags_invt
    @no_invert = false
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YSA::REGEXP::USABLEITEM::NO_INVERT
        @no_invert = true
      #---
      end
    } # self.note.split
    #---
  end
  
end # RPG::UsableItem

#==============================================================================
# ■ Game_Action
#==============================================================================

class Game_Action

  #--------------------------------------------------------------------------
  # alias method: friends_unit
  #--------------------------------------------------------------------------
  alias invert_target_friends_unit friends_unit
  def friends_unit
    subject.invert_target? ? subject.opponents_unit : invert_target_friends_unit
  end

  #--------------------------------------------------------------------------
  # alias method: opponents_unit
  #--------------------------------------------------------------------------
  alias invert_target_opponents_unit opponents_unit
  def opponents_unit
    subject.invert_target? ? subject.friends_unit : invert_target_opponents_unit
  end
  
  #--------------------------------------------------------------------------
  # alias method: set_skill
  #--------------------------------------------------------------------------
  alias invert_target_set_skill set_skill
  def set_skill(skill_id)
    invert_target_set_skill(skill_id)
    subject.invert_target = false
  end
  
  #--------------------------------------------------------------------------
  # alias method: set_item
  #--------------------------------------------------------------------------
  alias invert_target_set_item set_item
  def set_item(skill_id)
    invert_target_set_item(skill_id)
    subject.invert_target = false
  end
   
end # Game_Action

#==============================================================================
# ■ Game_Battler
#==============================================================================

class Game_Battler < Game_BattlerBase
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :invert_target

  #--------------------------------------------------------------------------
  # alias method: initialize
  #--------------------------------------------------------------------------
  alias invert_target_initialize initialize
  def initialize
    invert_target_initialize
    @invert_target = false
  end
  
  #--------------------------------------------------------------------------
  # new method: invert_target?
  #--------------------------------------------------------------------------
  def invert_target?
    @invert_target
  end
  
end # Game_Battler

#==============================================================================
# ■ Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base
  
  #--------------------------------------------------------------------------
  # alias method: update_basic
  #--------------------------------------------------------------------------
  alias scene_battle_update_basic_invtrg update_basic
  def update_basic
    scene_battle_update_basic_invtrg
    update_input_invert_target
  end
  
  #--------------------------------------------------------------------------
  # new method: update_input_invert_target
  #--------------------------------------------------------------------------
  def update_input_invert_target
    return unless BattleManager.actor
    return unless @actor_window.active || @enemy_window.active
    if Input.trigger?(YSA::INVERT_TARGETS::INVERT_KEY)
      return if BattleManager.actor.input.item.no_invert
      BattleManager.actor.invert_target = !BattleManager.actor.invert_target
      if @actor_window.active
        @actor_window.unselect
        @actor_window.hide.deactivate
        case @actor_command_window.current_symbol
        when :skill
          @skill_window.show
        when :item
          @item_window.show
        end
        select_enemy_selection
      elsif @enemy_window.active
        @enemy_window.hide.deactivate
        case @actor_command_window.current_symbol
        when :skill
          @skill_window.hide
        when :item
          @item_window.hide
        end
        if $imported["YEA-BattleEngine"]
          scene_battle_select_actor_selection_abe
        else
          select_actor_selection
        end        
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # alias method: on_actor_cancel
  #--------------------------------------------------------------------------
  alias scene_battle_on_actor_cancel_invtrg on_actor_cancel
  def on_actor_cancel
    scene_battle_on_actor_cancel_invtrg
    BattleManager.actor.invert_target = false
  end
  
  #--------------------------------------------------------------------------
  # alias method: on_enemy_cancel
  #--------------------------------------------------------------------------
  alias scene_battle_on_enemy_cancel_invtrg on_enemy_cancel
  def on_enemy_cancel
    scene_battle_on_enemy_cancel_invtrg
    BattleManager.actor.invert_target = false
  end
  
  #--------------------------------------------------------------------------
  # alias method: turn_end
  #--------------------------------------------------------------------------
  alias scene_battle_turn_end_invtrg turn_end
  def turn_end
    scene_battle_turn_end_invtrg
    for actor in $game_party.members
      actor.invert_target = false
    end
  end
  
end # Scene_Battle

#==============================================================================
#
# ▼ End of File
#
#==============================================================================[/pre]
回复 1 0

使用道具 举报

梦石
0
星屑
1966
在线时间
112 小时
注册时间
2017-9-5
回帖
157
 楼主| 发表于 2021-9-12 18:27:40 | 显示全部楼层
alexncf125 发表于 2021-9-12 16:27
#==============================================================================
#
# ▼ YSA Battle A ...

感谢大佬的脚本,刚刚网页崩了没能及时回复
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部