#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆ 遅延スキル - KGC_DelaySkill ◆ VX ◆
#_/ ◇ Last update : 2009/09/13 ◇
#_/----------------------------------------------------------------------------
#_/ 発動までにタイムラグが発生するスキルを作成します。
#_/============================================================================
#_/ 【戦闘画面】≪テイルズ式演出≫ より下に導入してください。
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
$imported = {} if $imported == nil
$imported["DelaySkill"] = true
module KGC
module DelaySkill
module Regexp
module Skill
# 遅延スキル
DELAY_SKILL = /<(?:DELAY_SKILL|遅延スキル)\s*(\d+)\s*,\s*(\d+)>/i
end
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ RPG::Skill
#==============================================================================
class RPG::Skill < RPG::UsableItem
#--------------------------------------------------------------------------
# ○ 遅延スキルのキャッシュを生成
#--------------------------------------------------------------------------
def create_delay_skill_cache
@__delay_skill_id = 0
@__delay_skill_turn = 0
self.note.each_line { |line|
case line
when KGC::DelaySkill::Regexp::Skill::DELAY_SKILL
# 遅延スキル
@__delay_skill_id = $1.to_i
@__delay_skill_turn = $2.to_i
end
}
end
#--------------------------------------------------------------------------
# ○ 遅延スキルか
#--------------------------------------------------------------------------
def delay_skill?
create_delay_skill_cache if @__delay_skill_id == nil
return (@__delay_skill_id > 0)
end
#--------------------------------------------------------------------------
# ○ 遅延スキル ID
#--------------------------------------------------------------------------
def delay_skill_id
create_delay_skill_cache if @__delay_skill_id == nil
return @__delay_skill_id
end
#--------------------------------------------------------------------------
# ○ 遅延スキル発動ターン数
#--------------------------------------------------------------------------
def delay_skill_turn
create_delay_skill_cache if @__delay_skill_turn == nil
return @__delay_skill_turn
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# □ Game_DelaySkillInfo
#------------------------------------------------------------------------------
# 遅延スキルの情報を保持するクラスです。
#==============================================================================
class Game_DelaySkillInfo
#--------------------------------------------------------------------------
# ○ 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :skill_id # 発動スキルID
attr_accessor :turn_count # 遅延ターン数
attr_accessor :user # 発動者
#--------------------------------------------------------------------------
# ○ オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@skill_id = 0
@turn_count = 0
@user = nil
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :delay_skills # 遅延スキルリスト
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KGC_DelaySkill initialize
def initialize
initialize_KGC_DelaySkill
@delay_skills = []
end
#--------------------------------------------------------------------------
# ● スキルの適用可能判定
# user : スキルの使用者
# skill : スキル
#--------------------------------------------------------------------------
alias skill_effective_KGC_DelaySkill? skill_effective?
def skill_effective?(user, skill)
@delay_skill_effect = false
result = skill_effective_KGC_DelaySkill?(user, skill)
if result && skill.delay_skill?
@delay_skill_effect = true
result = false
end
return result
end
#--------------------------------------------------------------------------
# ● スキルの効果適用
# user : スキルの使用者
# skill : スキル
#--------------------------------------------------------------------------
alias skill_effect_KGC_DelaySkill skill_effect
def skill_effect(user, skill)
skill_effect_KGC_DelaySkill(user, skill)
make_delay_skill_result(user, skill)
end
#--------------------------------------------------------------------------
# ○ 遅延スキル効果
# user : スキルの使用者
# skill : スキル
#--------------------------------------------------------------------------
def make_delay_skill_result(user, skill)
return unless @skipped # 遅延スキルなら @skipped == true
return unless skill.delay_skill? # 遅延スキルでない
return unless @delay_skill_effect
return if @missed || @evaded # 効果なし
ds = Game_DelaySkillInfo.new
ds.turn_count = skill.delay_skill_turn
ds.skill_id = skill.delay_skill_id
ds.user = user
self.delay_skills << ds
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 戦闘開始の処理
#--------------------------------------------------------------------------
alias process_battle_start_KGC_DelaySkill process_battle_start
def process_battle_start
clear_delay_skills
process_battle_start_KGC_DelaySkill
end
#--------------------------------------------------------------------------
# ○ 遅延スキルのクリア
#--------------------------------------------------------------------------
def clear_delay_skills
actors = []
(1...$data_actors.size).each { |i| actors << $game_actors }
(actors + $game_troop.members).each { |battler|
battler.delay_skills = []
}
end
#--------------------------------------------------------------------------
# ● 戦闘行動の処理
#--------------------------------------------------------------------------
alias process_action_KGC_DelaySkill process_action
def process_action
process_action_KGC_DelaySkill
update_delay_skill if @active_battler != nil
end
#--------------------------------------------------------------------------
# ○ 遅延スキルの更新
#--------------------------------------------------------------------------
def update_delay_skill
@message_window.clear
# 存在しなければ全解除
unless @active_battler.exist?
@active_battler.delay_skills = []
return
end
# 各スキルの発動判定
@active_battler.delay_skills.each_with_index { |ds, i|
ds.turn_count -= 1
if ds.turn_count <= 0
@active_battler.delay_skills = nil
execute_delay_skill(ds)
@message_window.clear
end
}
@active_battler.delay_skills.compact!
end
#--------------------------------------------------------------------------
# ○ 遅延スキルの実行
# delay_skill : 実行する遅延スキル
#--------------------------------------------------------------------------
def execute_delay_skill(delay_skill)
skill = $data_skills[delay_skill.skill_id]
text = @active_battler.name + skill.message1
@message_window.add_instant_text(text)
unless skill.message2.empty?
wait(10)
@message_window.add_instant_text(skill.message2)
end
display_animation([@active_battler], skill.animation_id)
if $game_temp.common_event_id == 0
$game_temp.common_event_id = skill.common_event_id
end
@active_battler.skill_effect(delay_skill.user, skill)
display_action_effects(@active_battler, skill)
end
end
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |