Project1

标题: 如何让多段攻击显示不同伤害? [打印本页]

作者: blueeyescyj    时间: 2014-6-30 10:05
标题: 如何让多段攻击显示不同伤害?
如题,如何让一个拥有多段攻击的技能,每段攻击显示的伤害不同?
作者: taroxd    时间: 2014-6-30 10:10
本来就不同啊……
作者: blueeyescyj    时间: 2014-6-30 10:47
taroxd 发表于 2014-6-30 10:10
本来就不同啊……

= =我是指离散为0的情况下,比如一个拥有5段攻击的技能,5次显示的伤害分别是100,300,200,800,600,让多段攻击里的某一或几下伤害特别突出。
作者: taroxd    时间: 2014-6-30 11:01
blueeyescyj 发表于 2014-6-30 10:47
= =我是指离散为0的情况下,比如一个拥有5段攻击的技能,5次显示的伤害分别是100,300,200,800,600, ...

有个思路,技能1造成100点伤害,并且强制战斗指令触发技能2,技能2造成300点伤害……
只是思路而已,没有实践过。
作者: blueeyescyj    时间: 2014-6-30 11:27
taroxd 发表于 2014-6-30 11:01
有个思路,技能1造成100点伤害,并且强制战斗指令触发技能2,技能2造成300点伤害……
只是思路而已,没有 ...

这个我想过,这样就要设计太多技能了= =
作者: 神秘影子    时间: 2014-7-2 00:24
你的多段是用数据库还是脚本?如果是数据库可以尝试添加公共事件实现循环哦
如以下伤害公式:
a.atk*4 -b.def*2 + v[101]
公共事件内:
变量操作:[100:连击次数]+1
变量操作:[101:伤害加成]+100(这个自己改,可设随机数或定值)
条件分歧:变量[100:连击次数]=9
      结束事件
否则
      强制战斗指令←v←
作者: blueeyescyj    时间: 2014-7-2 01:00
神秘影子 发表于 2014-7-2 00:24
你的多段是用数据库还是脚本?如果是数据库可以尝试添加公共事件实现循环哦
如以下伤害公式:
a.atk*4 -b.d ...

这个可以有(≧▽≦),不过战斗的动画就要重复了。
作者: Arthurrrr    时间: 2014-7-8 11:28
本帖最后由 Arthurrrr 于 2014-7-8 11:29 编辑

连击系统+伤害显示
#==============================================================================
#
# ▼ Yanfly Engine Ace - Active Chain Skills v1.01
# -- Last Updated: 2011.12.22
# -- Level: Hard
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-ActiveChainSkills"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2011.12.22 - Better updating speed for window.
# 2011.12.18 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 這腳本實現了主動連技的可能性,當帶有連技屬性的技能發動時,畫面左下方會出現
# 可以連甚麼技的訊息列表,透過簡單QTE,能立刻發動下一招連技。理論上,只要有足夠
# 的資源(MP, TP) 和連技屬性的設定,是可以無限連技的。
#==============================================================================
# ▼ 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.
#
# -----------------------------------------------------------------------------
# 以下是要放進[技能][註]的東東
# -----------------------------------------------------------------------------
# <chain skill L: x>
# <chain skill R: x>
# <chain skill X: x>
# <chain skill Y: x>
# <chain skill Z: x>
# 這個是給予可連技屬性的東東,X 是技能的編號, 013,102 之類的。放了進去就是代表
# 此技能能連去編號XXX 的技能。當沒有設定時,如只設定了Skill X,Y,Z ,L和R 是不
# 會在連技訊息列表中出現。而不夠資源如MP,TP 時,連技訊息列表中該技能就會黑掉。
# <chain only>
# 這個東東是令該技能在正常技能表中不能選擇,只能透過連技去發動。
#==============================================================================
# ▼ 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.
#
# While this script doesn't interfere with Input Combo Skills, it will most
# likely be unable to used in conjunction with Input Combo Skills. I will not
# provide support for any errors that may occur from this, nor will I be
# responsible for any damage doing this may cause your game.
#
#==============================================================================

module YEA
  module ACTIVE_CHAIN

    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Chain Skill Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # Adjust general settings here. These settings adjust the sound effect
    # played when an active skill is selected and what the minimum time window
    # is for an active chain skill.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # 下面是連技成功時的音效,可改。
    ACTIVE_SKILL_SOUND = RPG::SE.new("Skill2", 80, 100)

    # 下面是設定連技訊息列表出現的時間長度,也就是QTE 的限時。
    MINIMUM_TIME = 120

    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Chain Skill Text -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # 這裡是設定連技訊息列表內容的地方,除了Title 外,都可用text codes.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    CHAIN_TITLE  = "Active Chain Skills"
    TITLE_SIZE   = 20
    L_SKILL_ON   = "\eC[17]Q\eC[0]Chain: "
    L_SKILL_OFF  = "\eC[7]QChain: "
    L_SKILL_ACT  = "\eC[17]QChain: "
    R_SKILL_ON   = "\eC[17]W\eC[0]Chain: "
    R_SKILL_OFF  = "\eC[7]WChain: "
    R_SKILL_ACT  = "\eC[17]WChain: "
    X_SKILL_ON   = "\eC[17]A\eC[0]ttack: "
    X_SKILL_OFF  = "\eC[7]Attack: "
    X_SKILL_ACT  = "\eC[17]Attack: "
    Y_SKILL_ON   = "\eC[17]S\eC[0]trike: "
    Y_SKILL_OFF  = "\eC[7]Strike: "
    Y_SKILL_ACT  = "\eC[17]Strike: "
    Z_SKILL_ON   = "\eC[17]D\eC[0]efend: "
    Z_SKILL_OFF  = "\eC[7]Defend: "
    Z_SKILL_ACT  = "\eC[17]Defend: "

  end # ACTIVE_CHAIN
end # YEA

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

module YEA
  module REGEXP
  module SKILL

    CHAIN_ONLY  = /<(?:CHAIN_ONLY|chain only)>/i
    CHAIN_SKILL = /<(?:CHAIN_SKILL|chain skill)[ ]([LRXYZ]):[ ](\d+)>/i

  end # SKILL
  end # REGEXP
end # YEA

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

module DataManager

  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_acs load_database; end
  def self.load_database
    load_database_acs
    load_notetags_acs
  end

  #--------------------------------------------------------------------------
  # new method: load_notetags_acs
  #--------------------------------------------------------------------------
  def self.load_notetags_acs
    for skill in $data_skills
      next if skill.nil?
      skill.load_notetags_acs
    end
  end

end # DataManager

#==============================================================================
# ■ RPG::Skill
#==============================================================================

class RPG::Skill < RPG::UsableItem

  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :chain_only
  attr_accessor :chain_skill

  #--------------------------------------------------------------------------
  # common cache: load_notetags_acs
  #--------------------------------------------------------------------------
  def load_notetags_acs
    @chain_only = false
    @chain_skill = {}
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YEA::REGEXP::SKILL::CHAIN_ONLY
        @chain_only = true
      when YEA::REGEXP::SKILL::CHAIN_SKILL
        case $1.upcase
        when "L"; @chain_skill[:L] = $2.to_i
        when "R"; @chain_skill[:R] = $2.to_i
        when "X"; @chain_skill[:X] = $2.to_i
        when "Y"; @chain_skill[:Y] = $2.to_i
        when "Z"; @chain_skill[:Z] = $2.to_i
        else; next
        end
      #---
      end
    } # self.note.split
    #---
  end

