查看: 1852|回复: 3

[已经过期] 求一个援护的脚本

[复制链接]
梦石
0
星屑
1355
在线时间
10 小时
注册时间
2015-3-14
回帖
3
发表于 2015-4-11 20:49:52 | 显示全部楼层 |阅读模式

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

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

×
如题,脚本完全无力,求老司机带带(;´Д`)

…あたしは天

梦石
0
星屑
2308
在线时间
4033 小时
注册时间
2010-10-4
回帖
10548

开拓者贵宾

发表于 2015-4-11 21:02:20 | 显示全部楼层
默认系统不就有「保护弱者」么

参考 http://www.beiww.com/doc/oss/smart-questions.html
回复

使用道具 举报

梦石
0
星屑
3348
在线时间
1120 小时
注册时间
2009-4-15
回帖
761
发表于 2015-4-12 21:55:12 | 显示全部楼层
记得以前有个脚本整合,发主站了的,里面就有援护系统
回复

使用道具 举报

梦石
0
星屑
70
在线时间
1083 小时
注册时间
2013-3-29
回帖
2158
发表于 2015-4-12 22:10:54 | 显示全部楼层
是这个么:
援护系统(1)
[pre lang="ruby"]#==============================================================================
#
# Бе Yami Engine Ace - Basic Module
# -- Last Updated: 2012.03.24
# -- Level: Nothing
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YSE-BasicModule"] = true

#==============================================================================
# Бе Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.03.24 - Added Parse Range Keys.
# 2012.03.17 - Updated Load Data Method.
# 2012.03.13 - Remove requirements mechanic.
# 2012.03.11 - Change in requirements mechanic.
# 2012.03.02 - Added Message Box.
# 2012.03.01 - Started and Finished Script.
#
#==============================================================================
# Бе Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script provides many methods for Yami Engine Ace.
#
# * Feature:
#   - Save and Load data files. (2012.03.01)
#   - Parse Range Keys.         (2012.03.24)
#
# * Misc:
#   - Make random string.       (2012.03.01)
#   - Make hash.                (2012.03.01)
#   - Win32API Message Box.     (2012.03.02)
#
#==============================================================================
# Бе Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below Бе Materials/СfН▐ 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.
#
#==============================================================================

#==============================================================================
# Бе Configuration
#==============================================================================

module YSE
  
  #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  # - External Data Configuration -
  #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  DATA_CONFIGURATION = { # Start here.
    :ext        =>  "rvdata2",   # Data File Extension.
    :salt       =>  "vl",        # Salt. Make an unique two-character phrase.
                                 # Must be 2 characters.
    :unique     =>  "z8x8273ac",    # Unique phrase. Must be at least 1 character.                          
    :comp_level =>  9,           # Level from 1 to 9. Best Speed at 1, Best
                                 # Compress at 9.
  } # Do not delete this.
  
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.
#==============================================================================

#==============================================================================
# Бб YSE - Basic Module
#==============================================================================

module YSE
  
  #--------------------------------------------------------------------------
  # message_box
  #--------------------------------------------------------------------------
  def self.message_box(title, message)
    api = Win32API.new('user32','MessageBox',['L', 'P', 'P', 'L'],'I')  
    api.call(0,message,title,0)  
  end
  
  #--------------------------------------------------------------------------
  # charset
  #--------------------------------------------------------------------------
  def self.charset
    result = "abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789"
    result
  end
  
  #--------------------------------------------------------------------------
  # make_random_string
  #--------------------------------------------------------------------------
  def self.make_random_string(length = 6)
    result = ""
    while result.size < length
      result << charset[rand(charset.size)]
    end
    result
  end
  
  #--------------------------------------------------------------------------
  # make_filename
  #--------------------------------------------------------------------------
  def self.make_filename(filename, dir = "")
    ext = DATA_CONFIGURATION[:ext]
    result = "#{dir}/#{filename}.#{ext}"
    result
  end
  
  #--------------------------------------------------------------------------
  # compress_data
  #--------------------------------------------------------------------------
  def self.compress_data(data, comp_level = nil)
    compress_level = comp_level.nil? ? DATA_CONFIGURATION[:comp_level] : comp_level
    result = Zlib::Deflate.deflate(Marshal.dump(data), compress_level)
    result
  end
  
  #--------------------------------------------------------------------------
  # decompress_data
  #--------------------------------------------------------------------------
  def self.decompress_data(data)
    result = Zlib::Inflate.inflate(Marshal.load(data))
    result
  end
  
  #--------------------------------------------------------------------------
  # make_hash
  #--------------------------------------------------------------------------
  def self.make_hash(string = "")
    salt = DATA_CONFIGURATION[:salt]
    result = string.crypt(salt)
    result = result + DATA_CONFIGURATION[:unique]
    result
  end
  
  #--------------------------------------------------------------------------
  # save_data
  #--------------------------------------------------------------------------
  def self.save_data(filename, data_hash)
    File.open(filename, "wb") do |file|
      Marshal.dump(compress_data(data_hash), file)
    end
    return true
  end
  
  #--------------------------------------------------------------------------
  # save_data
  #--------------------------------------------------------------------------
  def self.load_data(filename, method, index = 0, ext = nil)
    File.open(filename, "rb") do |file|
      index.times { Marshal.load(file) }
      if ext
        case ext
        when :mtime
          method.call(Marshal.load(decompress_data(file)), file.mtime)
        end
      else
        method.call(Marshal.load(decompress_data(file)))
      end
    end
    return true
  end
  
  #--------------------------------------------------------------------------
  # parse_range
  #--------------------------------------------------------------------------
  def self.parse_range(hash)
    result = {}
    hash.each { |key, value|
      if key.is_a?(Range)
        key.each { |id| result[id] = value }
      else
        result[key] = value
      end
    }
    result
  end
  
  #--------------------------------------------------------------------------
  # patch_start
  #--------------------------------------------------------------------------
  def self.patch_start
    return unless $imported["YSE-PatchSystem"]
    SceneManager.call(Scene_Patch_YSE)
  end
  
end # YSE - Basic Module

#==============================================================================
# Бб System Errors
#==============================================================================

if YSE::DATA_CONFIGURATION[:salt].size < 2
  YSE.message_box("YSE - Basic Module", "Salt must have at least 2 characters.")
  exit
end

if YSE::DATA_CONFIGURATION[:unique].size < 1
  YSE.message_box("YSE - Basic Module", "Unique phrase must have at least 1 character.")
  exit
end

#==============================================================================
#
# Бе End of File
#
#==============================================================================[/pre]

援护系统(2)
[pre lang="ruby"]#==============================================================================
#
# ▼ Yami Engine Ace - Guardian Series
# -- Script: Guardian Basic
# -- Last Updated: 2012.04.08
# -- Level: Easy
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YSE-GuardianBasic"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.04.08 - Fixed last choosen.
# 2012.04.07 - Added custom script to recover all guardians.
# 2012.04.02 - Fixed Remove Guardian.
# 2012.03.30 - Compatible script: YSE - Guardian Summon.
# 2012.03.26 - Compatible script: YEA - Party System.
# 2012.03.20 - Fixed EXP Gaining.
# 2012.03.11 - Finished Script.
# 2012.03.05 - Started Script.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script gives you a notetag for Actors to make them be guardians. An actor
# marked as guardian is not shown in default menu, battle, but will be available
# for other scripts in Guardian Series.
#
# This script also contains two basic windows for Guardians:
#   - Window Guardians List. Class Window_MenuGuardian
#   - Window Guardian Small Status. Class Window_StatusGuardian
#
# To recover guardians, you have to call this script by event to recover entire
# guardians:
#========================================
#     YSE.recover_guardians
#  or
#     $game_party.recover_guardians
#========================================
#
# -----------------------------------------------------------------------------
# Actor Notetags - These notetags go in the actor notebox in the database.
# -----------------------------------------------------------------------------
# <guardian>
# This notetag marks an actor as a guardian.
#
#==============================================================================
# ▼ 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 YSE
  module GUARDIAN
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Mechanic Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    ALL_GUARDIAN_GAIN_EXP     = true
   
  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.
#==============================================================================

#==============================================================================
# ■ Regular Expression
#==============================================================================

module YSE
  module REGEXP
    module ACTOR
      GUARDIAN = /<(?:GUARDIAN)>/i
    end # ACTOR
  end # REGEXP
end # YSE

#==============================================================================
# ■ YSE
#==============================================================================

module YSE
  
  #--------------------------------------------------------------------------
  # recover_guardians
  #--------------------------------------------------------------------------
  def self.recover_guardians
    $game_party.recover_guardians
  end
  
end # YSE

#==============================================================================
# ■ BattleManager
#==============================================================================

module BattleManager
  
  #--------------------------------------------------------------------------
  # alias method: gain_exp
  #--------------------------------------------------------------------------
  class <<self; alias yse_gain_exp_gb gain_exp; end
  def self.gain_exp
    $game_party.guardians.each do |guardian|
      guardian.gain_exp($game_troop.exp_total) if YSE::GUARDIAN::ALL_GUARDIAN_GAIN_EXP
    end
    yse_gain_exp_gb
  end
  
end # BattleManager

#==============================================================================
# ■ Game_Temp
#==============================================================================

class Game_Temp
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :scene_gmenu_id
  
  #--------------------------------------------------------------------------
  # alias method: initialize
  #--------------------------------------------------------------------------
  alias yse_initialize_gb initialize
  def initialize
    yse_initialize_gb
    @scene_gmenu_id = 0
  end
  
end # Game_Temp

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

module DataManager
  
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_ysegb load_database; end
  def self.load_database
    load_database_ysegb
    load_notetags_ysegb
  end
  
  #--------------------------------------------------------------------------
  # new method: load_notetags_ysegb
  #--------------------------------------------------------------------------
  def self.load_notetags_ysegb
    group = $data_actors
    for obj in group
      next if obj.nil?
      obj.load_notetags_ysegb
    end
  end
  
end # DataManager

#==============================================================================
# ■ RPG::Actor
#==============================================================================

class RPG::Actor < RPG::BaseItem
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :is_guardian

  #--------------------------------------------------------------------------
  # new method: load_notetags_ysegb
  #--------------------------------------------------------------------------
  def load_notetags_ysegb
    @is_guardian = false
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YSE::REGEXP::ACTOR::GUARDIAN
        @is_guardian = true
      end
    } # self.note.split
    #---
  end
  
end # RPG::Actor

#==============================================================================
# ■ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  
  #--------------------------------------------------------------------------
  # new method: guardian?
  #--------------------------------------------------------------------------
  def guardian?
    return actor.is_guardian
  end
  
  #--------------------------------------------------------------------------
  # new method: guardian_index
  #--------------------------------------------------------------------------
  def guardian_index
    $game_party.guardians.index(self)
  end
  
  #--------------------------------------------------------------------------
  # alias method: reserve_members_exp_rate
  #--------------------------------------------------------------------------
  alias yse_reserve_members_exp_rate_gb reserve_members_exp_rate
  def reserve_members_exp_rate
    guardian? ? guardian_exp_rate : yse_reserve_members_exp_rate_gb
  end
  
  #--------------------------------------------------------------------------
  # new method: guardian_exp_rate
  #--------------------------------------------------------------------------
  def guardian_exp_rate
    1
  end
  
end # Game_Actor

#==============================================================================
# ■ Game_Party
#==============================================================================

class Game_Party < Game_Unit
  
  #--------------------------------------------------------------------------
  # alias method: initialize
  #--------------------------------------------------------------------------  
  alias yse_initialize_gb initialize
  def initialize
    yse_initialize_gb
    @guardians = []
  end
  
  #--------------------------------------------------------------------------
  # alias method: setup_starting_members
  #--------------------------------------------------------------------------
  alias yse_setup_starting_members_gb setup_starting_members
  def setup_starting_members
    filter_guardians
    yse_setup_starting_members_gb
  end

  #--------------------------------------------------------------------------
  # alias method: all_members
  #--------------------------------------------------------------------------
  alias yse_all_members_gb all_members
  def all_members
    filter_guardians
    yse_all_members_gb
  end
  
  #--------------------------------------------------------------------------
  # new method: filter_guardians
  #--------------------------------------------------------------------------  
  def filter_guardians
    @actors.each {|id|
      if $game_actors[id].guardian?; @actors.delete(id); add_actor(id); end
    }
    initialize_battle_members if $imported["YEA-PartySystem"]
  end
  
  #--------------------------------------------------------------------------
  # new method: guardians
  #--------------------------------------------------------------------------  
  def guardians
    @guardians.collect {|id| $game_actors[id] }
  end
  
  #--------------------------------------------------------------------------
  # alias method: add_actor
  #--------------------------------------------------------------------------  
  alias yse_add_actor_gb add_actor
  def add_actor(actor_id)
    if $game_actors[actor_id].guardian?
      @guardians.push(actor_id) unless @guardians.include?(actor_id)
      return
    end
    yse_add_actor_gb(actor_id)
  end
  
  #--------------------------------------------------------------------------
  # alias method: remove_actor
  #--------------------------------------------------------------------------  
  alias yse_remove_actor_gb remove_actor
  def remove_actor(actor_id)
    if $game_actors[actor_id].guardian?
      @guardians.delete(actor_id) if @guardians.include?(actor_id)
      return
    end
    yse_remove_actor_gb(actor_id)
  end
  
  #--------------------------------------------------------------------------
  # new method: menu_guardian
  #--------------------------------------------------------------------------  
  def menu_guardian
    $game_temp.scene_gmenu_id = 0 if !@guardians.include?($game_temp.scene_gmenu_id)
    $game_actors[$game_temp.scene_gmenu_id].nil? ? guardians[0] : $game_actors[$game_temp.scene_gmenu_id]
  end
  
  #--------------------------------------------------------------------------
  # new method: menu_guardian_next
  #--------------------------------------------------------------------------  
  def menu_guardian_next
    index = guardians.index(menu_actor) || -1
    index = (index + 1) % guardians.size
    self.menu_actor = guardians[index]
  end
  
  #--------------------------------------------------------------------------
  # new method: menu_guardian_prev
  #--------------------------------------------------------------------------  
  def menu_guardian_prev
    index = guardians.index(menu_actor) || 1
    index = (index + guardians.size - 1) % guardians.size
    self.menu_actor = guardians[index]
  end
  
  #--------------------------------------------------------------------------
  # alias method: menu_actor_next
  #--------------------------------------------------------------------------
  alias yse_menu_actor_next_gb menu_actor_next
  def menu_actor_next
    if @guardians.include?(menu_actor.id)
      menu_guardian_next
    else
      yse_menu_actor_next_gb
    end
  end
  
  #--------------------------------------------------------------------------
  # alias method: menu_actor_prev
  #--------------------------------------------------------------------------
  alias yse_menu_actor_prev_gb menu_actor_prev
  def menu_actor_prev
    if @guardians.include?(menu_actor.id)
      menu_guardian_prev
    else
      yse_menu_actor_prev_gb
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: recover_guardians
  #--------------------------------------------------------------------------
  def recover_guardians
    guardians.each { |guardian| guardian.recover_all }
  end
  
end # Game_Party

#==============================================================================
# ■ Window_MenuGuardian
#==============================================================================

class Window_MenuGuardian < Window_Selectable
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, window_width, window_height)
    refresh
  end
  
  #--------------------------------------------------------------------------
  # window_width
  #--------------------------------------------------------------------------
  def window_width
    Graphics.width
  end
  
  #--------------------------------------------------------------------------
  # window_height
  #--------------------------------------------------------------------------
  def window_height
    Graphics.height
  end
  
  #--------------------------------------------------------------------------
  # item_max
  #--------------------------------------------------------------------------
  def item_max
    $game_party.guardians.size
  end
  
  #--------------------------------------------------------------------------
  # col_max
  #--------------------------------------------------------------------------
  def col_max
    2
  end
  
  #--------------------------------------------------------------------------
  # process_ok
  #--------------------------------------------------------------------------
  def process_ok
    super
  end
  
  #--------------------------------------------------------------------------
  # draw_item
  #--------------------------------------------------------------------------
  def draw_item(index)
    guardian = $game_party.guardians[index]
    rect = item_rect(index)
    face_rect = Rect.new(rect.x + 1, rect.y + 1, item_height - 2, item_height - 2)
    draw_guardian_name(guardian, rect.x, rect.y, rect.width)
    draw_thumb_face(guardian, face_rect)
    draw_guardian_status(guardian, rect.x, rect.y, rect.width)
  end
  
  #--------------------------------------------------------------------------
  # draw_thumb_face
  #--------------------------------------------------------------------------
  def draw_thumb_face(actor, dest_rect)
    bitmap = Cache.face(actor.face_name)
    rect = Rect.new(actor.face_index % 4 * 96, actor.face_index / 4 * 96, 96, 96)
    bitmap.blur
    contents.stretch_blt(dest_rect, bitmap, rect, enable?(actor) ? 255 : translucent_alpha)
    bitmap.dispose
  end
  
  #--------------------------------------------------------------------------
  # draw_guardian_name
  #--------------------------------------------------------------------------
  def draw_guardian_name(actor, dx, dy, dw)
    colour = Color.new(0, 0, 0, translucent_alpha/2)
    rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
    contents.fill_rect(rect, colour)
    change_color(system_color, enable?(actor))
    draw_text(dx + item_height + 2, dy, dw, line_height, actor.name)
  end
  
  #--------------------------------------------------------------------------
  # draw_guardian_status
  #--------------------------------------------------------------------------
  def draw_guardian_status(actor, dx, dy, dw)
    change_color(normal_color, enable?(actor))
    draw_text(dx, dy, dw, line_height, Vocab::level_a + actor.level.to_s, 2)
  end
  
  #--------------------------------------------------------------------------
  # enable?
  #--------------------------------------------------------------------------
  def enable?(actor = nil)
    return true
  end
  
  #--------------------------------------------------------------------------
  # update_help
  #--------------------------------------------------------------------------
  alias yse_call_update_help_gb call_update_help
  def call_update_help
    yse_call_update_help_gb
    return if @status_window.nil?
    return if $game_party.guardians.size == 0
    item = index < 0 ? $game_party.menu_guardian : $game_party.guardians[index]
    @status_window.guardian = item
  end
  
  #--------------------------------------------------------------------------
  # update_help
  #--------------------------------------------------------------------------
  def update_help
    @help_window.clear
    item = index < 0 ? $game_party.menu_guardian : $game_party.guardians[index]
    @help_window.set_item(item)
  end
  
  #--------------------------------------------------------------------------
  # select_last
  #--------------------------------------------------------------------------
  def select_last
    select($game_party.menu_guardian.guardian_index)
  end
  
  #--------------------------------------------------------------------------
  # status_window=
  #--------------------------------------------------------------------------
  def status_window=(status_window)
    @status_window = status_window
    item = index < 0 ? $game_party.menu_guardian : $game_party.guardians[index]
    @status_window.guardian = item
  end
  
end # Window_MenuGuardian

#==============================================================================
# ■ Window_StatusGuardian
#==============================================================================

class Window_StatusGuardian < Window_Base
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(dx, dy)
    @guardian = $game_party.menu_guardian
    super(dx, dy, window_width, fitting_height(4))
    refresh
  end
  
  #--------------------------------------------------------------------------
  # window_width
  #--------------------------------------------------------------------------
  def window_width; return Graphics.width - 160; end
  
  #--------------------------------------------------------------------------
  # guardian=
  #--------------------------------------------------------------------------
  def guardian=(guardian)
    return if @guardian == guardian
    @guardian = guardian
    refresh
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    return unless @guardian
    draw_actor_face(@guardian, 0, 0)
    colour = Color.new(0, 0, 0, translucent_alpha / 2)
    rect = Rect.new(0, line_height * 3 + 2, 106, line_height-2)
    contents.fill_rect(rect, colour)
    draw_actor_name(@guardian, 0, line_height * 3 + 1, 108)
    dw = (contents.width - 108) / 2
    dx = 108
    draw_actor_param(0, dx, line_height * 0, dw)
    draw_actor_param(1, dx + dw, line_height * 0, dw)
    draw_actor_param(2, dx, line_height * 1, dw)
    draw_actor_param(3, dx + dw, line_height * 1, dw)
    draw_actor_param(4, dx, line_height * 2, dw)
    draw_actor_param(5, dx + dw, line_height * 2, dw)
    draw_actor_param(6, dx, line_height * 3, dw)
    draw_actor_param(7, dx + dw, line_height * 3, dw)
  end
  
  #--------------------------------------------------------------------------
  # draw_actor_param
  #--------------------------------------------------------------------------
  def draw_actor_param(param_id, dx, dy, dw)
    colour = Color.new(0, 0, 0, translucent_alpha/2)
    rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
    contents.fill_rect(rect, colour)
    change_color(system_color)
    draw_text(dx+4, dy, dw-8, line_height, Vocab::param(param_id))
    change_color(normal_color)
    draw_text(dx+4, dy, dw-8, line_height, @guardian.param(param_id).to_s, 2)
  end
  
end # Window_StatusGuardian

#==============================================================================
#
# ▼ End of File
#
#==============================================================================[/pre]

援护系统(3)
[pre lang="ruby"]#==============================================================================
#
# ▼ Yami Engine Ace - Guardian Series
# -- Script: Guardian Menu
# -- Last Updated: 2012.03.30
# -- Level: Easy
# -- Requires: YSE - Guardian Basic
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YSE-GuardianMenu"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.03.30 - Compatible script: YSE - Guardian Summon.
# 2012.03.13 - Finished Script.
# 2012.03.11 - Started Script.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Manages menu commands for Guardian. This Menu will be separate with Main Menu
# for actor. Can be called by Main Menu.
# If you have Yanfly Engine Ace - Menu Engine, You must add a custom command
# which calls Handler Method :command_guardian.
#
#==============================================================================
# ▼ 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 YSE
  module GUARDIAN_MENU
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Command Window Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This section adjusts the commands that appear in the command window used
    # for the status screen. Rearrange the commands, add new ones, remove them
    # as you see fit.
    #
    # -------------------------------------------------------------------------
    # :command         Description
    # -------------------------------------------------------------------------
    # :status          Calls Scene_Status scene.
    # :skill           Calls Scene_Skill scene.
    # :equip           Calls Scene_Equip scene.
    #
    # :gpair           Calls Guardian Pairing.
    #                  Require YSE - Guardian Pairing.
    #
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    COMMANDS = [ # The order at which the menu items are shown.
    # [    :command,    "Display"],
      [    :status,      "状态"],
      [    :skill,       "技能"],
      [    :equip,       "装备"],
      [    :gpair,      "伙伴"],
    # [    :custom1,     "Custom"],
    # [    :custom2,     "motsuC"],
    ] # Do not remove this.
   
    #--------------------------------------------------------------------------
    # - Menu Custom Commands -
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # For those who use scripts to that may produce unique effects for the
    # status menu, use this hash to manage the custom commands for the Status
    # Command Window. You can disable certain commands or prevent them from
    # appearing by using switches. If you don't wish to bind them to a switch,
    # set the proper switch to 0 for it to have no impact.
    #--------------------------------------------------------------------------
    CUSTOM_STATUS_COMMANDS = {
    # :command => [EnableSwitch, ShowSwitch, Handler Method],
      :custom1 => [           0,          0, :command_name1],
      :custom2 => [           0,          0, :command_name2],
    } # Do not remove this.
   
    # These Configurations contain visual and vocab things.
    VOCAB_MENU = "援护"    # Command Display in Main Menu.
    MENU_ENABLE_SWITCH = 0      # Set to 0 if don't wanna use this function.
   
  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.
#==============================================================================

#==============================================================================
# ■ Vocab
#==============================================================================

module Vocab
  GuardianMenu = YSE::GUARDIAN_MENU::VOCAB_MENU
end

#==============================================================================
# ■ Game_Temp
#==============================================================================

class Game_Temp
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :guardian_menu_command
  
end # Game_Temp

#==============================================================================
# ■ Window_MenuCommand
#==============================================================================

class Window_MenuCommand < Window_Command
  
  #--------------------------------------------------------------------------
  # alias method: make_command_list
  #--------------------------------------------------------------------------
  alias yse_add_main_commands_gm add_main_commands
  def add_main_commands
    yse_add_main_commands_gm
    add_guardian_commands unless $imported["YEA-AceMenuEngine"]
  end
  
  #--------------------------------------------------------------------------
  # new method: guardian_command_enabled
  #--------------------------------------------------------------------------
  def guardian_command_enabled
    return false if $game_party.guardians.size == 0
    return true if YSE::GUARDIAN_MENU::MENU_ENABLE_SWITCH <= 0
    return $game_switches[YSE::GUARDIAN_MENU::MENU_ENABLE_SWITCH]
  end

  #--------------------------------------------------------------------------
  # new method: add_guardian_commands
  #--------------------------------------------------------------------------
  def add_guardian_commands
    add_command(Vocab::GuardianMenu,   :guardian,   guardian_command_enabled)
  end
  
end # Window_MenuCommand

#==============================================================================
# ■ Scene_Menu
#==============================================================================

class Scene_Menu < Scene_MenuBase
  
  #--------------------------------------------------------------------------
  # alias method: create_command_window
  #--------------------------------------------------------------------------
  alias yse_create_command_window_gm create_command_window
  def create_command_window
    yse_create_command_window_gm
    @command_window.set_handler(:guardian, method(:command_guardian))
  end
  
  #--------------------------------------------------------------------------
  # new method: command_guardian
  #--------------------------------------------------------------------------
  def command_guardian
    SceneManager.call(Scene_GuardianMenu)
  end
  
end # Scene_Menu

#==============================================================================
# ■ Window_GuardianMenuCommand
#==============================================================================

class Window_GuardianMenuCommand < Window_Command
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(dx, dy)
    super(dx, dy)
  end
  
  #--------------------------------------------------------------------------
  # window_width
  #--------------------------------------------------------------------------
  def window_width; return 160; end
  
  #--------------------------------------------------------------------------
  # visible_line_number
  #--------------------------------------------------------------------------
  def visible_line_number; return 4; end
   
  #--------------------------------------------------------------------------
  # alignment
  #--------------------------------------------------------------------------
  def alignment; return 1; end
  
  #--------------------------------------------------------------------------
  # ok_enabled?
  #--------------------------------------------------------------------------
  def ok_enabled?
    return handle?(current_symbol)
  end
  
  #--------------------------------------------------------------------------
  # process_ok
  #--------------------------------------------------------------------------
  def process_ok
    $game_temp.guardian_menu_command = self.index
    super
  end
  
  #--------------------------------------------------------------------------
  # make_command_list
  #--------------------------------------------------------------------------
  def make_command_list
    for command in YSE::GUARDIAN_MENU::COMMANDS
      case command[0]
      #--- Default ---
      when :status, :items, :skill, :equip
        add_command(command[1], command[0], $game_party.guardians.size > 0)
      #--- Imported ---
      when :gpair
        add_command(command[1], command[0], $game_party.guardians.size > 0)
      #--- Custom Commands ---
      else
        process_custom_command(command)
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # process_custom_command
  #--------------------------------------------------------------------------
  def process_custom_command(command)
    return unless YSE::GUARDIAN_MENU::CUSTOM_STATUS_COMMANDS.include?(command[0])
    show = YSE::GUARDIAN_MENU::CUSTOM_STATUS_COMMANDS[command[0]][1]
    continue = show <= 0 ? true : $game_switches[show]
    return unless continue
    text = command[1]
    switch = YSE::GUARDIAN_MENU::CUSTOM_STATUS_COMMANDS[command[0]][0]
    enabled = switch <= 0 ? true : $game_switches[switch]
    add_command(text, command[0], enabled)
  end
  
end # Window_GuardianMenuCommand

#==============================================================================
# ■ Window_MenuGuardianSceneMenu
#==============================================================================

class Window_MenuGuardianSceneMenu < Window_MenuGuardian
  
  #--------------------------------------------------------------------------
  # window_height
  #--------------------------------------------------------------------------
  def window_height
    Graphics.height - 128 - 64
  end
  
  #--------------------------------------------------------------------------
  # process_ok
  #--------------------------------------------------------------------------
  def process_ok
    $game_party.menu_actor = $game_party.guardians[index]
    $game_temp.scene_gmenu_id = $game_party.guardians[index].id
    super
  end
  
end # Window_MenuGuardianSceneMenu

#==============================================================================
# ■ Scene_GuardianMenu
#==============================================================================

class Scene_GuardianMenu < Scene_MenuBase
  
  #--------------------------------------------------------------------------
  # start
  #--------------------------------------------------------------------------
  def start
    super
    create_help_window
    create_command_window
    create_status_window
    create_guardian_window
    create_actor_window
  end
  
  #--------------------------------------------------------------------------
  # create_command_window
  #--------------------------------------------------------------------------
  def create_command_window
    wy = @help_window.height
    @command_window = Window_GuardianMenuCommand.new(0, wy)
    @command_window.viewport = @viewport
    @command_window.set_handler(:cancel,   method(:return_scene))
    @command_window.set_handler(:skill,     method(:command_personal))
    @command_window.set_handler(:equip,     method(:command_personal))
    @command_window.set_handler(:status,    method(:command_personal))
    if $imported["YSE-GuardianPairing"]
      @command_window.set_handler(:gpair, method(:command_personal_actor))
    end
    process_custom_status_commands
    if $game_temp.guardian_menu_command
      @command_window.index = $game_temp.guardian_menu_command
      $game_temp.guardian_menu_command = nil
    end
  end
   
  #--------------------------------------------------------------------------
  # create_status_window
  #--------------------------------------------------------------------------
  def create_status_window
    wy = @help_window.height
    @status_window = Window_StatusGuardian.new(@command_window.width, wy)
    @status_window.viewport = @viewport
  end
  
  #--------------------------------------------------------------------------
  # create_guardian_window
  #--------------------------------------------------------------------------
  def create_guardian_window
    wy = @command_window.height + @command_window.y
    @guardian_window = Window_MenuGuardianSceneMenu.new(0, wy)
    @guardian_window.viewport = @viewport
    @guardian_window.help_window = @help_window
    @guardian_window.update_help
    @guardian_window.status_window = @status_window
  end
  
  #--------------------------------------------------------------------------
  # create_actor_window
  #--------------------------------------------------------------------------
  def create_actor_window
    @actor_window = Window_MenuActor.new
    @actor_window.viewport = @viewport
    @actor_window.set_handler(:ok,     method(:on_actor_ok))
    @actor_window.set_handler(:cancel, method(:on_actor_cancel))
  end
  
  #--------------------------------------------------------------------------
  # command_personal
  #--------------------------------------------------------------------------
  def command_personal
    @guardian_window.activate
    @guardian_window.select_last
    @guardian_window.set_handler(:ok,     method(:on_personal_ok))
    @guardian_window.set_handler(:cancel, method(:on_personal_cancel))
  end
  
  #--------------------------------------------------------------------------
  # command_personal_actor
  #--------------------------------------------------------------------------
  def command_personal_actor
    @actor_window.x = Graphics.width - @actor_window.width
    @actor_window.show.activate
    @actor_window.select_last
  end
  
  #--------------------------------------------------------------------------
  # on_personal_ok
  #--------------------------------------------------------------------------
  def on_personal_ok
    case @command_window.current_symbol
    when :skill
      SceneManager.call(Scene_Skill)
    when :equip
      SceneManager.call(Scene_Equip)
    when :status
      SceneManager.call(Scene_Status)
    end
  end
  
  #--------------------------------------------------------------------------
  # on_personal_cancel
  #--------------------------------------------------------------------------
  def on_personal_cancel
    @guardian_window.unselect
    @command_window.activate
  end
  
  #--------------------------------------------------------------------------
  # on_actor_ok
  #--------------------------------------------------------------------------
  def on_actor_ok
    case @command_window.current_symbol
    #--- Imported ---
    when :gpair
      SceneManager.call(Scene_GuardianPairing)
    end
  end
  
  #--------------------------------------------------------------------------
  # on_actor_cancel
  #--------------------------------------------------------------------------
  def on_actor_cancel
    @actor_window.hide.deactivate
    @command_window.activate
  end
  
  #--------------------------------------------------------------------------
  # process_custom_status_commands
  #--------------------------------------------------------------------------
  def process_custom_status_commands
    commands = YSE::GUARDIAN_MENU::COMMANDS
    custom_commands = YSE::GUARDIAN_MENU::CUSTOM_STATUS_COMMANDS
    for command in commands
      next unless custom_commands.include?(command[0])
      called_method = custom_commands[command[0]][2]
      @command_window.set_handler(command[0], method(called_method))
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: command_guardian_pairing
  #--------------------------------------------------------------------------
  def command_guardian_pairing
    SceneManager.call(Scene_GuardianPairing)
  end
  
  #--------------------------------------------------------------------------
  # command_name1
  #--------------------------------------------------------------------------
  def command_name1
    # Do nothing
  end
  
  #--------------------------------------------------------------------------
  # command_name2
  #--------------------------------------------------------------------------
  def command_name2
    # Do nothing
  end
  
end # Scene_GuardianMenu

#==============================================================================
#
# ▼ End of File
#
#==============================================================================[/pre]

援护 系统(4)
[pre lang="ruby"]#==============================================================================
#
# ▼ Yami Engine Ace - Guardian Series
# -- Script: Guardian Pairing
# -- Last Updated: 2012.04.08
# -- Level: Easy
# -- Requires: YSE - Guardian Basic
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YSE-GuardianPairing"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.04.08 - Fixed Remove Guardian.
# 2012.03.30 - Compatible script: YSE - Guardian Summon.
# 2012.03.15 - Separated Boosting Attributes feature.
#            - Changed a little in visuals.
# 2012.03.14 - Finished Script.
# 2012.03.13 - Started Script.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This scripts provides "Equip Guardian to Actor" Feature for Guardians.
# If you have YSE - Guardian Menu in scripts list, You must add :gpair to
# Guardian Menu commands to show Pairing Menu.
#
#==============================================================================
# ▼ 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 YSE
  module GUARDIAN_PAIRING
   
    # These Configurations contain visual and vocab things.
    PAIRED_GUARDIAN = "%s"
    NON_PAIRED = "没有搭档"
    VOCAB_MENU = "组合"    # Command Display in Main Menu.
    MENU_ENABLE_SWITCH = 0      # Set to 0 if don't wanna use this function.
   
    COMMANDS = [ # The order at which the menu items are shown.
      [    :pair,            "搭档"], # Pairing command.
      [    :unpair,       "解散"], # Un-Pairing command
    ] # Do not remove this.
   
  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.
#==============================================================================

#==============================================================================
# ■ Vocab
#==============================================================================

module Vocab
  GuardianPairingMenu = YSE::GUARDIAN_PAIRING::VOCAB_MENU
  PairedGuardian = YSE::GUARDIAN_PAIRING::PAIRED_GUARDIAN
  NonPaired = YSE::GUARDIAN_PAIRING::NON_PAIRED
end

#==============================================================================
# ■ Game_Temp
#==============================================================================

class Game_Temp
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :guardian_pairing_menu_command
  
end # Game_Temp

#==============================================================================
# ■ Window_MenuCommand
#==============================================================================

class Window_MenuCommand < Window_Command
  
  #--------------------------------------------------------------------------
  # alias method: make_command_list
  #--------------------------------------------------------------------------
  alias yse_add_main_commands_gp add_main_commands
  def add_main_commands
    yse_add_main_commands_gp
    add_guardian_pairing_commands unless $imported["YEA-AceMenuEngine"]
  end
  
  #--------------------------------------------------------------------------
  # new method: guardian_command_enabled
  #--------------------------------------------------------------------------
  def guardian_pairing_command_enabled
    return false if $game_party.guardians.size == 0
    return true if YSE::GUARDIAN_PAIRING::MENU_ENABLE_SWITCH <= 0
    return $game_switches[YSE::GUARDIAN_PAIRING::MENU_ENABLE_SWITCH]
  end

  #--------------------------------------------------------------------------
  # new method: add_guardian_pairing_commands
  #--------------------------------------------------------------------------
  def add_guardian_pairing_commands
    return if $imported["YSE-GuardianMenu"]
    add_command(Vocab::GuardianPairingMenu,   :gpair,   guardian_pairing_command_enabled)
  end
  
end # Window_MenuCommand

#==============================================================================
# ■ Scene_Menu
#==============================================================================

class Scene_Menu < Scene_MenuBase
  
  #--------------------------------------------------------------------------
  # alias method: create_command_window
  #--------------------------------------------------------------------------
  alias yse_create_command_window_gp create_command_window
  def create_command_window
    yse_create_command_window_gp
    @command_window.set_handler(:gpair, method(:command_personal))
  end
  
  #--------------------------------------------------------------------------
  # alias method: on_personal_ok
  #--------------------------------------------------------------------------
  alias yse_on_personal_ok_gp on_personal_ok
  def on_personal_ok
    case @command_window.current_symbol
    when :gpair
      $game_party.target_actor = $game_party.members[@status_window.index]
      SceneManager.call(Scene_GuardianPairing)
    else
      yse_on_personal_ok_gp
    end
  end
  
end # Scene_Menu

#==============================================================================
# ■ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :pair_actor

  #--------------------------------------------------------------------------
  # alias method: setup
  #--------------------------------------------------------------------------
  alias yse_setup_gp setup
  def setup(actor_id)
    @guardians = []
    @pair_actor = nil
    yse_setup_gp(actor_id)
    clear_guardians
  end
  
  #--------------------------------------------------------------------------
  # new method: guardians
  #--------------------------------------------------------------------------
  def guardians
    @guardians.collect {|id| $game_actors[id] }
  end

  #--------------------------------------------------------------------------
  # new method: paired_actor
  #--------------------------------------------------------------------------
  def paired_actor
    @pair_actor.nil? ? nil : $game_actors[@pair_actor]
  end
  
  #--------------------------------------------------------------------------
  # new method: first_guardian
  #--------------------------------------------------------------------------
  def first_guardian
    guardians[0]
  end
  
  #--------------------------------------------------------------------------
  # new method: is_pair?
  #--------------------------------------------------------------------------
  def is_pair?
    guardian? ? !@pair_actor.nil? : guardians.size > 0
  end
  
  #--------------------------------------------------------------------------
  # new method: is_pair?
  #--------------------------------------------------------------------------
  def force_pair(guardian)
    @guardians.clear
    @guardians.push(guardian.id) if guardian
    @guardians.compact!
    refresh
  end
  
  #--------------------------------------------------------------------------
  # new method: is_pair?
  #--------------------------------------------------------------------------
  def pair(guardian)
    return if guardians.include?(guardian)
    clear_guardians
    @guardians.push(guardian.id)
    guardian.pair_actor = self.id
    refresh
  end
  
  #--------------------------------------------------------------------------
  # new method: clear_guardians
  #--------------------------------------------------------------------------
  def clear_guardians
    guardians.each { |g| g.pair_actor = nil }
    @guardians.clear
  end
   
  #--------------------------------------------------------------------------
  # alias method: gain_exp
  #--------------------------------------------------------------------------
  alias yse_gain_exp_gp gain_exp
  def gain_exp(exp)
    yse_gain_exp_gp(exp)
    return if guardian?
    guardians.each { |guardian|
      guardian.gain_guardian_exp(guardian, exp)
    }
  end
  
  #--------------------------------------------------------------------------
  # new method: gain_guardian_exp
  #--------------------------------------------------------------------------
  def gain_guardian_exp(guardian,exp)
    return if YSE::GUARDIAN::ALL_GUARDIAN_GAIN_EXP
    guardian.gain_exp(exp)
  end
  
end # Game_Actor

#==============================================================================
# ■ Game_Party
#==============================================================================

class Game_Party < Game_Unit
  
  #--------------------------------------------------------------------------
  # alias method: remove_actor
  #--------------------------------------------------------------------------  
  alias yse_remove_actor_gp remove_actor
  def remove_actor(actor_id)
    if $game_actors[actor_id].guardian? && $game_actors[actor_id].is_pair?
      $game_actors[actor_id].paired_actor.clear_guardians
    end
    yse_remove_actor_gp(actor_id)
  end
  
end # Game_Party

#==============================================================================
# ■ Window_Base
#==============================================================================

class Window_Base < Window
  
  #--------------------------------------------------------------------------
  # new method: draw_actor_guardian
  #--------------------------------------------------------------------------
  def draw_actor_guardian(actor, x, y, width = 180)
    change_color(normal_color)
    str = Vocab::PairedGuardian
    if actor.guardian?
      name = actor.paired_actor.nil? ? Vocab::NonPaired : actor.paired_actor.name
    else
      name = actor.first_guardian.nil? ? Vocab::NonPaired : actor.first_guardian.name
    end
    str =  sprintf(str, name)
    draw_text(x, y, width, line_height, str, 2)
  end
  
end # Window_Base
  
#==============================================================================
# ■ Window_GuardianPairingMenuCommand
#==============================================================================

class Window_GuardianPairingMenuCommand < Window_Command
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(dx, dy)
    super(dx, dy)
  end
  
  #--------------------------------------------------------------------------
  # window_width
  #--------------------------------------------------------------------------
  def window_width; return 160; end
  
  #--------------------------------------------------------------------------
  # visible_line_number
  #--------------------------------------------------------------------------
  def visible_line_number; return 4; end
   
  #--------------------------------------------------------------------------
  # alignment
  #--------------------------------------------------------------------------
  def alignment; return 1; end
  
  #--------------------------------------------------------------------------
  # ok_enabled?
  #--------------------------------------------------------------------------
  def ok_enabled?
    return handle?(current_symbol)
  end
  
  #--------------------------------------------------------------------------
  # process_ok
  #--------------------------------------------------------------------------
  def process_ok
    $game_temp.guardian_pairing_menu_command = self.index
    super
  end
  
  #--------------------------------------------------------------------------
  # make_command_list
  #--------------------------------------------------------------------------
  def make_command_list
    for command in YSE::GUARDIAN_PAIRING::COMMANDS
      enable = command[0] == :pair ? $game_party.guardians.size > 0 : $game_party.target_actor.is_pair?
      add_command(command[1], command[0], enable)
    end
  end
  
end # Window_GuardianPairingMenuCommand

#==============================================================================
# ■ Window_MenuGuardianPair
#==============================================================================

class Window_MenuGuardianPair < Window_MenuGuardian
  
  #--------------------------------------------------------------------------
  # window_width
  #--------------------------------------------------------------------------
  def window_width
    Graphics.width
  end
  
  #--------------------------------------------------------------------------
  # col_max
  #--------------------------------------------------------------------------
  def col_max
    2
  end
  
  #--------------------------------------------------------------------------
  # unpair=
  #--------------------------------------------------------------------------
  def unpair=(flag)
    @unpair = flag
    refresh
  end
  
  #--------------------------------------------------------------------------
  # enable?
  #--------------------------------------------------------------------------
  def enable?(actor)
    @unpair ? actor.is_pair? : !actor.is_pair?
  end
  
  #--------------------------------------------------------------------------
  # current_item_enabled?
  #--------------------------------------------------------------------------
  def current_item_enabled?
    enable?($game_party.guardians[index])
  end
  
  #--------------------------------------------------------------------------
  # draw_guardian_status
  #--------------------------------------------------------------------------
  def draw_guardian_status(actor, dx, dy, dw)
    change_color(normal_color)
    draw_actor_guardian(actor, dx, dy, dw)
  end
  
  #--------------------------------------------------------------------------
  # process_ok
  #--------------------------------------------------------------------------
  def process_ok
    $game_party.menu_actor = $game_party.guardians[index]
    $game_temp.scene_gmenu_id = $game_party.guardians[index].id
    super
  end
  
end # Window_MenuGuardianPair

#==============================================================================
# ■ Window_PairingStatus
#==============================================================================

class Window_PairingStatus < Window_SkillStatus
  
  #--------------------------------------------------------------------------
  # draw_actor_simple_status
  #--------------------------------------------------------------------------
  def draw_actor_simple_status(actor, dx, dy)
    draw_actor_name(actor, dx, dy)
    draw_actor_level(actor, dx, dy + line_height * 1)
    dw = contents.width - dx - 124
    draw_actor_guardian(actor, dx + 120, dy, dw)
    draw_actor_hp(actor, dx + 120, dy + line_height * 1, dw)
    draw_actor_mp(actor, dx + 120, dy + line_height * 2, dw)
  end
  
end # Window_PairingStatus

#==============================================================================
# ■ Scene_GuardianPairing
#==============================================================================

class Scene_GuardianPairing < Scene_MenuBase
  
  #--------------------------------------------------------------------------
  # start
  #--------------------------------------------------------------------------
  def start
    super
    create_help_window
    create_command_window
    create_status_window
    create_guardian_window
  end
  
  #--------------------------------------------------------------------------
  # create_command_window
  #--------------------------------------------------------------------------
  def create_command_window
    wy = @help_window.height
    @command_window = Window_GuardianPairingMenuCommand.new(0, wy)
    @command_window.viewport = @viewport
    @command_window.set_handler(:cancel,   method(:return_scene))
    @command_window.set_handler(:pair,   method(:command_pair))
    @command_window.set_handler(:unpair,   method(:command_unpair))
    if $game_temp.guardian_pairing_menu_command
      @command_window.index = $game_temp.guardian_pairing_menu_command
      $game_temp.guardian_pairing_menu_command = nil
    end
  end
  
  #--------------------------------------------------------------------------
  # create_status_window
  #--------------------------------------------------------------------------
  def create_status_window
    wy = @help_window.height
    @status_window = Window_PairingStatus.new(@command_window.width, wy)
    @status_window.viewport = @viewport
    @status_window.actor = $game_party.target_actor
  end
  
  #--------------------------------------------------------------------------
  # create_guardian_window
  #--------------------------------------------------------------------------
  def create_guardian_window
    wx = $imported["YSE-GuardianBoostStats"] ? 232 : 0
    wy = @command_window.height + @command_window.y
    @guardian_window = Window_MenuGuardianPair.new(wx, wy)
    @guardian_window.viewport = @viewport
    @guardian_window.help_window = @help_window
    @guardian_window.update_help
  end
  
  #--------------------------------------------------------------------------
  # command_actor
  #--------------------------------------------------------------------------
  def command_unpair
    process_unpair
  end
  
  #--------------------------------------------------------------------------
  # command_pair
  #--------------------------------------------------------------------------
  def command_pair
    @guardian_window.activate
    @guardian_window.select_last
    @guardian_window.set_handler(:ok,     method(:on_guardian_ok))
    @guardian_window.set_handler(:cancel, method(:on_guardian_cancel))
  end
  
  #--------------------------------------------------------------------------
  # on_guardian_ok
  #--------------------------------------------------------------------------
  def on_guardian_ok
    case @command_window.current_symbol
    when :pair
      if not $game_party.menu_actor.is_pair?
        process_pair
      else
        Sound.play_buzzer
      end
    when :unpair
      if $game_party.target_actor.is_pair?
        process_unpair
      else
        Sound.play_buzzer
      end
    end
    @guardian_window.unpair = false
  end
  
  #--------------------------------------------------------------------------
  # on_guardian_cancel
  #--------------------------------------------------------------------------
  def on_guardian_cancel
    @guardian_window.unselect
    @guardian_window.unpair = false
    @command_window.activate
  end
  
  #--------------------------------------------------------------------------
  # process_pair
  #--------------------------------------------------------------------------
  def process_pair
    $game_party.target_actor.pair($game_party.menu_actor)
    @command_window.refresh
    @guardian_window.activate
    @guardian_window.select_last
    @status_window.refresh
  end
  
  #--------------------------------------------------------------------------
  # process_unpair
  #--------------------------------------------------------------------------
  def process_unpair
    $game_party.target_actor.clear_guardians
    @command_window.refresh
    @command_window.activate
    @guardian_window.refresh
    @status_window.refresh
  end
  
end # Scene_GuardianPairing

#==============================================================================
#
# ▼ End of File
#
#==============================================================================[/pre]

援护系统(5)
[pre lang="ruby"]#==============================================================================
#
# ¥ Yami Engine Ace - Guardian Series
# -- Script: Guardian Boost Stats
# -- Last Updated: 2012.03.15
# -- Level: Easy
# -- Requires: YSE - Guardian Pairing
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YSE-GuardianBoostStats"] = true

#==============================================================================
# ¥ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.03.15 - Started and Finished Script.
#
#==============================================================================
# ¥ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script provides a new feature for YSE - Guardian Pairing, which boost
# stats for an actor by Guardian's attributes.
#
#==============================================================================
# ¥ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ¥ Materials/‘fÞ 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 YSE
  module GUARDIAN_PAIRING
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Attributes Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This section adjusts the stats plus and traits plus of actor who paired
    # with a guardian.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    ATTRIBUTES = { # Start.
      :stats      =>  true, # Stats injection
      :traits     =>  true, # Traits injection
      :skills     =>  true, # Skills injection
    } # Done.

  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.
#==============================================================================

#==============================================================================
# ¡ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  
  #--------------------------------------------------------------------------
  # alias method: param_plus
  #--------------------------------------------------------------------------
  alias yse_param_plus_gbs param_plus
  def param_plus(param_id)
    return yse_param_plus_gbs(param_id) unless YSE::GUARDIAN_PAIRING::ATTRIBUTES[:stats]
    return yse_param_plus_gbs(param_id) if guardian?
    guardians.compact.inject(yse_param_plus_gbs(param_id)) {|r, item| r += item.param(param_id) }
  end
  
  #--------------------------------------------------------------------------
  # alias method: feature_objects
  #--------------------------------------------------------------------------
  alias yse_feature_objects_gbs feature_objects
  def feature_objects
    return yse_feature_objects_gbs unless YSE::GUARDIAN_PAIRING::ATTRIBUTES[:traits]
    return yse_feature_objects_gbs if guardian?
    result = yse_feature_objects_gbs
    guardians.each { |g| result += g.feature_objects }
    result
  end
  
  #--------------------------------------------------------------------------
  # alias method: skills
  #--------------------------------------------------------------------------
  alias yse_skills_gbs skills
  def skills
    return yse_skills_gbs unless YSE::GUARDIAN_PAIRING::ATTRIBUTES[:skills]
    return yse_skills_gbs if guardian?
    result = yse_skills_gbs
    guardians.each { |g| result = result | g.skills }
    result
  end
  
end # Game_Actor

#==============================================================================
# ¡ Window_MenuGuardianPair
#==============================================================================

class Window_MenuGuardianPair < Window_MenuGuardian
  
  #--------------------------------------------------------------------------
  # window_width
  #--------------------------------------------------------------------------
  def window_width
    Graphics.width - 232
  end
  
  #--------------------------------------------------------------------------
  # col_max
  #--------------------------------------------------------------------------
  def col_max
    1
  end
  
  #--------------------------------------------------------------------------
  # actor_status=
  #--------------------------------------------------------------------------
  def actor_status=(actor_status)
    @actor_status = actor_status
  end
  
  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    update_actor_status
  end
  
  #--------------------------------------------------------------------------
  # update_actor_status
  #--------------------------------------------------------------------------
  def update_actor_status
    return unless @actor_status
    return unless $game_party.guardians[index]
    return @actor_status.clear_temp if index < 0
    item = $game_party.guardians[index]
    @actor_status.set_temp_actor(item)
  end
  
end # Window_MenuGuardianPair

#==============================================================================
# ¡ Window_GuardianPairStatus
#==============================================================================

class Window_GuardianPairStatus < Window_Base
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, window_width, Graphics.height - y)
    @actor = $game_party.target_actor
    temp_actor = Marshal.load(Marshal.dump(@actor))
    @temp_actor = temp_actor
    refresh
  end
  
  #--------------------------------------------------------------------------
  # window_width
  #--------------------------------------------------------------------------
  def window_width
    232
  end

  #--------------------------------------------------------------------------
  # visible_line_number
  #--------------------------------------------------------------------------
  def visible_line_number
    return 8
  end
  
  #--------------------------------------------------------------------------
  # actor
  #--------------------------------------------------------------------------
  def actor
    @actor
  end
  
  #--------------------------------------------------------------------------
  # set_temp_actor
  #--------------------------------------------------------------------------
  def set_temp_actor(guardian)
    return unless @temp_actor
    return if @temp_actor.guardians.include?(guardian)
    @temp_actor.force_pair(guardian)
    refresh
  end
  
  #--------------------------------------------------------------------------
  # clear_temp
  #--------------------------------------------------------------------------
  def clear_temp
    temp_actor = Marshal.load(Marshal.dump(@actor))
    @temp_actor = temp_actor
    refresh
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    8.times { |i| draw_actor_param(i, 0, line_height * i, contents_width) }
  end
  
  #--------------------------------------------------------------------------
  # draw_actor_param
  #--------------------------------------------------------------------------
  def draw_actor_param(param_id, dx, dy, dw)
    colour = Color.new(0, 0, 0, translucent_alpha/2)
    rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
    contents.fill_rect(rect, colour)
    change_color(system_color)
    draw_text(dx+4, dy, dw-8, line_height, Vocab::param(param_id))
    change_color(normal_color)
    draw_text(dx+4, dy, dw-8, line_height, changed_param(param_id), 2)
  end
  
  #--------------------------------------------------------------------------
  # changed_param
  #--------------------------------------------------------------------------
  def changed_param(param_id)
    result = ""
    result += @actor.param(param_id).to_s
    return result if @temp_actor.nil?
    return result if @temp_actor.guardians == @actor.guardians
    result += "¨ " + @temp_actor.param(param_id).to_s
    return result
  end

end # Window_GuardianPairStatus

#==============================================================================
# ¡ Scene_GuardianPairing
#==============================================================================

class Scene_GuardianPairing < Scene_MenuBase
  
  #--------------------------------------------------------------------------
  # alias method: start
  #--------------------------------------------------------------------------
  alias yse_start_gbs start
  def start
    yse_start_gbs
    create_actor_status_window
  end

  #--------------------------------------------------------------------------
  # new method: create_actor_status_window
  #--------------------------------------------------------------------------
  def create_actor_status_window
    wx = 0
    wy = @command_window.height + @command_window.y
    @actor_status_window = Window_GuardianPairStatus.new(wx, wy)
    @actor_status_window.viewport = @viewport
    @guardian_window.actor_status = @actor_status_window
  end
  
  #--------------------------------------------------------------------------
  # alias method: process_pair
  #--------------------------------------------------------------------------
  alias yse_process_pair_gbs process_pair
  def process_pair
    yse_process_pair_gbs
    @actor_status_window.refresh
  end
  
  #--------------------------------------------------------------------------
  # alias method: process_unpair
  #--------------------------------------------------------------------------
  alias yse_process_unpair_gbs process_unpair
  def process_unpair
    yse_process_unpair_gbs
    @actor_status_window.refresh
  end
  
end # Scene_GuardianPairing

#==============================================================================
#
# ¥ End of File
#
#==============================================================================[/pre]

援护系统(6)
[pre lang="ruby"]#==============================================================================
#
# ¥ Yami Engine Ace - Guardian Series
# -- Script: Guardian Summon
# -- Last Updated: 2012.04.05
# -- Level: Easy
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YSE-GuardianSummon"] = true

#==============================================================================
# ¥ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.04.05 - Fixed Crashed bug when a guardian die.
# 2012.04.02 - Finished Script.
# 2012.03.29 - Started Script.
#
#==============================================================================
# ¥ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Provides a summon skill that can make a guardian to take part in battle.
# Guardian can take place of an actor, or replace the whole party (like FFX Aeons).
# There also a compatible feature that make summoning skill only summon paired
# guardian (Require Yami Engine - Guardian Pairing).
#
#==============================================================================
# ¥ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ¥ Materials/‘fÞ but above ¥ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Skill Notetags - These notetags go in the skill notebox in the database.
# -----------------------------------------------------------------------------
# <summon guardian> - Mark this skill as a summoning skill.
# <return guardian> - Mark this skill as a return skill for guardian.
#
# -----------------------------------------------------------------------------
# Actor Notetags - These notetags go in the actor notebox in the database.
# -----------------------------------------------------------------------------
# <summon animation: x> - Play animation x at enemies when summon this guardian.
# <return animation: x> - Play animation x at enemies when return this guardian.
#
#==============================================================================
# ¥ 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 YSE
  module GUARDIAN_SUMMON
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Summon Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    SUMMON_CONFIGURATION = { # Start.
      :summon_paired    =>  false,  # Require YSE - Guardian Pairing
      :aeon_party       =>  true,   # When summoned, all other party members
                                    # will not take part in battle until guardian
                                    # go back. This is alike FFX Aeon Summoning.
      :default_summon_ani =>  0, # Use 0 to disable.
      :default_return_ani =>  0, # Use 0 to disable.
      :summon_text      =>  "%s 呼唤了 %s!",
      :return_text      =>  "%s 离开了.",
      :fail_text        =>  "%s 召唤失败.",
    } # Done.
   
  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.
#==============================================================================

#==============================================================================
# ¡ Regular Expression
#==============================================================================

module YSE
  module REGEXP
  module USABLEITEM
   
    SUMMON_GUARDIAN = /<(?:SUMMON_GUARDIAN|summon guardian)>/i
    RETURN_GUARDIAN = /<(?:RETURN_GUARDIAN|return guardian)>/i
   
  end # USABLEITEM
  module ACTOR
   
    SUMMON_ANIMATION = /<(?:SUMMON_ANIMATION|summon animation):[ ](\d+)>/i
    RETURN_ANIMATION = /<(?:RETURN_ANIMATION|return animation):[ ](\d+)>/i
   
  end # ACTOR
  end # REGEXP
end # YSE

#==============================================================================
# ¡ Module YSE
#==============================================================================

module YSE
  module GUARDIAN
   
    #--------------------------------------------------------------------------
    # summon_paired?
    #--------------------------------------------------------------------------
    def self.summon_paired?
      $imported["YSE-GuardianPairing"] ? YSE::GUARDIAN_SUMMON::SUMMON_CONFIGURATION[:summon_paired] : false
    end
   
    #--------------------------------------------------------------------------
    # aeon_party?
    #--------------------------------------------------------------------------
    def self.aeon_party?
      YSE::GUARDIAN_SUMMON::SUMMON_CONFIGURATION[:aeon_party]
    end
   
  end # GUARDIAN
end # YSE

#==============================================================================
# ¡ BattleManager
#==============================================================================

module BattleManager
  
  #--------------------------------------------------------------------------
  # alias method:
  #   - process_abort
  #   - process_defeat
  #   - process_victory
  #--------------------------------------------------------------------------
  class<< self
    alias yse_process_abort_gsummon process_abort
    alias yse_process_defeat_gsummon process_defeat
    alias yse_process_victory_gsummon process_victory
  end
  
  #--------------------------------------------------------------------------
  # process_abort
  #--------------------------------------------------------------------------
  def self.process_abort
    SceneManager.scene.greturn_battle_end
    yse_process_abort_gsummon
  end
  
  #--------------------------------------------------------------------------
  # process_defeat
  #--------------------------------------------------------------------------
  def self.process_defeat
    if $game_party.aeons.size > 0
      SceneManager.scene.greturn_battle_end
      return
    end
    yse_process_defeat_gsummon
  end
  
  #--------------------------------------------------------------------------
  # process_victory
  #--------------------------------------------------------------------------
  def self.process_victory
    SceneManager.scene.greturn_battle_end
    yse_process_victory_gsummon
  end
  
end # BattleManager

#==============================================================================
# ¡ DataManager
#==============================================================================

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

#==============================================================================
# ¡ RPG::Actor
#==============================================================================

class RPG::Actor < RPG::BaseItem
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :summon_ani
  attr_accessor :return_ani

  #--------------------------------------------------------------------------
  # new method: load_notetags_gsummon
  #--------------------------------------------------------------------------
  def load_notetags_gsummon
    @summon_ani = YSE::GUARDIAN_SUMMON::SUMMON_CONFIGURATION[:default_summon_ani]
    @return_ani = YSE::GUARDIAN_SUMMON::SUMMON_CONFIGURATION[:default_return_ani]
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YSE::REGEXP::ACTOR::SUMMON_ANIMATION
        @summon_ani = $1.to_i
      when YSE::REGEXP::ACTOR::RETURN_ANIMATION
        @return_ani = $1.to_i
      end
    } # self.note.split
    #---
  end
  
end # RPG::Actor

#==============================================================================
# ¡ RPG::UsableItem
#==============================================================================

class RPG::UsableItem < RPG::BaseItem
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :is_summon
  attr_accessor :is_greturn
  
  #--------------------------------------------------------------------------
  # common cache: load_notetags_gsummon
  #--------------------------------------------------------------------------
  def load_notetags_gsummon
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YSE::REGEXP::USABLEITEM::SUMMON_GUARDIAN
        @is_summon = true
      when YSE::REGEXP::USABLEITEM::RETURN_GUARDIAN
        @is_greturn = true
      end
    } # self.note.split
    #---
  end
  
end # RPG::UsableItem

#==============================================================================
# ¡ Game_Actor
#==============================================================================

class Game_Action
  
  #--------------------------------------------------------------------------
  # alias method: clear
  #--------------------------------------------------------------------------
  alias yse_clear_gsummon clear
  def clear
    yse_clear_gsummon
    @summon_id = nil
  end
  
  #--------------------------------------------------------------------------
  # new method: summon_id
  #--------------------------------------------------------------------------
  def summon_id
    $game_actors[@summon_id]
  end
  
  #--------------------------------------------------------------------------
  # new method: summon_id=
  #--------------------------------------------------------------------------
  def summon_id=(actor)
    @summon_id = actor.nil? ? nil : actor.id
  end
  
end # Game_Action

#==============================================================================
# ¡ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  
  #--------------------------------------------------------------------------
  # new method: aeon
  #--------------------------------------------------------------------------
  def aeon
    return self if guardian?
    return self if @aeon.nil?
    return $game_actors[@aeon]
  end
  
  #--------------------------------------------------------------------------
  # new method: summoner
  #--------------------------------------------------------------------------
  def summoner
    return nil if @summoner.nil?
    $game_actors[@summoner]
  end
  
  #--------------------------------------------------------------------------
  # new method: summoner=
  #--------------------------------------------------------------------------
  def summoner=(actor)
    @summoner = actor.nil? ? nil : actor.id
  end
  
  #--------------------------------------------------------------------------
  # new method: aeon=
  #--------------------------------------------------------------------------
  def aeon=(actor)
    @aeon = actor.nil? ? nil : actor.id
    return if actor.nil?
    actor.summoner = self
  end
  
  #--------------------------------------------------------------------------
  # new method: greturn
  #--------------------------------------------------------------------------
  def greturn
    return unless summoner
    summoner.aeon = nil
    summoner = nil
  end
  
  #--------------------------------------------------------------------------
  # alias method: skill_conditions_met?
  #--------------------------------------------------------------------------
  alias yse_skill_conditions_met_gsummon skill_conditions_met?
  def skill_conditions_met?(skill)
    if skill.is_summon
      summon_conditions_met?
    else
      yse_skill_conditions_met_gsummon(skill)
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: summon_conditions_met?
  #--------------------------------------------------------------------------
  def summon_conditions_met?
    if YSE::GUARDIAN.summon_paired?
      return false if guardians.size <= 0
    else
      return false if $game_party.guardians.size <= 0
    end
    return true
  end
  
end # Game_Actor

#==============================================================================
# ¡ Game_Party
#==============================================================================

class Game_Party < Game_Unit
  
  #--------------------------------------------------------------------------
  # alias method: initialize
  #--------------------------------------------------------------------------
  alias yse_initialize_gsummon initialize
  def initialize
    yse_initialize_gsummon
    init_aeons
  end
  
  #--------------------------------------------------------------------------
  # alias method: battle_members
  #--------------------------------------------------------------------------
  alias yse_battle_members_gsummon battle_members
  def battle_members
    if YSE::GUARDIAN.aeon_party?
      @aeons.size > 0 ? aeons : yse_battle_members_gsummon
    else
      yse_battle_members_gsummon.collect { |battler| battler.aeon }
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: init_aeons
  #--------------------------------------------------------------------------
  def init_aeons
    @aeons = []
  end
  
  #--------------------------------------------------------------------------
  # new method: summon_aeon
  #--------------------------------------------------------------------------
  def summon_aeon(actor)
    @aeons.push(actor.id)
  end
  
  #--------------------------------------------------------------------------
  # new method: aeons
  #--------------------------------------------------------------------------
  def aeons
    @aeons.collect {|id| $game_actors[id] }
  end
  
  #--------------------------------------------------------------------------
  # new method: return_aeon
  #--------------------------------------------------------------------------
  def return_aeon(actor)
    @aeons.delete(actor.id)
  end
  
  #--------------------------------------------------------------------------
  # new method: clear_aeons
  #--------------------------------------------------------------------------
  def clear_aeons
    aeons.each { |aeon| aeon.greturn; aeon.summoner = nil }
    @aeons.clear
  end
  
end # Game_Party

#==============================================================================
# ¡ Window_BattleSummon
#==============================================================================

class Window_BattleSummon < Window_MenuGuardian
  
  #--------------------------------------------------------------------------
  # window_height
  #--------------------------------------------------------------------------
  def initialize(help_window)
    y = help_window.height
    super(0, y)
    self.visible = false
    @help_window = help_window
  end
  
  #--------------------------------------------------------------------------
  # window_width
  #--------------------------------------------------------------------------
  def window_width
    Graphics.width
  end
  
  #--------------------------------------------------------------------------
  # window_height
  #--------------------------------------------------------------------------
  def window_height
    Graphics.height - 64 - 128
  end
  
  #--------------------------------------------------------------------------
  # line_height
  #--------------------------------------------------------------------------
  def item_height
    line_height * 2
  end
  
  #--------------------------------------------------------------------------
  # col_max
  #--------------------------------------------------------------------------
  def col_max
    window_width > 544 ? 2 : 1
  end
  
  #--------------------------------------------------------------------------
  # draw_item
  #--------------------------------------------------------------------------
  def draw_item(index)
    guardian = $game_party.guardians[index]
    rect = item_rect(index)
    face_rect = Rect.new(rect.x + 1, rect.y + 1, item_height - 2, item_height - 2)
    draw_guardian_name(guardian, rect.x, rect.y, rect.width / 2)
    draw_guardian_level(guardian, rect.x, rect.y + line_height, rect.width / 2)
    draw_guardian_hp(guardian, rect.x + rect.width / 2 + 2, rect.y, rect.width / 2 - 2)
    draw_guardian_mp(guardian, rect.x + rect.width / 2 + 2, rect.y + line_height, rect.width / 2 - 2)
    draw_thumb_face(guardian, face_rect)
  end
  
  #--------------------------------------------------------------------------
  # draw_guardian_level
  #--------------------------------------------------------------------------
  def draw_guardian_level(actor, dx, dy, dw)
    colour = Color.new(0, 0, 0, translucent_alpha/2)
    rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
    contents.fill_rect(rect, colour)
    change_color(system_color, enable?(actor))
    draw_text(dx + item_height + 2, dy, dw, line_height, Vocab.level)
    change_color(normal_color, enable?(actor))
    draw_text(dx+4, dy, dw-8, line_height, actor.level.to_s, 2)
  end
  
  #--------------------------------------------------------------------------
  # draw_guardian_hp
  #--------------------------------------------------------------------------
  def draw_guardian_hp(actor, dx, dy, dw)
    colour = Color.new(0, 0, 0, translucent_alpha/2)
    rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
    contents.fill_rect(rect, colour)
    change_color(system_color, enable?(actor))
    draw_text(dx + 2, dy, dw, line_height, Vocab.hp)
    change_color(normal_color, enable?(actor))
    draw_text(dx+4, dy, dw-8, line_height, "#{actor.hp}/#{actor.mhp}", 2)
  end
  
  #--------------------------------------------------------------------------
  # draw_guardian_mp
  #--------------------------------------------------------------------------
  def draw_guardian_mp(actor, dx, dy, dw)
    colour = Color.new(0, 0, 0, translucent_alpha/2)
    rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
    contents.fill_rect(rect, colour)
    change_color(system_color, enable?(actor))
    draw_text(dx + 2, dy, dw, line_height, Vocab.mp)
    change_color(normal_color, enable?(actor))
    draw_text(dx+4, dy, dw-8, line_height, "#{actor.mp}/#{actor.mmp}", 2)
  end
  
  #--------------------------------------------------------------------------
  # enable?
  #--------------------------------------------------------------------------
  def enable?(actor = nil)
    return false if actor.nil?
    return false if actor.summoner
    return actor.alive?
  end
  
  #--------------------------------------------------------------------------
  # current_item_enabled?
  #--------------------------------------------------------------------------
  def current_item_enabled?
    enable?($game_party.guardians[index])
  end
  
  #--------------------------------------------------------------------------
  # guardian
  #--------------------------------------------------------------------------
  def guardian
    $game_party.guardians[index]
  end
  
  #--------------------------------------------------------------------------
  # show
  #--------------------------------------------------------------------------
  def show
    @help_window.show
    super
    activate
  end
  
  #--------------------------------------------------------------------------
  # hide
  #--------------------------------------------------------------------------
  def hide
    @help_window.hide
    super
    deactivate
  end
  
  #--------------------------------------------------------------------------
  # activate
  #--------------------------------------------------------------------------
  def activate
    select(0)
    super
  end
  
end # Window_BattleSummon

#==============================================================================
# ¡ Window_BattleLog
#==============================================================================

class Window_BattleLog < Window_Selectable
  
  #--------------------------------------------------------------------------
  # new method: display_summon
  #--------------------------------------------------------------------------
  def display_summon(subject, guardian)
    text = YSE::GUARDIAN_SUMMON::SUMMON_CONFIGURATION[:summon_text]
    text = sprintf(text, subject.name, guardian.name)
    add_text(text)
  end
  
  #--------------------------------------------------------------------------
  # new method: display_summon_fail
  #--------------------------------------------------------------------------
  def display_summon_fail(subject)
    text = YSE::GUARDIAN_SUMMON::SUMMON_CONFIGURATION[:fail_text]
    text = sprintf(text, subject.name)
    add_text(text)
  end
  
  #--------------------------------------------------------------------------
  # new method: display_return
  #--------------------------------------------------------------------------
  def display_return(guardian)
    text = YSE::GUARDIAN_SUMMON::SUMMON_CONFIGURATION[:return_text]
    text = sprintf(text, guardian.name)
    add_text(text)
  end
  
end # Window_BattleLog

#==============================================================================
# ¡ Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base
  
  #--------------------------------------------------------------------------
  # alias method: create_all_windows
  #--------------------------------------------------------------------------
  alias yse_create_all_windows_gsummon create_all_windows
  def create_all_windows
    yse_create_all_windows_gsummon
    create_summon_window
  end
  
  #--------------------------------------------------------------------------
  # alias method: create_summon_window
  #--------------------------------------------------------------------------
  def create_summon_window
    @summon_window = Window_BattleSummon.new(@help_window)
    @summon_window.set_handler(:ok,     method(:on_summon_ok))
    @summon_window.set_handler(:cancel, method(:on_summon_cancel))
  end
  
  #--------------------------------------------------------------------------
  # alias method: on_skill_ok
  #--------------------------------------------------------------------------
  alias yse_on_skill_ok_gsummon on_skill_ok
  def on_skill_ok
    @skill = @skill_window.item
    @skill.is_summon ? command_summon : yse_on_skill_ok_gsummon
  end
  
  #--------------------------------------------------------------------------
  # alias method: command_use_skill
  # Compatible with: Yanfly Engine Ace - Battle Command List
  #--------------------------------------------------------------------------
  if $imported["YEA-BattleCommandList"]
  alias yse_command_use_skill_gsummon command_use_skill
  def command_use_skill
    @skill = $data_skills[@actor_command_window.current_ext]
    @skill.is_summon ? command_summon : yse_command_use_skill_gsummon
  end
  end
  
  #--------------------------------------------------------------------------
  # new method: command_summon
  #--------------------------------------------------------------------------
  def command_summon
    if YSE::GUARDIAN.summon_paired?
      BattleManager.actor.input.set_skill(@skill.id)
      BattleManager.actor.last_skill.object = @skill
      BattleManager.actor.input.summon_id = BattleManager.actor.first_guardian
      next_command
    else
      BattleManager.actor.input.set_skill(@skill.id)
      BattleManager.actor.last_skill.object = @skill
      @skill_window.hide unless $imported["YEA-BattleEngine"]
      @summon_window.show
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: on_summon_ok
  #--------------------------------------------------------------------------
  def on_summon_ok
    @summon_window.hide
    BattleManager.actor.input.summon_id = @summon_window.guardian
    @skill_window.hide if $imported["YEA-BattleEngine"]
    next_command
  end
  
  #--------------------------------------------------------------------------
  # new method: command_summon
  #--------------------------------------------------------------------------
  def on_summon_cancel
    @summon_window.hide
    if @actor_command_window.close? || !@actor_command_window.visible
      @skill_window.show
      @skill_window.activate
    else
      @actor_command_window.activate
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: command_summon
  #--------------------------------------------------------------------------
  alias yse_use_item_gsummon use_item
  def use_item
    if @subject.current_action.item.is_summon
      use_summon
    elsif @subject.current_action.item.is_greturn
      use_greturn
    else
      yse_use_item_gsummon
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: use_summon
  #--------------------------------------------------------------------------
  def use_summon
    summon = @subject.current_action.summon_id
    if $game_party.battle_members.include?(summon)
      @log_window.display_summon_fail(@subject)
      return
    end
    @log_window.display_summon(@subject, summon)
    #---
    $game_party.summon_aeon(summon)
    unless YSE::GUARDIAN.aeon_party?
      @subject.aeon = summon
    end
    #---
    $imported["YEA-BattleEngine"] ? @status_window.refresh : refresh_status
    @summon_window.redraw_item(summon.guardian_index)
    targets = $game_troop.alive_members
    return battle_log_wait(4) if summon.actor.summon_ani <= 0
    show_animation(targets, summon.actor.summon_ani)
  end
  
  #--------------------------------------------------------------------------
  # new method: use_greturn
  #--------------------------------------------------------------------------
  def use_greturn
    @log_window.display_return(@subject)
    #---
    $game_party.return_aeon(@subject)
    unless YSE::GUARDIAN.aeon_party?
      @subject.greturn
      @subject.summoner = nil
    end
    #---
    $imported["YEA-BattleEngine"] ? @status_window.refresh : refresh_status
    @summon_window.redraw_item(@subject.guardian_index)
    targets = $game_troop.alive_members
    return battle_log_wait(4) if @subject.actor.return_ani <= 0
    show_animation(targets, @subject.actor.return_ani)
  end
  
  #--------------------------------------------------------------------------
  # new method: greturn_battle_end
  #--------------------------------------------------------------------------
  def greturn_battle_end
    $game_party.clear_aeons
    @status_window.refresh
    @summon_window.refresh
  end
  
  #--------------------------------------------------------------------------
  # new method: battle_log_wait
  #--------------------------------------------------------------------------
  def battle_log_wait(abs)
    abs.times do @log_window.wait end
  end
  
end # Scene_Battle

#==============================================================================
#
# ¥ End of File
#
#==============================================================================[/pre]

坑的进度如上                                                                                                        点击↑
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部