赞 | 0 |
VIP | 0 |
好人卡 | 2 |
积分 | 12 |
经验 | 1937 |
最后登录 | 2012-6-16 |
在线时间 | 274 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1165
- 在线时间
- 274 小时
- 注册时间
- 2011-7-24
- 帖子
- 272
|
脚本 我神马都不知道.....:sleepy:- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- #_/ ◆ DQ特技風スキル - KGC_DQSkill ◆ VX ◆
- #_/ ◇ Last update : 2009/09/04 ◇
- #_/----------------------------------------------------------------------------
- #_/ どこかで見たようなスキルを作成します。
- #_/============================================================================
- #_/ 【基本機能】≪ターゲット拡張≫ より下に導入してください。
- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- #==============================================================================
- # ★ カスタマイズ項目 - Customize BEGIN ★
- #==============================================================================
- module KGC
- module DQSkill
- # ◆ 「かばう」発動時のメッセージ
- # 1つ目の %s : かばう側
- # 2つ目の %s : かばわれる側
- PROTECT_NORMAL_MSG = "%sは%sをかばった!"
- end
- end
- #==============================================================================
- # ☆ カスタマイズ項目終了 - Customize END ☆
- #==============================================================================
- $imported = {} if $imported == nil
- $imported["DQSkill"] = true
- module KGC
- module DQSkill
- module Regexp
- module Skill
- # 大防御
- HYPER_GUARD = /<(?:HYPER_GUARD|大防御)\s*(\d+)[%%]?>/i
- # 被ダメージ変動
- DAMAGE_CHANGE = /<(?:DAMAGE_CHANGE|被ダメージ変動)\s*(\d+)[%%]?>/i
- # かばう
- PROTECT_NORMAL = /<(?:PROTECT_NORMAL|かばう)>/i
- # 仁王立ち
- PROTECT_ALL = /<(?:PROTECT_ALL|仁王立ち|におうだち)>/i
- # ガードアタック
- GUARD_ATTACK = /<(?:GUARD_ATTACK|ガードアタック|シールドアタック)>/i
- end
- end
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Vocab
- #==============================================================================
- module Vocab
- # 「かばう」発動メッセージ
- ProtectNormal = KGC::DQSkill::PROTECT_NORMAL_MSG
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ RPG::Skill
- #==============================================================================
- class RPG::Skill < RPG::UsableItem
- #--------------------------------------------------------------------------
- # ○ DQ特技のキャッシュを生成
- #--------------------------------------------------------------------------
- def create_dq_skill_cache
- @__hyper_guard = false
- @__hyper_guard_rate = 10
- @__damage_change = false
- @__damage_change_rate = 100
- @__protect_normal = false
- @__protect_all = false
- @__guard_attack = false
- self.note.each_line { |line|
- case line
- when KGC::DQSkill::Regexp::Skill::HYPER_GUARD
- # 大防御
- @__hyper_guard = true
- @__hyper_guard_rate = $1.to_i
- when KGC::DQSkill::Regexp::Skill::DAMAGE_CHANGE
- # ダメージ変動
- @__damage_change = true
- @__damage_change_rate = $1.to_i
- when KGC::DQSkill::Regexp::Skill::PROTECT_NORMAL
- # かばう
- @__protect_normal = true
- when KGC::DQSkill::Regexp::Skill::PROTECT_ALL
- # 仁王立ち
- @__protect_all = true
- when KGC::DQSkill::Regexp::Skill::GUARD_ATTACK
- # ガードアタック
- @__guard_attack = true
- end
- }
- end
- #--------------------------------------------------------------------------
- # ○ 大防御
- #--------------------------------------------------------------------------
- def hyper_guard
- create_dq_skill_cache if @__hyper_guard == nil
- return @__hyper_guard
- end
- alias hyper_guard? hyper_guard
- #--------------------------------------------------------------------------
- # ○ 大防御変動率
- #--------------------------------------------------------------------------
- def hyper_guard_rate
- create_dq_skill_cache if @__hyper_guard_rate == nil
- return @__hyper_guard_rate
- end
- #--------------------------------------------------------------------------
- # ○ 被ダメージ変動
- #--------------------------------------------------------------------------
- def damage_change
- create_dq_skill_cache if @__damage_change == nil
- return @__damage_change
- end
- alias damage_change? damage_change
- #--------------------------------------------------------------------------
- # ○ 被ダメージ変動率
- #--------------------------------------------------------------------------
- def damage_change_rate
- create_dq_skill_cache if @__damage_change_rate == nil
- return @__damage_change_rate
- end
- #--------------------------------------------------------------------------
- # ○ かばう
- #--------------------------------------------------------------------------
- def protect_normal
- create_dq_skill_cache if @__protect_normal == nil
- return @__protect_normal
- end
- alias protect_normal? protect_normal
- #--------------------------------------------------------------------------
- # ○ 仁王立ち
- #--------------------------------------------------------------------------
- def protect_all
- create_dq_skill_cache if @__protect_all == nil
- return @__protect_all
- end
- alias protect_all? protect_all
- #--------------------------------------------------------------------------
- # ○ ガードアタック
- #--------------------------------------------------------------------------
- def guard_attack
- create_dq_skill_cache if @__guard_attack == nil
- return @__guard_attack
- end
- alias guard_attack? guard_attack
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Battler
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :unprotectable # 「かばう」不可フラグ
- attr_accessor :protected # 「かばう」発動済みフラグ
- #--------------------------------------------------------------------------
- # ● 行動効果の保持用変数をクリア
- #--------------------------------------------------------------------------
- alias clear_action_results_KGC_DQSkill clear_action_results
- def clear_action_results
- clear_action_results_KGC_DQSkill
- @protected = false
- end
- #--------------------------------------------------------------------------
- # ● 防御中判定
- #--------------------------------------------------------------------------
- alias guarding_KGC_DQSkill? guarding?
- def guarding?
- return (guarding_KGC_DQSkill? || action.guard_attack?)
- end
- #--------------------------------------------------------------------------
- # ● 防御修正の適用
- # damage : ダメージ
- #--------------------------------------------------------------------------
- alias apply_guard_KGC_DQSkill apply_guard
- def apply_guard(damage)
- damage = apply_guard_KGC_DQSkill(damage)
- if damage > 0
- if action.hyper_guard?
- damage = damage * action.hyper_guard_rate / 100
- end
- if action.damage_change?
- damage = damage * action.damage_change_rate / 100
- end
- end
- return damage
- end
- #--------------------------------------------------------------------------
- # ○ かばわれているバトラーを取得
- #--------------------------------------------------------------------------
- def protected_battler
- return nil if unprotectable # 「かばう」不可
- ($game_party.members + $game_troop.members).each { |battler|
- next if battler == self
- next unless battler.movable?
- next unless battler.action.protect_normal?
- if battler.action.skill?
- obj = battler.action.skill
- elsif battler.action.item?
- obj = battler.action.item
- else
- next
- end
- return battler if battler.action.make_obj_targets(obj).include?(self)
- }
- return nil
- end
- #--------------------------------------------------------------------------
- # ● 通常攻撃の効果適用
- # attacker : 攻撃者
- #--------------------------------------------------------------------------
- alias attack_effect_KGC_DQSkill attack_effect
- def attack_effect(attacker)
- protect_normal_effect(attacker)
- return if @skipped
- attack_effect_KGC_DQSkill(attacker)
- end
- #--------------------------------------------------------------------------
- # ● スキルの効果適用
- # user : スキルの使用者
- # skill : スキル
- #--------------------------------------------------------------------------
- alias skill_effect_KGC_DQSkill skill_effect
- def skill_effect(user, skill)
- protect_normal_effect(user, skill)
- return if @skipped
- skill_effect_KGC_DQSkill(user, skill)
- end
- #--------------------------------------------------------------------------
- # ○ 「かばう」効果の適用
- # user : 行動者
- # skill : スキル (nil なら通常攻撃)
- #--------------------------------------------------------------------------
- def protect_normal_effect(user, skill = nil)
- @protected = false
- battler = protected_battler
- clear_action_results
- return if battler == nil || user == battler
- @skipped = true
- @protected = true
- battler.unprotectable = true
- if skill == nil
- battler.attack_effect(user)
- else
- battler.skill_effect(user, skill)
- end
- battler.unprotectable = false
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_BattleAction
- #==============================================================================
- class Game_BattleAction
- #--------------------------------------------------------------------------
- # ○ 大防御判定
- #--------------------------------------------------------------------------
- def hyper_guard?
- return (skill? && skill.hyper_guard?)
- end
- #--------------------------------------------------------------------------
- # ○ 大防御変動率取得
- #--------------------------------------------------------------------------
- def hyper_guard_rate
- return 100 unless hyper_guard?
- return skill.hyper_guard_rate
- end
- #--------------------------------------------------------------------------
- # ○ 被ダメージ変動判定
- #--------------------------------------------------------------------------
- def damage_change?
- return (skill? && skill.damage_change?)
- end
- #--------------------------------------------------------------------------
- # ○ 被ダメージ変動率取得
- #--------------------------------------------------------------------------
- def damage_change_rate
- return 100 unless damage_change?
- return skill.damage_change_rate
- end
- #--------------------------------------------------------------------------
- # ○ かばう判定
- #--------------------------------------------------------------------------
- def protect_normal?
- return (skill? && skill.protect_normal?)
- end
- #--------------------------------------------------------------------------
- # ○ 仁王立ち判定
- #--------------------------------------------------------------------------
- def protect_all?
- return (skill? && skill.protect_all?)
- end
- #--------------------------------------------------------------------------
- # ○ ガードアタック判定
- #--------------------------------------------------------------------------
- def guard_attack?
- return (skill? && skill.guard_attack?)
- end
- #--------------------------------------------------------------------------
- # ● 行動スピードの決定
- #--------------------------------------------------------------------------
- alias make_speed_KGC_DQSkill make_speed
- def make_speed
- make_speed_KGC_DQSkill
- @speed += 2000 if hyper_guard?
- @speed += 1500 if protect_all?
- end
- #--------------------------------------------------------------------------
- # ● 通常攻撃のターゲット作成
- #--------------------------------------------------------------------------
- alias make_attack_targets_KGC_DQSkill make_attack_targets
- def make_attack_targets
- result = make_attack_targets_KGC_DQSkill
- unless battler.confusion?
- result = apply_protect_all(result)
- end
- return result
- end
- #--------------------------------------------------------------------------
- # ● スキルまたはアイテムのターゲット作成
- # obj : スキルまたはアイテム
- #--------------------------------------------------------------------------
- alias make_obj_targets_KGC_DQSkill make_obj_targets
- def make_obj_targets(obj)
- result = make_obj_targets_KGC_DQSkill(obj)
- if obj.for_opponent?
- result = apply_protect_all(result)
- end
- return result
- end
- #--------------------------------------------------------------------------
- # ○ 仁王立ちを適用
- # targets : ターゲット
- #--------------------------------------------------------------------------
- def apply_protect_all(targets)
- result = targets
- # 仁王立ち使用者取得
- protect_battlers = []
- opponents_unit.existing_members.each { |battler|
- protect_battlers << battler if battler.action.protect_all?
- }
- unless protect_battlers.empty?
- # 攻撃を仁王立ち使用者に集中
- num = targets.size
- result = []
- num.times { |i|
- result << protect_battlers[rand(protect_battlers.size)]
- }
- end
- return result
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Scene_Battle
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● アニメーションの表示
- # targets : 対象者の配列
- # animation_id : アニメーション ID (-1: 通常攻撃と同じ)
- #--------------------------------------------------------------------------
- alias display_animation_KGC_DQSkill display_animation
- def display_animation(targets, animation_id)
- display_animation_KGC_DQSkill(
- remove_protected_targets(targets), animation_id)
- end
- #--------------------------------------------------------------------------
- # ● 攻撃アニメーションの表示
- # targets : 対象者の配列
- # 敵キャラの場合は [敵の通常攻撃] 効果音を演奏して一瞬待つ。
- # アクターの場合は二刀流を考慮 (左手武器は反転して表示) 。
- #--------------------------------------------------------------------------
- alias display_attack_animation_KGC_DQSkill display_attack_animation
- def display_attack_animation(targets)
- display_attack_animation_KGC_DQSkill(remove_protected_targets(targets))
- end
- #--------------------------------------------------------------------------
- # ○ かばわれた対象者を除去
- # targets : 対象者の配列
- #--------------------------------------------------------------------------
- def remove_protected_targets(targets)
- return targets if @protected
- targets = targets.clone
- targets.delete_if { |target| target.protected_battler != nil }
- return targets
- end
- #--------------------------------------------------------------------------
- # ● 行動結果の表示
- # target : 対象者
- # obj : スキルまたはアイテム
- #--------------------------------------------------------------------------
- alias display_action_effects_KGC_DQSkill display_action_effects
- def display_action_effects(target, obj = nil)
- if target.protected
- @protected = true
- display_protect(target, obj)
- display_action_effects(target.protected_battler, obj)
- target.protected = false
- @protected = false
- return
- end
- display_action_effects_KGC_DQSkill(target, obj)
- end
- #--------------------------------------------------------------------------
- # ○ 「かばう」時のメッセージを表示
- # target : 対象者
- # obj : スキルまたはアイテム
- #--------------------------------------------------------------------------
- def display_protect(target, obj)
- text = sprintf(Vocab::ProtectNormal,
- target.protected_battler.name, target.name)
- @message_window.add_instant_text(text)
- wait(30)
- if obj == nil
- unless @active_battler.is_a?(Game_Enemy)
- display_attack_animation([@active_battler])
- end
- else
- display_animation([@active_battler], obj.animation_id)
- end
- @message_window.back_one
- end
- end
复制代码 |
|