end # RPG::UsableItem

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

class Game_Action

  #--------------------------------------------------------------------------
  # new method: set_active_chain_skill
  #--------------------------------------------------------------------------
  def set_active_chain_skill(skill_id)
    set_skill(skill_id)
    @target_index = subject.current_action.target_index
    @active_chain_skill = true
  end

  #--------------------------------------------------------------------------
  # alias method: valid?
  #--------------------------------------------------------------------------
  alias game_action_valid_acs valid?
  def valid?
    subject.enable_active_chain(true) if @active_chain_skill
    result = game_action_valid_acs
    subject.enable_active_chain(false) if @active_chain_skill
    return result
  end

end # Game_Action

#==============================================================================
# ■ Game_BattlerBase
#==============================================================================

class Game_BattlerBase

  #--------------------------------------------------------------------------
  # alias method: skill_conditions_met?
  #--------------------------------------------------------------------------
  alias game_battlerbase_skill_conditions_met_acs skill_conditions_met?
  def skill_conditions_met?(skill)
    return false if chain_skill_restriction?(skill)
    return game_battlerbase_skill_conditions_met_acs(skill)
  end

  #--------------------------------------------------------------------------
  # new method: chain_skill_restriction?
  #--------------------------------------------------------------------------
  def chain_skill_restriction?(skill)
    return false unless actor?
    return false unless $game_party.in_battle
    return false unless skill.chain_only
    return !@active_chain_enabled
  end

  #--------------------------------------------------------------------------
  # alias method: hp=
  #--------------------------------------------------------------------------
  alias game_battlerbase_hpequals_acs hp=
  def hp=(value)
    game_battlerbase_hpequals_acs(value)
    return unless SceneManager.scene_is?(Scene_Battle)
    return unless actor?
    return if value == 0
    SceneManager.scene.refresh_active_chain_skill_window(self)
  end

  #--------------------------------------------------------------------------
  # alias method: mp=
  #--------------------------------------------------------------------------
  alias game_battlerbase_mpequals_acs mp=
  def mp=(value)
    game_battlerbase_mpequals_acs(value)
    return unless SceneManager.scene_is?(Scene_Battle)
    return unless actor?
    return if value == 0
    SceneManager.scene.refresh_active_chain_skill_window(self)
  end

  #--------------------------------------------------------------------------
  # alias method: tp=
  #--------------------------------------------------------------------------
  alias game_battlerbase_tpequals_acs tp=
  def tp=(value)
    game_battlerbase_tpequals_acs(value)
    return unless SceneManager.scene_is?(Scene_Battle)
    return unless actor?
    return if value == 0
    SceneManager.scene.refresh_active_chain_skill_window(self)
  end

end # Game_BattlerBase

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

class Game_Battler < Game_BattlerBase

  #--------------------------------------------------------------------------
  # alias method: on_battle_start
  #--------------------------------------------------------------------------
  alias game_battler_on_battle_start_acs on_battle_start
  def on_battle_start
    game_battler_on_battle_start_acs
    @active_chain_enabled = false
  end

  #--------------------------------------------------------------------------
  # alias method: on_battle_end
  #--------------------------------------------------------------------------
  alias game_battler_on_battle_end_acs on_battle_end
  def on_battle_end
    game_battler_on_battle_end_acs
    @active_chain_enabled = false
  end

  #--------------------------------------------------------------------------
  # new method: enable_active_chain
  #--------------------------------------------------------------------------
  def enable_active_chain(active)
    return unless actor?
    @active_chain_enabled = active
  end

  #--------------------------------------------------------------------------
  # new method: add_active_skill_chain
  #--------------------------------------------------------------------------
  def add_active_skill_chain(skill_id)
    chain_skill = Game_Action.new(self)
    chain_skill.set_active_chain_skill(skill_id)
    @actions.insert(1, chain_skill)
  end

end # Game_Battler

#==============================================================================
# ■ Window_ChainSkillList
#==============================================================================

class Window_ChainSkillList < Window_Base

  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize
    dw = [Graphics.width/2, 320].max
    super(-standard_padding, 0, dw, fitting_height(6))
    self.z = 200
    self.opacity = 0
    hide
  end

  #--------------------------------------------------------------------------
  # reveal
  #--------------------------------------------------------------------------
  def reveal(battler, skill)
    @battler = battler
    @skill = skill
    @chain_skills = []
    for key in skill.chain_skill
      next if key[1].nil?
      next if $data_skills[key[1]].nil?
      next unless @battler.skills.include?($data_skills[key[1]])
      @chain_skills.push($data_skills[key[1]])
    end
    return if @chain_skills == []
    self.y = Graphics.height - fitting_height(4)
    self.y -= fitting_height(@chain_skills.size + 1)
    show
    activate
    @enabled = true
    refresh
  end

  #--------------------------------------------------------------------------
  # button=
  #--------------------------------------------------------------------------
  def button=(button)
    @Button = button
    @enabled = false
    refresh unless @button.nil?
  end

  #--------------------------------------------------------------------------
  # refresh_check
  #--------------------------------------------------------------------------
  def refresh_check(battler)
    return if @battler != battler
    refresh
  end

  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    @button = nil if @enabled
    contents.clear
    draw_background_colour
    draw_horz_line(0)
    draw_combo_title
    draw_chain_skills
  end

  #--------------------------------------------------------------------------
  # draw_background_colour
  #--------------------------------------------------------------------------
  def draw_background_colour
    dh = line_height * (@chain_skills.size + 1)
    rect = Rect.new(0, 0, contents.width, dh)
    back_colour1 = Color.new(0, 0, 0, 192)
    back_colour2 = Color.new(0, 0, 0, 0)
    contents.gradient_fill_rect(rect, back_colour1, back_colour2)
  end

  #--------------------------------------------------------------------------
  # draw_horz_line
  #--------------------------------------------------------------------------
  def draw_horz_line(dy)
    line_y = dy + line_height - 2
    line_colour = normal_color
    line_colour.alpha = 48
    contents.fill_rect(0, line_y, contents.width, 2, line_colour)
  end

  #--------------------------------------------------------------------------
  # draw_combo_title
  #--------------------------------------------------------------------------
  def draw_combo_title
    reset_font_settings
    text = YEA::ACTIVE_CHAIN::CHAIN_TITLE
    contents.font.size = YEA::ACTIVE_CHAIN::TITLE_SIZE
    contents.font.bold = true
    contents.font.italic = true
    draw_text(12, 0, contents.width - 12, line_height, text)
    reset_font_settings
  end

  #--------------------------------------------------------------------------
  # draw_chain_skills
  #--------------------------------------------------------------------------
  def draw_chain_skills
    button_array = [:L, :R, :X, :Y, :Z]
    dx = 24
    dy = line_height
    for button in button_array
      next if @skill.chain_skill[button].nil?
      chain_skill = $data_skills[@skill.chain_skill[button]]
      next unless @battler.skills.include?(chain_skill)
      text = text_setting(button, chain_skill)
      text += sprintf("\eI[%d]", chain_skill.icon_index)
      text += chain_skill.name
      draw_text_ex(dx, dy, text)
      dy += line_height
    end
  end

  #--------------------------------------------------------------------------
  # text_setting
  #--------------------------------------------------------------------------
  def text_setting(button, skill)
    active = button == @button
    text = ""
    case button
    when :L
      if @enabled && @battler.usable?(skill)
        text = YEA::ACTIVE_CHAIN::L_SKILL_ON
      elsif !@enabled && active
        text = YEA::ACTIVE_CHAIN::L_SKILL_ACT
      else
        text = YEA::ACTIVE_CHAIN::L_SKILL_OFF
      end
    when :R
      if @enabled && @battler.usable?(skill)
        text = YEA::ACTIVE_CHAIN::R_SKILL_ON
      elsif !@enabled && active
        text = YEA::ACTIVE_CHAIN::R_SKILL_ACT
      else
        text = YEA::ACTIVE_CHAIN::R_SKILL_OFF
      end
    when :X
      if @enabled && @battler.usable?(skill)
        text = YEA::ACTIVE_CHAIN::X_SKILL_ON
      elsif !@enabled && active
        text = YEA::ACTIVE_CHAIN::X_SKILL_ACT
      else
        text = YEA::ACTIVE_CHAIN::X_SKILL_OFF
      end
    when :Y
      if @enabled && @battler.usable?(skill)
        text = YEA::ACTIVE_CHAIN::Y_SKILL_ON
      elsif !@enabled && active
        text = YEA::ACTIVE_CHAIN::Y_SKILL_ACT
      else
        text = YEA::ACTIVE_CHAIN::Y_SKILL_OFF
      end
    when :Z
      if @enabled && @battler.usable?(skill)
        text = YEA::ACTIVE_CHAIN::Z_SKILL_ON
      elsif !@enabled && active
        text = YEA::ACTIVE_CHAIN::Z_SKILL_ACT
      else
        text = YEA::ACTIVE_CHAIN::Z_SKILL_OFF
      end
    end
    return text
  end

end # Window_ChainSkillList

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

class Scene_Battle < Scene_Base

  #--------------------------------------------------------------------------
  # alias method: create_all_windows
  #--------------------------------------------------------------------------
  alias scene_battle_create_all_windows_acs create_all_windows
  def create_all_windows
    scene_battle_create_all_windows_acs
    create_chain_skill_window
  end

  #--------------------------------------------------------------------------
  # new method: create_chain_skill_window
  #--------------------------------------------------------------------------
  def create_chain_skill_window
    @active_chain_skill_window = Window_ChainSkillList.new
    @active_chain_skill_counter = 0
  end

  #--------------------------------------------------------------------------
  # alias method: use_item
  #--------------------------------------------------------------------------
  alias scene_battle_use_item_acs use_item
  def use_item
    @subject.enable_active_chain(true)
    item = @subject.current_action.item
    chain_skill_list_appear(true, item)
    start_active_skill_counter(item)
    scene_battle_use_item_acs
    wait_active_skill_counter
    chain_skill_list_appear(false, item)
    @subject.enable_active_chain(false)
  end

  #--------------------------------------------------------------------------
  # new method: chain_skill_list_appear
  #--------------------------------------------------------------------------
  def chain_skill_list_appear(visible, skill)
    return if @subject.nil?
    return unless @subject.actor?
    return unless skill.is_a?(RPG::Skill)
    @active_chain_skill = 0
    @current_chain_skill = skill
    @active_chain_skill_window.reveal(@subject, skill) if visible
    @active_chain_skill_window.hide unless visible
  end

  #--------------------------------------------------------------------------
  # new method: refresh_active_chain_skill_window
  #--------------------------------------------------------------------------
  def refresh_active_chain_skill_window(battler)
    return unless @active_chain_skill_window.visible
    @active_chain_skill_window.refresh_check(battler)
  end

  #--------------------------------------------------------------------------
  # new method: start_active_skill_counter
  #--------------------------------------------------------------------------
  def start_active_skill_counter(skill)
    return unless @active_chain_skill_window.visible
    @active_chain_skill_counter = YEA::ACTIVE_CHAIN::MINIMUM_TIME
  end

  #--------------------------------------------------------------------------
  # new method: wait_active_skill_counter
  #--------------------------------------------------------------------------
  def wait_active_skill_counter
    return unless @active_chain_skill_window.visible
    wait(@active_chain_skill_counter)
  end

  #--------------------------------------------------------------------------
  # new method: update_active_chain_skill_counter
  #--------------------------------------------------------------------------
  def update_active_chain_skill_counter
    return if @active_chain_skill_counter == 0
    @active_chain_skill_counter -= 1
  end

  #--------------------------------------------------------------------------
  # alias method: update_basic
  #--------------------------------------------------------------------------
  alias scene_battle_update_basic_acs update_basic
  def update_basic
    scene_battle_update_basic_acs
    update_active_chain_skill_counter
    update_active_chain_skill_select
  end

  #--------------------------------------------------------------------------
  # new method: update_active_chain_skill_select
  #--------------------------------------------------------------------------
  def update_active_chain_skill_select
    return unless @active_chain_skill_window.visible
    return if @active_chain_skill > 0
    if Input.press?(:L)
      check_active_chain_skill(:L)
    elsif Input.press?(:R)
      check_active_chain_skill(:R)
    elsif Input.press?(:X)
      check_active_chain_skill(:X)
    elsif Input.press?(:Y)
      check_active_chain_skill(:Y)
    elsif Input.press?(:Z)
      check_active_chain_skill(:Z)
    end
  end

  #--------------------------------------------------------------------------
  # new method: check_active_chain_skill
  #--------------------------------------------------------------------------
  def check_active_chain_skill(button)
    skill_id = @current_chain_skill.chain_skill[button]
    return if skill_id.nil?
    return if $data_skills[skill_id].nil?
    chain_skill = $data_skills[skill_id]
    return unless @subject.usable?(chain_skill)
    return unless @subject.skills.include?(chain_skill)
    @active_chain_skill_counter = 12
    @active_chain_skill = skill_id
    @active_chain_skill_window.button = button
    YEA::ACTIVE_CHAIN::ACTIVE_SKILL_SOUND.play
    @subject.add_active_skill_chain(skill_id)
  end

end # Scene_Battle

#==============================================================================
#
# ▼ End of File
#
#==============================================================================
RUBY 代码复制
  1. #==============================================================================
  2. # +++ MOG - Combo Count (v1.2) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # [url]http://www.atelier-rgss.com/[/url]
  6. #==============================================================================
  7. # Apresenta a quantidade de acertos no alvo e o dano maximo.
  8. #==============================================================================
  9. # É necessário ter os arquivos imagens na pasta Graphics/Systems.
  10. # Combo_Damage.png
  11. # Combo_Hud.png
  12. # Combo_Number.png
  13. #==============================================================================
  14.  
  15. #==============================================================================
  16. # ● Histórico (Version History)
  17. #==============================================================================
  18. # v 1.2 - Corrigido o erro de crash randômico. (relativo a dispose de imagem.)
  19. # v 1.1 - Opção de definir a prioridade da Hud.
  20. #==============================================================================
  21. module MOG_COMBO_COUNT
  22.   #Ativar tempo para fazer combo.
  23.   TIME_COUNT = true
  24.   # Tempo para fazer um combo. (60 = 1s)
  25.   COMBO_TIME = 120
  26.   # Cancelar a contagem de Combo caso o inimigo acertar o herói.
  27.   ENEMY_CANCEL_COMBO = true
  28.   # Posição geral das imagens. X Y
  29.   COMBO_POSITION = [10,90]
  30.   # Posição do número de HITS. X Y
  31.   HIT_POSITION = [55,20]
  32.   # Posição do número de dano. X Y
  33.   TOTAL_POSITION = [100,-20]
  34.   # Prioridade da HUD
  35.   HUD_Z = 1
  36. end
  37.  
  38. #===============================================================================
  39. # ■ Game_Temp
  40. #===============================================================================
  41. class Game_Temp
  42.    attr_accessor :combo_hit
  43.    attr_accessor :max_damage   
  44.    attr_accessor :combo_time  
  45.   #--------------------------------------------------------------------------
  46.   # ● initialize
  47.   #--------------------------------------------------------------------------   
  48.    alias mog_combo_display_initialize initialize
  49.    def initialize
  50.        @combo_hit = 0
  51.        @max_damage = 0  
  52.        @combo_time = 0   
  53.        mog_combo_display_initialize
  54.    end
  55. end
  56.  
  57. #===============================================================================
  58. # ■ Game_Battler
  59. #===============================================================================
  60. class Game_Battler
  61.  
  62.   #--------------------------------------------------------------------------
  63.   # ● Item Apply
  64.   #--------------------------------------------------------------------------      
  65.   alias mog_combo_display_item_apply item_apply
  66.   def item_apply(user, item)
  67.       mog_combo_display_item_apply(user, item)
  68.       unless @result.hit?
  69.          $game_temp.combo_time = 0
  70.       end  
  71.   end  
  72.  
  73.   #--------------------------------------------------------------------------
  74.   # ● execute_damage
  75.   #--------------------------------------------------------------------------     
  76.   alias mog_combo_display_execute_damage execute_damage
  77.   def execute_damage(user)
  78.       mog_combo_display_execute_damage(user)
  79.       if @result.hp_damage > 0   
  80.           if user.is_a?(Game_Actor)  
  81.              $game_temp.combo_hit += 1
  82.              $game_temp.max_damage += @result.hp_damage
  83.              $game_temp.combo_time = MOG_COMBO_COUNT::COMBO_TIME
  84.           else
  85.              $game_temp.combo_time = 0 if MOG_COMBO_COUNT::ENEMY_CANCEL_COMBO == true
  86.           end  
  87.       end  
  88.     end
  89. end
  90.  
  91. #===============================================================================
  92. # Scene_Battle
  93. #===============================================================================
  94. class Scene_Battle < Scene_Base
  95.  
  96.   #--------------------------------------------------------------------------
  97.   # ● start
  98.   #--------------------------------------------------------------------------
  99.   alias mog_combo_start start
  100.   def start
  101.       create_cb_sprite
  102.       mog_combo_start
  103.   end
  104.  
  105.   #--------------------------------------------------------------------------
  106.   # ● create_cb_sprite
  107.   #--------------------------------------------------------------------------  
  108.   def create_cb_sprite
  109.       @combo_sprite = Combo_Sprite_Hud.new
  110.   end
  111.  
  112.   #--------------------------------------------------------------------------
  113.   # ● Terminate
  114.   #--------------------------------------------------------------------------  
  115.   alias mog_combo_terminate terminate
  116.   def terminate
  117.       mog_combo_terminate
  118.       @combo_sprite.dispose
  119.   end
  120.  
  121.   #--------------------------------------------------------------------------
  122.   # ● update_basic
  123.   #--------------------------------------------------------------------------
  124.   alias mog_combo_update_basic update_basic
  125.   def update_basic
  126.       mog_combo_update_basic
  127.       update_combo_hit   
  128.   end      
  129.  
  130.   #--------------------------------------------------------------------------
  131.   # ● Update Combo Hit
  132.   #--------------------------------------------------------------------------   
  133.   def update_combo_hit
  134.       @combo_sprite.update
  135.       if (@spriteset.animation? or @spriteset.effect?)
  136.           @combo_sprite.combo_wait = true
  137.       else
  138.           @combo_sprite.combo_wait = false
  139.       end      
  140.   end
  141.  
  142. end  
  143.  
  144. #===============================================================================
  145. # ■ Combo_Sprite_Hud
  146. #===============================================================================
  147. class Combo_Sprite_Hud
  148.    attr_accessor :combo_wait
  149.    include MOG_COMBO_COUNT
  150.  
  151. #--------------------------------------------------------------------------
  152. # ● Initialize
  153. #--------------------------------------------------------------------------
  154.   def initialize
  155.       dispose
  156.       @combo_wait = false
  157.       $game_temp.combo_time = 0
  158.       $game_temp.combo_hit = 0
  159.       $game_temp.max_damage = 0     
  160.       @combo_hit_old = 0
  161.       @animation_speed = 0
  162.       @pos_x = COMBO_POSITION[0]
  163.       @pos_x_fix = 0
  164.       @pos_y = COMBO_POSITION[1]
  165.       create_combo_sprite
  166.       create_total_damage_sprite     
  167.       create_hud_sprite     
  168.    end  
  169.  
  170. #--------------------------------------------------------------------------
  171. # ● create_hud_sprite   
  172. #--------------------------------------------------------------------------
  173. def create_hud_sprite   
  174.      @hud = Sprite.new
  175.      @hud.bitmap = Cache.system("Combo_HUD")
  176.      @hud.z = HUD_Z
  177.      @hud.x = COMBO_POSITION[0]
  178.      @hud.y = COMBO_POSITION[1]
  179.      @hud.opacity = 250
  180.      @hud.visible = false
  181. end
  182.  
  183. #--------------------------------------------------------------------------
  184. # ● create_total_damage_sprite
  185. #--------------------------------------------------------------------------
  186. def create_total_damage_sprite   
  187.      @total_image = Cache.system("Combo_damage")
  188.      @total = Sprite.new
  189.      @total.bitmap = Bitmap.new(@combo_image.width,@combo_image.height)
  190.      @total_im_cw = @total_image.width / 10
  191.      @total_im_ch = @total_image.height     
  192.      @total.z = HUD_Z + 1
  193.      @total_orig_x = COMBO_POSITION[0] + TOTAL_POSITION[0]
  194.      @total_orig_y = COMBO_POSITION[1] + TOTAL_POSITION[1]
  195.      @total.x = @total_orig_x
  196.      @total.y = @total_orig_y
  197.      @total.zoom_x = 1.00
  198.      @total.zoom_y = 1.00
  199.      @total.opacity = 250  
  200.      @total.visible = false
  201. end     
  202.  
  203. #--------------------------------------------------------------------------
  204. # ● create_combo_number  
  205. #--------------------------------------------------------------------------
  206. def create_combo_sprite
  207.      @combo_image = Cache.system("Combo_Number")
  208.      @combo = Sprite.new
  209.      @combo.bitmap = Bitmap.new(@combo_image.width,@combo_image.height)
  210.      @combo_im_cw = @combo_image.width / 10
  211.      @combo_im_ch = @combo_image.height     
  212.      @combo.z = HUD_Z + 2
  213.      @combo_orig_x = COMBO_POSITION[0] + HIT_POSITION[0]
  214.      @combo_orig_y = COMBO_POSITION[1] + HIT_POSITION[1]
  215.      @combo.zoom_x = 1.00
  216.      @combo.zoom_y = 1.00
  217.      @combo.opacity = 250
  218.      @combo.visible = false
  219. end  
  220.  
  221. #--------------------------------------------------------------------------
  222. # ● Dispose
  223. #--------------------------------------------------------------------------
  224.    def dispose
  225.        return if @hud == nil
  226.        @hud.bitmap.dispose
  227.        @hud.dispose
  228.        @hud = nil
  229.        @combo_image.dispose
  230.        @combo.bitmap.dispose
  231.        @combo.dispose
  232.        @total_image.dispose      
  233.        @total.bitmap.dispose
  234.        @total.dispose
  235.    end
  236.  
  237. #--------------------------------------------------------------------------
  238. # ● Refresh
  239. #--------------------------------------------------------------------------
  240.    def refresh
  241.      @combo_hit_old = $game_temp.combo_hit
  242.      @combo.bitmap.clear
  243.      @total.bitmap.clear
  244.      @combo_number_text = $game_temp.combo_hit.abs.to_s.split(//)
  245.      for r in [email]0..@combo_number_text.size[/email] - 1
  246.        @combo_number_abs = @combo_number_text[r].to_i
  247.        @combo_src_rect = Rect.new(@combo_im_cw * @combo_number_abs, 0, @combo_im_cw, @combo_im_ch)
  248.        @combo.bitmap.blt(@combo_im_cw *  r, 0, @combo_image, @combo_src_rect)        
  249.      end            
  250.      @total_number_text = $game_temp.max_damage.abs.to_s.split(//)
  251.      for r in [email]0..@total_number_text.size[/email] - 1
  252.        @total_number_abs = @total_number_text[r].to_i
  253.        @total_src_rect = Rect.new(@total_im_cw * @total_number_abs, 0, @total_im_cw, @total_im_ch)
  254.        @total.bitmap.blt(@total_im_cw *  r, 20, @total_image, @total_src_rect)        
  255.      end
  256.        #Combo Position
  257.        @pos_x_fix = (@combo_im_cw / 2 * @combo_number_text.size)
  258.        @combo.x = @combo_orig_x - @pos_x_fix
  259.        @combo.y = @combo_orig_y
  260.        @combo.zoom_x = 2
  261.        @combo.zoom_y = 2
  262.        @combo.opacity = 70
  263.        @combo.visible = true
  264.        #Total Position      
  265.        @total.x = @total_orig_x + 20
  266.        @total.y = @total_orig_y     
  267.        @total.opacity = 100
  268.        @total.visible = true            
  269.        #Hud Position
  270.        @hud.x = COMBO_POSITION[0]
  271.        @hud.y = COMBO_POSITION[1]
  272.        @hud.opacity = 255
  273.        @hud.visible = true
  274. end   
  275.  
  276. #--------------------------------------------------------------------------
  277. # ● Slide Update
  278. #--------------------------------------------------------------------------
  279.   def slide_update
  280.     return if !@combo.visible
  281.     if $game_temp.combo_time > 0 and @combo_wait == false
  282.        $game_temp.combo_time -= 1 if TIME_COUNT == true
  283.     end
  284.     if $game_temp.combo_time > 0 and $game_temp.combo_hit > 0   
  285.          #Total Damage
  286.          if @total.x > @total_orig_x
  287.             @total.x -= 1
  288.             @total.opacity += 8
  289.          else   
  290.             @total.x = @total_orig_x
  291.             @total.opacity = 255
  292.          end  
  293.          #Combo
  294.          if @combo.zoom_x > 1.00
  295.             @combo.zoom_x -= 0.05
  296.             @combo.zoom_y -= 0.05      
  297.             @combo.opacity += 8
  298.          else
  299.             @combo.zoom_x = 1
  300.             @combo.zoom_y = 1
  301.             @combo.opacity = 255
  302.             @combo.x = @combo_orig_x - @pos_x_fix
  303.             @combo.y = @combo_orig_y
  304.          end           
  305.      elsif $game_temp.combo_time == 0 and @combo.visible
  306.            @combo.x -= 5
  307.            @combo.opacity -= 10
  308.            @total.x -= 3
  309.            @total.opacity -= 10
  310.            @hud.x += 5
  311.            @hud.opacity -= 10     
  312.            $game_temp.combo_hit = 0
  313.            @combo_hit_old = $game_temp.combo_hit
  314.            $game_temp.max_damage = 0
  315.            if @combo.opacity <= 0
  316.               @combo.visible = false
  317.               @total.visible = false
  318.               @hud.visible = false
  319.            end  
  320.      end   
  321.   end
  322.  
  323. #--------------------------------------------------------------------------
  324. # ● Cancel
  325. #--------------------------------------------------------------------------   
  326.   def cancel
  327.       $game_temp.combo_hit = 0
  328.       $game_temp.max_damage = 0
  329.       $game_temp.combo_time = 0      
  330.       @combo_hit_old = $game_temp.combo_hit
  331.   end  
  332.  
  333. #--------------------------------------------------------------------------
  334. # ● Clear
  335. #--------------------------------------------------------------------------     
  336.   def clear
  337.       $game_temp.combo_time = 0
  338.   end      
  339.  
  340. #--------------------------------------------------------------------------
  341. # ● Update
  342. #--------------------------------------------------------------------------
  343.   def update
  344.       return if @hud == nil
  345.       refresh if $game_temp.combo_hit != @combo_hit_old
  346.       slide_update
  347.   end   
  348. end
  349.  
  350. $mog_rgss3_combo_count = true
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Active Chain Skills v1.01
  4. # -- Last Updated: 2011.12.22
  5. # -- Level: Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-ActiveChainSkills"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2011.12.22 - Better updating speed for window.
  15. # 2011.12.18 - Started Script and Finished.
  16. #
  17. #==============================================================================
  18. # ▼ Introduction
  19. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  20. # 這腳本實現了主動連技的可能性,當帶有連技屬性的技能發動時,畫面左下方會出現
  21. # 可以連甚麼技的訊息列表,透過簡單QTE,能立刻發動下一招連技。理論上,只要有足夠
  22. # 的資源(MP, TP) 和連技屬性的設定,是可以無限連技的。
  23. #==============================================================================
  24. # ▼ Instructions
  25. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  26. # To install this script, open up your script editor and copy/paste this script
  27. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  28. #
  29. # -----------------------------------------------------------------------------
  30. # 以下是要放進[技能][註]的東東
  31. # -----------------------------------------------------------------------------
  32. # <chain skill L: x>
  33. # <chain skill R: x>
  34. # <chain skill X: x>
  35. # <chain skill Y: x>
  36. # <chain skill Z: x>
  37. # 這個是給予可連技屬性的東東,X 是技能的編號, 013,102 之類的。放了進去就是代表
  38. # 此技能能連去編號XXX 的技能。當沒有設定時,如只設定了Skill X,Y,Z ,L和R 是不
  39. # 會在連技訊息列表中出現。而不夠資源如MP,TP 時,連技訊息列表中該技能就會黑掉。
  40. # <chain only>
  41. # 這個東東是令該技能在正常技能表中不能選擇,只能透過連技去發動。
  42. #==============================================================================
  43. # ▼ Compatibility
  44. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  45. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  46. # it will run with RPG Maker VX without adjusting.
  47. #
  48. # While this script doesn't interfere with Input Combo Skills, it will most
  49. # likely be unable to used in conjunction with Input Combo Skills. I will not
  50. # provide support for any errors that may occur from this, nor will I be
  51. # responsible for any damage doing this may cause your game.
  52. #
  53. #==============================================================================

  54. module YEA
  55.   module ACTIVE_CHAIN

  56.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  57.     # - Chain Skill Settings -
  58.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  59.     # Adjust general settings here. These settings adjust the sound effect
  60.     # played when an active skill is selected and what the minimum time window
  61.     # is for an active chain skill.
  62.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  63.     # 下面是連技成功時的音效,可改。
  64.     ACTIVE_SKILL_SOUND = RPG::SE.new("Skill2", 80, 100)

  65.     # 下面是設定連技訊息列表出現的時間長度,也就是QTE 的限時。
  66.     MINIMUM_TIME = 120

  67.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  68.     # - Chain Skill Text -
  69.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  70.     # 這裡是設定連技訊息列表內容的地方,除了Title 外,都可用text codes.
  71.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  72.     CHAIN_TITLE  = "Active Chain Skills"
  73.     TITLE_SIZE   = 20
  74.     L_SKILL_ON   = "\eC[17]Q\eC[0]Chain: "
  75.     L_SKILL_OFF  = "\eC[7]QChain: "
  76.     L_SKILL_ACT  = "\eC[17]QChain: "
  77.     R_SKILL_ON   = "\eC[17]W\eC[0]Chain: "
  78.     R_SKILL_OFF  = "\eC[7]WChain: "
  79.     R_SKILL_ACT  = "\eC[17]WChain: "
  80.     X_SKILL_ON   = "\eC[17]A\eC[0]ttack: "
  81.     X_SKILL_OFF  = "\eC[7]Attack: "
  82.     X_SKILL_ACT  = "\eC[17]Attack: "
  83.     Y_SKILL_ON   = "\eC[17]S\eC[0]trike: "
  84.     Y_SKILL_OFF  = "\eC[7]Strike: "
  85.     Y_SKILL_ACT  = "\eC[17]Strike: "
  86.     Z_SKILL_ON   = "\eC[17]D\eC[0]efend: "
  87.     Z_SKILL_OFF  = "\eC[7]Defend: "
  88.     Z_SKILL_ACT  = "\eC[17]Defend: "

  89.   end # ACTIVE_CHAIN
  90. end # YEA

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

  96. module YEA
  97.   module REGEXP
  98.   module SKILL

  99.     CHAIN_ONLY  = /<(?:CHAIN_ONLY|chain only)>/i
  100.     CHAIN_SKILL = /<(?:CHAIN_SKILL|chain skill)[ ]([LRXYZ]):[ ](\d+)>/i

  101.   end # SKILL
  102.   end # REGEXP
  103. end # YEA

  104. #==============================================================================
  105. # ■ DataManager
  106. #==============================================================================

  107. module DataManager

  108.   #--------------------------------------------------------------------------
  109.   # alias method: load_database
  110.   #--------------------------------------------------------------------------
  111.   class <<self; alias load_database_acs load_database; end
  112.   def self.load_database
  113.     load_database_acs
  114.     load_notetags_acs
  115.   end

  116.   #--------------------------------------------------------------------------
  117.   # new method: load_notetags_acs
  118.   #--------------------------------------------------------------------------
  119.   def self.load_notetags_acs
  120.     for skill in $data_skills
  121.       next if skill.nil?
  122.       skill.load_notetags_acs
  123.     end
  124.   end

  125. end # DataManager

  126. #==============================================================================
  127. # ■ RPG::Skill
  128. #==============================================================================

  129. class RPG::Skill < RPG::UsableItem

  130.   #--------------------------------------------------------------------------
  131.   # public instance variables
  132.   #--------------------------------------------------------------------------
  133.   attr_accessor :chain_only
  134.   attr_accessor :chain_skill

  135.   #--------------------------------------------------------------------------
  136.   # common cache: load_notetags_acs
  137.   #--------------------------------------------------------------------------
  138.   def load_notetags_acs
  139.     @chain_only = false
  140.     @chain_skill = {}
  141.     #---
  142.     self.note.split(/[\r\n]+/).each { |line|
  143.       case line
  144.       #---
  145.       when YEA::REGEXP::SKILL::CHAIN_ONLY
  146.         @chain_only = true
  147.       when YEA::REGEXP::SKILL::CHAIN_SKILL
  148.         case $1.upcase
  149.         when "L"; @chain_skill[:L] = $2.to_i
  150.         when "R"; @chain_skill[:R] = $2.to_i
  151.         when "X"; @chain_skill[:X] = $2.to_i
  152.         when "Y"; @chain_skill[:Y] = $2.to_i
  153.         when "Z"; @chain_skill[:Z] = $2.to_i
  154.         else; next
  155.         end
  156.       #---
  157.       end
  158.     } # self.note.split
  159.     #---
  160.   end

  161. end # RPG::UsableItem

  162. #==============================================================================
  163. # ■ Game_Action
  164. #==============================================================================

  165. class Game_Action

  166.   #--------------------------------------------------------------------------
  167.   # new method: set_active_chain_skill
  168.   #--------------------------------------------------------------------------
  169.   def set_active_chain_skill(skill_id)
  170.     set_skill(skill_id)
  171.     @target_index = subject.current_action.target_index
  172.     @active_chain_skill = true
  173.   end

  174.   #--------------------------------------------------------------------------
  175.   # alias method: valid?
  176.   #--------------------------------------------------------------------------
  177.   alias game_action_valid_acs valid?
  178.   def valid?
  179.     subject.enable_active_chain(true) if @active_chain_skill
  180.     result = game_action_valid_acs
  181.     subject.enable_active_chain(false) if @active_chain_skill
  182.     return result
  183.   end

  184. end # Game_Action

  185. #==============================================================================
  186. # ■ Game_BattlerBase
  187. #==============================================================================

  188. class Game_BattlerBase

  189.   #--------------------------------------------------------------------------
  190.   # alias method: skill_conditions_met?
  191.   #--------------------------------------------------------------------------
  192.   alias game_battlerbase_skill_conditions_met_acs skill_conditions_met?
  193.   def skill_conditions_met?(skill)
  194.     return false if chain_skill_restriction?(skill)
  195.     return game_battlerbase_skill_conditions_met_acs(skill)
  196.   end

  197.   #--------------------------------------------------------------------------
  198.   # new method: chain_skill_restriction?
  199.   #--------------------------------------------------------------------------
  200.   def chain_skill_restriction?(skill)
  201.     return false unless actor?
  202.     return false unless $game_party.in_battle
  203.     return false unless skill.chain_only
  204.     return !@active_chain_enabled
  205.   end

  206.   #--------------------------------------------------------------------------
  207.   # alias method: hp=
  208.   #--------------------------------------------------------------------------
  209.   alias game_battlerbase_hpequals_acs hp=
  210.   def hp=(value)
  211.     game_battlerbase_hpequals_acs(value)
  212.     return unless SceneManager.scene_is?(Scene_Battle)
  213.     return unless actor?
  214.     return if value == 0
  215.     SceneManager.scene.refresh_active_chain_skill_window(self)
  216.   end

  217.   #--------------------------------------------------------------------------
  218.   # alias method: mp=
  219.   #--------------------------------------------------------------------------
  220.   alias game_battlerbase_mpequals_acs mp=
  221.   def mp=(value)
  222.     game_battlerbase_mpequals_acs(value)
  223.     return unless SceneManager.scene_is?(Scene_Battle)
  224.     return unless actor?
  225.     return if value == 0
  226.     SceneManager.scene.refresh_active_chain_skill_window(self)
  227.   end

  228.   #--------------------------------------------------------------------------
  229.   # alias method: tp=
  230.   #--------------------------------------------------------------------------
  231.   alias game_battlerbase_tpequals_acs tp=
  232.   def tp=(value)
  233.     game_battlerbase_tpequals_acs(value)
  234.     return unless SceneManager.scene_is?(Scene_Battle)
  235.     return unless actor?
  236.     return if value == 0
  237.     SceneManager.scene.refresh_active_chain_skill_window(self)
  238.   end

  239. end # Game_BattlerBase

  240. #==============================================================================
  241. # ■ Game_Battler
  242. #==============================================================================

  243. class Game_Battler < Game_BattlerBase

  244.   #--------------------------------------------------------------------------
  245.   # alias method: on_battle_start
  246.   #--------------------------------------------------------------------------
  247.   alias game_battler_on_battle_start_acs on_battle_start
  248.   def on_battle_start
  249.     game_battler_on_battle_start_acs
  250.     @active_chain_enabled = false
  251.   end

  252.   #--------------------------------------------------------------------------
  253.   # alias method: on_battle_end
  254.   #--------------------------------------------------------------------------
  255.   alias game_battler_on_battle_end_acs on_battle_end
  256.   def on_battle_end
  257.     game_battler_on_battle_end_acs
  258.     @active_chain_enabled = false
  259.   end

  260.   #--------------------------------------------------------------------------
  261.   # new method: enable_active_chain
  262.   #--------------------------------------------------------------------------
  263.   def enable_active_chain(active)
  264.     return unless actor?
  265.     @active_chain_enabled = active
  266.   end

  267.   #--------------------------------------------------------------------------
  268.   # new method: add_active_skill_chain
  269.   #--------------------------------------------------------------------------
  270.   def add_active_skill_chain(skill_id)
  271.     chain_skill = Game_Action.new(self)
  272.     chain_skill.set_active_chain_skill(skill_id)
  273.     @actions.insert(1, chain_skill)
  274.   end

  275. end # Game_Battler

  276. #==============================================================================
  277. # ■ Window_ChainSkillList
  278. #==============================================================================

  279. class Window_ChainSkillList < Window_Base

  280.   #--------------------------------------------------------------------------
  281.   # initialize
  282.   #--------------------------------------------------------------------------
  283.   def initialize
  284.     dw = [Graphics.width/2, 320].max
  285.     super(-standard_padding, 0, dw, fitting_height(6))
  286.     self.z = 200
  287.     self.opacity = 0
  288.     hide
  289.   end

  290.   #--------------------------------------------------------------------------
  291.   # reveal
  292.   #--------------------------------------------------------------------------
  293.   def reveal(battler, skill)
  294.     [url=home.php?mod=space&uid=133701]@battler[/url] = battler
  295.     [url=home.php?mod=space&uid=260100]@skill[/url] = skill
  296.     @chain_skills = []
  297.     for key in skill.chain_skill
  298.       next if key[1].nil?
  299.       next if $data_skills[key[1]].nil?
  300.       next unless @battler.skills.include?($data_skills[key[1]])
  301.       @chain_skills.push($data_skills[key[1]])
  302.     end
  303.     return if @chain_skills == []
  304.     self.y = Graphics.height - fitting_height(4)
  305.     self.y -= fitting_height(@chain_skills.size + 1)
  306.     show
  307.     activate
  308.     @enabled = true
  309.     refresh
  310.   end

  311.   #--------------------------------------------------------------------------
  312.   # button=
  313.   #--------------------------------------------------------------------------
  314.   def button=(button)
  315.     [url=home.php?mod=space&uid=268194]@Button[/url] = button
  316.     @enabled = false
  317.     refresh unless @button.nil?
  318.   end

  319.   #--------------------------------------------------------------------------
  320.   # refresh_check
  321.   #--------------------------------------------------------------------------
  322.   def refresh_check(battler)
  323.     return if @battler != battler
  324.     refresh
  325.   end

  326.   #--------------------------------------------------------------------------
  327.   # refresh
  328.   #--------------------------------------------------------------------------
  329.   def refresh
  330.     @button = nil if @enabled
  331.     contents.clear
  332.     draw_background_colour
  333.     draw_horz_line(0)
  334.     draw_combo_title
  335.     draw_chain_skills
  336.   end

  337.   #--------------------------------------------------------------------------
  338.   # draw_background_colour
  339.   #--------------------------------------------------------------------------
  340.   def draw_background_colour
  341.     dh = line_height * (@chain_skills.size + 1)
  342.     rect = Rect.new(0, 0, contents.width, dh)
  343.     back_colour1 = Color.new(0, 0, 0, 192)
  344.     back_colour2 = Color.new(0, 0, 0, 0)
  345.     contents.gradient_fill_rect(rect, back_colour1, back_colour2)
  346.   end

  347.   #--------------------------------------------------------------------------
  348.   # draw_horz_line
  349.   #--------------------------------------------------------------------------
  350.   def draw_horz_line(dy)
  351.     line_y = dy + line_height - 2
  352.     line_colour = normal_color
  353.     line_colour.alpha = 48
  354.     contents.fill_rect(0, line_y, contents.width, 2, line_colour)
  355.   end

  356.   #--------------------------------------------------------------------------
  357.   # draw_combo_title
  358.   #--------------------------------------------------------------------------
  359.   def draw_combo_title
  360.     reset_font_settings
  361.     text = YEA::ACTIVE_CHAIN::CHAIN_TITLE
  362.     contents.font.size = YEA::ACTIVE_CHAIN::TITLE_SIZE
  363.     contents.font.bold = true
  364.     contents.font.italic = true
  365.     draw_text(12, 0, contents.width - 12, line_height, text)
  366.     reset_font_settings
  367.   end

  368.   #--------------------------------------------------------------------------
  369.   # draw_chain_skills
  370.   #--------------------------------------------------------------------------
  371.   def draw_chain_skills
  372.     button_array = [:L, :R, :X, :Y, :Z]
  373.     dx = 24
  374.     dy = line_height
  375.     for button in button_array
  376.       next if @skill.chain_skill[button].nil?
  377.       chain_skill = $data_skills[@skill.chain_skill[button]]
  378.       next unless @battler.skills.include?(chain_skill)
  379.       text = text_setting(button, chain_skill)
  380.       text += sprintf("\eI[%d]", chain_skill.icon_index)
  381.       text += chain_skill.name
  382.       draw_text_ex(dx, dy, text)
  383.       dy += line_height
  384.     end
  385.   end

  386.   #--------------------------------------------------------------------------
  387.   # text_setting
  388.   #--------------------------------------------------------------------------
  389.   def text_setting(button, skill)
  390.     active = button == @button
  391.     text = ""
  392.     case button
  393.     when :L
  394.       if @enabled && @battler.usable?(skill)
  395.         text = YEA::ACTIVE_CHAIN::L_SKILL_ON
  396.       elsif !@enabled && active
  397.         text = YEA::ACTIVE_CHAIN::L_SKILL_ACT
  398.       else
  399.         text = YEA::ACTIVE_CHAIN::L_SKILL_OFF
  400.       end
  401.     when :R
  402.       if @enabled && @battler.usable?(skill)
  403.         text = YEA::ACTIVE_CHAIN::R_SKILL_ON
  404.       elsif !@enabled && active
  405.         text = YEA::ACTIVE_CHAIN::R_SKILL_ACT
  406.       else
  407.         text = YEA::ACTIVE_CHAIN::R_SKILL_OFF
  408.       end
  409.     when :X
  410.       if @enabled && @battler.usable?(skill)
  411.         text = YEA::ACTIVE_CHAIN::X_SKILL_ON
  412.       elsif !@enabled && active
  413.         text = YEA::ACTIVE_CHAIN::X_SKILL_ACT
  414.       else
  415.         text = YEA::ACTIVE_CHAIN::X_SKILL_OFF
  416.       end
  417.     when :Y
  418.       if @enabled && @battler.usable?(skill)
  419.         text = YEA::ACTIVE_CHAIN::Y_SKILL_ON
  420.       elsif !@enabled && active
  421.         text = YEA::ACTIVE_CHAIN::Y_SKILL_ACT
  422.       else
  423.         text = YEA::ACTIVE_CHAIN::Y_SKILL_OFF
  424.       end
  425.     when :Z
  426.       if @enabled && @battler.usable?(skill)
  427.         text = YEA::ACTIVE_CHAIN::Z_SKILL_ON
  428.       elsif !@enabled && active
  429.         text = YEA::ACTIVE_CHAIN::Z_SKILL_ACT
  430.       else
  431.         text = YEA::ACTIVE_CHAIN::Z_SKILL_OFF
  432.       end
  433.     end
  434.     return text
  435.   end

  436. end # Window_ChainSkillList

  437. #==============================================================================
  438. # ■ Scene_Battle
  439. #==============================================================================

  440. class Scene_Battle < Scene_Base

  441.   #--------------------------------------------------------------------------
  442.   # alias method: create_all_windows
  443.   #--------------------------------------------------------------------------
  444.   alias scene_battle_create_all_windows_acs create_all_windows
  445.   def create_all_windows
  446.     scene_battle_create_all_windows_acs
  447.     create_chain_skill_window
  448.   end

  449.   #--------------------------------------------------------------------------
  450.   # new method: create_chain_skill_window
  451.   #--------------------------------------------------------------------------
  452.   def create_chain_skill_window
  453.     @active_chain_skill_window = Window_ChainSkillList.new
  454.     @active_chain_skill_counter = 0
  455.   end

  456.   #--------------------------------------------------------------------------
  457.   # alias method: use_item
  458.   #--------------------------------------------------------------------------
  459.   alias scene_battle_use_item_acs use_item
  460.   def use_item
  461.     @subject.enable_active_chain(true)
  462.     item = @subject.current_action.item
  463.     chain_skill_list_appear(true, item)
  464.     start_active_skill_counter(item)
  465.     scene_battle_use_item_acs
  466.     wait_active_skill_counter
  467.     chain_skill_list_appear(false, item)
  468.     @subject.enable_active_chain(false)
  469.   end

  470.   #--------------------------------------------------------------------------
  471.   # new method: chain_skill_list_appear
  472.   #--------------------------------------------------------------------------
  473.   def chain_skill_list_appear(visible, skill)
  474.     return if @subject.nil?
  475.     return unless @subject.actor?
  476.     return unless skill.is_a?(RPG::Skill)
  477.     @active_chain_skill = 0
  478.     @current_chain_skill = skill
  479.     @active_chain_skill_window.reveal(@subject, skill) if visible
  480.     @active_chain_skill_window.hide unless visible
  481.   end

  482.   #--------------------------------------------------------------------------
  483.   # new method: refresh_active_chain_skill_window
  484.   #--------------------------------------------------------------------------
  485.   def refresh_active_chain_skill_window(battler)
  486.     return unless @active_chain_skill_window.visible
  487.     @active_chain_skill_window.refresh_check(battler)
  488.   end

  489.   #--------------------------------------------------------------------------
  490.   # new method: start_active_skill_counter
  491.   #--------------------------------------------------------------------------
  492.   def start_active_skill_counter(skill)
  493.     return unless @active_chain_skill_window.visible
  494.     @active_chain_skill_counter = YEA::ACTIVE_CHAIN::MINIMUM_TIME
  495.   end

  496.   #--------------------------------------------------------------------------
  497.   # new method: wait_active_skill_counter
  498.   #--------------------------------------------------------------------------
  499.   def wait_active_skill_counter
  500.     return unless @active_chain_skill_window.visible
  501.     wait(@active_chain_skill_counter)
  502.   end

  503.   #--------------------------------------------------------------------------
  504.   # new method: update_active_chain_skill_counter
  505.   #--------------------------------------------------------------------------
  506.   def update_active_chain_skill_counter
  507.     return if @active_chain_skill_counter == 0
  508.     @active_chain_skill_counter -= 1
  509.   end

  510.   #--------------------------------------------------------------------------
  511.   # alias method: update_basic
  512.   #--------------------------------------------------------------------------
  513.   alias scene_battle_update_basic_acs update_basic
  514.   def update_basic
  515.     scene_battle_update_basic_acs
  516.     update_active_chain_skill_counter
  517.     update_active_chain_skill_select
  518.   end

  519.   #--------------------------------------------------------------------------
  520.   # new method: update_active_chain_skill_select
  521.   #--------------------------------------------------------------------------
  522.   def update_active_chain_skill_select
  523.     return unless @active_chain_skill_window.visible
  524.     return if @active_chain_skill > 0
  525.     if Input.press?(:L)
  526.       check_active_chain_skill(:L)
  527.     elsif Input.press?(:R)
  528.       check_active_chain_skill(:R)
  529.     elsif Input.press?(:X)
  530.       check_active_chain_skill(:X)
  531.     elsif Input.press?(:Y)
  532.       check_active_chain_skill(:Y)
  533.     elsif Input.press?(:Z)
  534.       check_active_chain_skill(:Z)
  535.     end
  536.   end

  537.   #--------------------------------------------------------------------------
  538.   # new method: check_active_chain_skill
  539.   #--------------------------------------------------------------------------
  540.   def check_active_chain_skill(button)
  541.     skill_id = @current_chain_skill.chain_skill[button]
  542.     return if skill_id.nil?
  543.     return if $data_skills[skill_id].nil?
  544.     chain_skill = $data_skills[skill_id]
  545.     return unless @subject.usable?(chain_skill)
  546.     return unless @subject.skills.include?(chain_skill)
  547.     @active_chain_skill_counter = 12
  548.     @active_chain_skill = skill_id
  549.     @active_chain_skill_window.button = button
  550.     YEA::ACTIVE_CHAIN::ACTIVE_SKILL_SOUND.play
  551.     @subject.add_active_skill_chain(skill_id)
  552.   end

  553. end # Scene_Battle

  554. #==============================================================================
  555. #
  556. # ▼ End of File
  557. #
  558. #==============================================================================
复制代码





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