赞 | 0 |
VIP | 1 |
好人卡 | 13 |
积分 | 2 |
经验 | 11535 |
最后登录 | 2016-11-28 |
在线时间 | 691 小时 |
Lv1.梦旅人 水土火风重逢处
- 梦石
- 0
- 星屑
- 239
- 在线时间
- 691 小时
- 注册时间
- 2010-7-17
- 帖子
- 3042
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 429259591 于 2010-9-15 20:28 编辑
我看了合击技能的脚本,觉得想要增加一项合击成功率的这一效果,哪位会脚本改改帮帮我吧
这个是脚本- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- #_/ ◆ 合击技能 - KGC_CooperationSkill ◆ VX ◆
- #_/ ◇ Last update : 2009/08/07 ◇
- #_/----------------------------------------------------------------------------
- #_/ 多个人一起使用的合击技能
- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- # 翻译:星月桜 http://blog.sina.com.cn/rpgs
- #==============================================================================
- # ★ 设置項目 - Customize BEGIN ★
- #==============================================================================
- module KGC
- module CooperationSkill
- # ◆ 合击发动名子的分割符号
- NAME_SEPARATOR = "、"
- # ◆ 是否按速度发动技能,
- # 就是说如果合击技能如果在4人当中最后一个发动的话就会没有合击
- # true 是
- # false 否
- EXECUTE_ORIGIN_SKILL = false
- # ◆ 是否在目标相同的时候才发动
- # true : 是
- #
- # false : 否
- #
- SAME_TARGET_ONLY = true
- # ◆ 怪物是否使用连击技能
- # true : 可以。
- # false : 不可以
- PERMIT_ENEMY = true
- end
- end
- #==============================================================================
- # ☆ カスタマイズ項目終了 - Customize END ☆
- #==============================================================================
- $imported = {} if $imported == nil
- $imported["CooperationSkill"] = true
- module KGC
- module CooperationSkill
- # 合击技能显著等级
- PARAMS = {
- :level_avg => "LEVEL_AVG|平均等级",
- :level_min => "LEVEL_MIN|最[小低]等级",
- :level_max => "LEVEL_MAX|最[大高]等级",
- }
- # 合击技能用属性?状态ID
- ARRAYS = {
- :attack_element => "ATTACK_ELEMENT|攻击属性",
- :state => "STATE|状态",
- }
- module Regexp
- module Skill
- # 合击技能开始
- BEGIN_COOPERATE = /<(?:COOPERATION_SKILL|合击技能)>/i
- # 合击技能结束
- END_COOPERATE = /<\/(?:COOPERATION_SKILL|合击技能)>/i
- # 必要技能ID
- NEED_SKILLS = /^\s*(?:NEED_SKILLS?|必要技能)\s*(\d+(?:\s*,\s*\d+)*)\s*/i
- REG_NAME = '[^:\+\-\d\s]+'
- REG_OU = 'OVER|UNDER|以上|以下'
- # 条件等级
- # 等级在10 以上
- COOPERATE_PARAMS = /^\s*(#{REG_NAME})\s*(\d+)\s*(#{REG_OU})?\s*$/i
- # 属性?状态ID
- # 状态 1,-2,3
- COOPERATE_ARRAYS = /^\s*(#{REG_NAME})\s*(\d+(?:\s*,\s*\-?\d+)*)\s*$/i
- end
- end
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ RPG::Skill
- #==============================================================================
- class RPG::Skill < RPG::UsableItem
- #--------------------------------------------------------------------------
- # ○ 連係スキルであるか
- #--------------------------------------------------------------------------
- def is_cooperation?
- self.note.each_line { |line|
- # 開始タグを探す
- if line =~ KGC::CooperationSkill::Regexp::Skill::BEGIN_COOPERATE
- return true
- end
- }
- return false
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Temp
- #==============================================================================
- class Game_Temp
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :judging_cooperation_skill # 連係スキル判定中フラグ
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias initialize_KGC_CooperationSkill initialize
- def initialize
- initialize_KGC_CooperationSkill
- @judging_cooperation_skill = false
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # □ Game_CooperationSkill
- #------------------------------------------------------------------------------
- # 連係スキルの情報を扱うクラスです。
- #==============================================================================
- class Game_CooperationSkill
- #--------------------------------------------------------------------------
- # ○ 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_reader :id # 発動スキル ID
- attr_reader :need_skills # 必要スキル ID リスト
- attr_reader :params # 条件パラメータ
- attr_reader :params_over # 条件パラメータ: ~以上
- attr_reader :need_arrays # 必要属性?ステートリスト
- attr_reader :disuse_arrays # 不要属性?ステートリスト
- #--------------------------------------------------------------------------
- # ○ オブジェクト初期化
- # skill_id : スキル ID
- # note : メモ
- #--------------------------------------------------------------------------
- def initialize(skill_id, note)
- @id = skill_id
- @need_skills = []
- @params = {}
- @params_over = {}
- @need_arrays = {}
- @disuse_arrays = {}
- parse_note(note)
- end
- #--------------------------------------------------------------------------
- # ○ スキルを取得
- #--------------------------------------------------------------------------
- def skill
- return $data_skills[@id]
- end
- #--------------------------------------------------------------------------
- # ○ メモ欄を解析
- # note : メモ
- #--------------------------------------------------------------------------
- def parse_note(note)
- coop_flag = false
- note.each_line { |line|
- case line
- when KGC::CooperationSkill::Regexp::Skill::BEGIN_COOPERATE
- # 連係スキル定義開始
- coop_flag = true
- when KGC::CooperationSkill::Regexp::Skill::END_COOPERATE
- # 連係スキル定義終了
- coop_flag = false
- end
- next unless coop_flag
- case line
- when KGC::CooperationSkill::Regexp::Skill::NEED_SKILLS
- # 必要スキル
- parse_need_skills($1.scan(/\-?\d+/))
- when KGC::CooperationSkill::Regexp::Skill::COOPERATE_PARAMS
- # パラメータ
- parse_params($1, $2.to_i, $3)
- when KGC::CooperationSkill::Regexp::Skill::COOPERATE_ARRAYS
- # 属性?ステート
- parse_arrays($1, $2.scan(/\-?\d+/))
- end
- }
- end
- #--------------------------------------------------------------------------
- # ○ 必要スキルを解析
- # list : スキル ID 一覧
- #--------------------------------------------------------------------------
- def parse_need_skills(list)
- skills = []
- list.each { |num|
- skills << num.to_i
- }
- @need_skills << skills
- end
- #--------------------------------------------------------------------------
- # ○ 連係スキルの能力値修正を適用
- # param : 対象パラメータ
- # value : 修正値
- # cond : 以上 or 以下
- #--------------------------------------------------------------------------
- def parse_params(param, value, cond)
- KGC::CooperationSkill::PARAMS.each { |k, v|
- next if param !~ /(?:#{v})/i
- @params[k] = value
- @params_over[k] = (cond !~ /UNDER|以下/i)
- break
- }
- end
- #--------------------------------------------------------------------------
- # ○ 連係スキルの追加属性?ステートを適用
- # param : 対象パラメータ
- # list : 属性?ステート一覧
- #--------------------------------------------------------------------------
- def parse_arrays(param, list)
- KGC::CooperationSkill::ARRAYS.each { |k, v|
- next if param !~ /(?:#{v})/i
- if @need_arrays[k] == nil
- @need_arrays[k] = []
- @disuse_arrays[k] = []
- end
- list.each { |num|
- n = num.to_i
- if n > 0
- @need_arrays[k] |= [n]
- else
- @disuse_arrays[k] |= [n.abs]
- end
- }
- break
- }
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- $data_skills = load_data("Data/Skills.rvdata") if $data_skill == nil
- module KGC::CooperationSkill
- # 連係スキルリストを変換
- list = []
- $data_skills.each { |skill|
- next if skill == nil
- next unless skill.is_cooperation?
- list << Game_CooperationSkill.new(skill.id, skill.note)
- }
- SKILLS = list
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● スキルの使用可能判定
- # skill : スキル
- #--------------------------------------------------------------------------
- def skill_can_use?(skill)
- return super
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # □ Game_CooperationSkillUser
- #------------------------------------------------------------------------------
- # 連係スキル発動者の情報を扱うクラスです。
- #==============================================================================
- class Game_CooperationSkillUser
- #--------------------------------------------------------------------------
- # ○ 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_reader :index # 発動者のインデックス
- attr_reader :skill_id # 発動者が使用したスキル ID
- attr_reader :target_battlers # 攻撃対象
- #--------------------------------------------------------------------------
- # ○ オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(battler)
- if $imported["Counter"]
- battler.action.made_targets = nil
- end
- @index = battler.index
- @skill_id = battler.action.skill_id
- @target_battlers = []
- battler.action.make_targets.each { |t|
- @target_battlers << t.index
- }
- end
- #--------------------------------------------------------------------------
- # ○ 同値判定
- #--------------------------------------------------------------------------
- def equal?(obj)
- return false unless obj.is_a?(Game_CooperationSkillUser)
- return false if @index != obj.index
- return false if @skill_id != obj.skill_id
- return false if @target_battlers != obj.target_battlers
- return true
- end
- #--------------------------------------------------------------------------
- # ○ 等値演算子
- #--------------------------------------------------------------------------
- def ==(obj)
- return self.equal?(obj)
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # □ Game_CooperationBattler
- #------------------------------------------------------------------------------
- # 連係スキル発動時のダミーバトラークラスです。
- #==============================================================================
- class Game_CooperationBattler < Game_Battler
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :battler_type # :actor or :enemy
- attr_accessor :exec_battlers # 発動者リスト
- attr_accessor :coop_skill # 連係スキル情報
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- @battler_type = :actor
- @exec_battlers = []
- @coop_skill = nil
- super
- end
- #--------------------------------------------------------------------------
- # ● アクターか否かの判定
- #--------------------------------------------------------------------------
- def actor?
- return (@battler_type == :actor)
- end
- #--------------------------------------------------------------------------
- # ● インデックス取得
- #--------------------------------------------------------------------------
- def index
- return 0
- end
- #--------------------------------------------------------------------------
- # ● 表示名の取得
- #--------------------------------------------------------------------------
- def name
- str = ""
- members = (actor? ? $game_party : $game_troop).members
- exec_battlers.each_with_index { |b, i|
- str += members[b.index].name
- if i < exec_battlers.size - 1
- str += KGC::CooperationSkill::NAME_SEPARATOR
- end
- }
- return str
- end
- #--------------------------------------------------------------------------
- # ● レベルの取得
- #--------------------------------------------------------------------------
- def level
- values = []
- exec_battlers.each { |b| values << b.level }
- return values.max
- end
- #--------------------------------------------------------------------------
- # ○ 最大レベルの取得
- #--------------------------------------------------------------------------
- def level_max
- return level
- end
- #--------------------------------------------------------------------------
- # ○ 平均レベルの取得
- #--------------------------------------------------------------------------
- def level_avg
- n = 0
- exec_battlers.each { |b| n += b.level }
- return (n / exec_battlers.size)
- end
- #--------------------------------------------------------------------------
- # ● MaxHP の取得
- #--------------------------------------------------------------------------
- def maxhp
- values = []
- exec_battlers.each { |b| values << b.maxhp }
- return values.max
- end
- #--------------------------------------------------------------------------
- # ● MaxMP の取得
- #--------------------------------------------------------------------------
- def maxmp
- values = []
- exec_battlers.each { |b| values << b.maxmp }
- return values.max
- end
- #--------------------------------------------------------------------------
- # ● HP の取得
- #--------------------------------------------------------------------------
- def hp
- values = []
- exec_battlers.each { |b| values << b.hp }
- return values.min
- end
- #--------------------------------------------------------------------------
- # ● MP の取得
- #--------------------------------------------------------------------------
- def mp
- values = []
- exec_battlers.each { |b| values << b.mp }
- return values.min
- end
- #--------------------------------------------------------------------------
- # ○ ドライブゲージ量取得
- #--------------------------------------------------------------------------
- def overdrive
- values = []
- exec_battlers.each { |b| values << b.overdrive }
- return values.min
- end
- #--------------------------------------------------------------------------
- # ● 攻撃力の取得
- #--------------------------------------------------------------------------
- def atk
- values = []
- exec_battlers.each { |b| values << b.atk }
- return values.max
- end
- #--------------------------------------------------------------------------
- # ● 防御力の取得
- #--------------------------------------------------------------------------
- def def
- values = []
- exec_battlers.each { |b| values << b.def }
- return values.max
- end
- #--------------------------------------------------------------------------
- # ● 精神力の取得
- #--------------------------------------------------------------------------
- def spi
- values = []
- exec_battlers.each { |b| values << b.spi }
- return values.max
- end
- #--------------------------------------------------------------------------
- # ● 敏捷性の取得
- #--------------------------------------------------------------------------
- def agi
- values = []
- exec_battlers.each { |b| values << b.agi }
- return values.max
- end
- #--------------------------------------------------------------------------
- # ● 命中率の取得
- #--------------------------------------------------------------------------
- def hit
- values = []
- exec_battlers.each { |b| values << b.hit }
- return [values.max, 100].max
- end
- #--------------------------------------------------------------------------
- # ● 回避率の取得
- #--------------------------------------------------------------------------
- def eva
- return 0
- end
- #--------------------------------------------------------------------------
- # ● クリティカル率の取得
- #--------------------------------------------------------------------------
- def cri
- values = []
- exec_battlers.each { |b| values << b.cri }
- return values.max
- end
- #--------------------------------------------------------------------------
- # ● MP の変更
- # mp : 新しい MP
- #--------------------------------------------------------------------------
- def mp=(mp)
- # 加担者全員の MP を減らす
- diff = self.mp - mp
- exec_battlers.each { |b| b.mp -= diff }
- end
- #--------------------------------------------------------------------------
- # ○ ドライブゲージの操作
- #--------------------------------------------------------------------------
- def overdrive=(value)
- # 加担者全員のドライブゲージを減らす
- diff = self.overdrive - overdrive
- exec_battlers.each { |b| b.overdrive -= diff }
- end
- #--------------------------------------------------------------------------
- # ● 全回復
- #--------------------------------------------------------------------------
- def recover_all
- # 何もしない
- end
- #--------------------------------------------------------------------------
- # ● 戦闘不能判定
- #--------------------------------------------------------------------------
- def dead?
- exec_battlers.each { |b|
- return true if b.dead?
- }
- return false
- end
- #--------------------------------------------------------------------------
- # ● 存在判定
- #--------------------------------------------------------------------------
- def exist?
- exec_battlers.each { |b|
- return false unless b.exist?
- }
- return true
- end
- #--------------------------------------------------------------------------
- # ● コマンド入力可能判定
- #--------------------------------------------------------------------------
- def inputable?
- exec_battlers.each { |b|
- return false unless b.inputtable?
- }
- return true
- end
- #--------------------------------------------------------------------------
- # ● 行動可能判定
- #--------------------------------------------------------------------------
- def movable?
- exec_battlers.each { |b|
- return false unless b.movable?
- }
- return true
- end
- #--------------------------------------------------------------------------
- # ● 沈黙状態判定
- #--------------------------------------------------------------------------
- def silent?
- exec_battlers.each { |b|
- return true if b.silent?
- }
- return false
- end
- #--------------------------------------------------------------------------
- # ● 暴走状態判定
- #--------------------------------------------------------------------------
- def berserker?
- return false
- end
- #--------------------------------------------------------------------------
- # ● 混乱状態判定
- #--------------------------------------------------------------------------
- def confusion?
- return false
- end
- #--------------------------------------------------------------------------
- # ● 防御中判定
- #--------------------------------------------------------------------------
- def guarding?
- return false
- end
- #--------------------------------------------------------------------------
- # ● 通常攻撃の属性取得
- #--------------------------------------------------------------------------
- def element_set
- result = []
- exec_battlers.each { |b| result |= b.element_set }
- return result
- end
- #--------------------------------------------------------------------------
- # ● 通常攻撃のステート変化 (+) 取得
- #--------------------------------------------------------------------------
- def plus_state_set
- result = []
- exec_battlers.each { |b| result |= b.plus_state_set }
- return result
- end
- #--------------------------------------------------------------------------
- # ● 通常攻撃のステート変化 (-) 取得
- #--------------------------------------------------------------------------
- def minus_state_set
- result = []
- exec_battlers.each { |b| result |= b.minus_state_set }
- return result
- end
- #--------------------------------------------------------------------------
- # ● ステート [スリップダメージ] 判定
- #--------------------------------------------------------------------------
- def slip_damage?
- return false
- end
- #--------------------------------------------------------------------------
- # ● ステート [命中率減少] 判定
- #--------------------------------------------------------------------------
- def reduce_hit_ratio?
- return false
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Scene_Battle
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● 開始処理
- #--------------------------------------------------------------------------
- alias start_KGC_CooperationSkill start
- def start
- start_KGC_CooperationSkill
- init_cooperation_skill
- end
- #--------------------------------------------------------------------------
- # ○ 連係スキル用変数初期化
- #--------------------------------------------------------------------------
- def init_cooperation_skill
- @cooperation_skill_judged = false
- @cooperation_skill_exec = false
- @cooperation_skill_data = nil
- @cooperate_actors = []
- @cooperate_enemies = []
- end
- #--------------------------------------------------------------------------
- # ● パーティコマンド選択の開始
- #--------------------------------------------------------------------------
- alias start_party_command_selection_KGC_CooperationSkill
- start_party_command_selection
- def start_party_command_selection
- if $game_temp.in_battle
- init_cooperation_skill
- end
- start_party_command_selection_KGC_CooperationSkill
- end
- #--------------------------------------------------------------------------
- # ● 戦闘処理の実行開始
- #--------------------------------------------------------------------------
- alias start_main_KGC_CooperationSkill start_main
- def start_main
- start_main_KGC_CooperationSkill
- init_cooperate_battler_list
- end
- #--------------------------------------------------------------------------
- # ○ 判定用データ初期化
- #--------------------------------------------------------------------------
- def init_cooperate_battler_list
- [:actor, :enemy].each { |i|
- case i
- when :actor
- cooperate_battlers = @cooperate_actors
- members = $game_party.members
- when :enemy
- cooperate_battlers = @cooperate_enemies
- members = $game_troop.members
- end
- # 対象側バトラーを設定
- cooperate_battlers.clear
- unless KGC::CooperationSkill::EXECUTE_ORIGIN_SKILL
- members.each { |battler|
- next unless battler.action.skill?
- cooperate_battlers << Game_CooperationSkillUser.new(battler)
- }
- end
- }
- end
- #--------------------------------------------------------------------------
- # ● 戦闘行動の実行
- #--------------------------------------------------------------------------
- alias execute_action_KGC_CooperationSkill execute_action
- def execute_action
- @cooperation_skill_judged = false
- if KGC::CooperationSkill::EXECUTE_ORIGIN_SKILL
- execute_action_KGC_CooperationSkill
- judge_cooperation_skill(@active_battler)
- else
- judge_cooperation_skill(@active_battler)
- unless @cooperation_skill_judged && @cooperation_skill_exec
- execute_action_KGC_CooperationSkill
- end
- end
- if @cooperation_skill_exec
- if @cooperation_skill_judged
- execute_cooperation_skill
- else
- finish_cooperation_skill
- end
- end
- end
- #--------------------------------------------------------------------------
- # ○ 連係スキル第一発動判定
- # battler : 行動者
- #--------------------------------------------------------------------------
- def judge_cooperation_skill(battler)
- return false if @cooperation_skill_judged
- return false if @cooperation_skill_exec
- @cooperation_skill_judged = true
- target_unit = (battler.is_a?(Game_Actor) ? $game_troop : $game_party)
- if battler.action.kind == 1
- # 対象が残っていれば第二発動判定
- unless target_unit.all_dead?
- return judge_cooperation_skill_second(battler)
- end
- else
- # 行動がスキル以外なら判定用配列から削除
- if target_unit.is_a?(Game_Party)
- remove_cooperate_battler(:enemy, battler)
- elsif target_unit.is_a?(Game_Troop)
- remove_cooperate_battler(:actor, battler)
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ○ 連係加担者削除
- # type : :actor or :enemy
- # battler : 削除対象
- #--------------------------------------------------------------------------
- def remove_cooperate_battler(type, battler)
- battlers = (type == :actor ? @cooperate_actors : @cooperate_enemies)
- battlers.each_index { |i|
- if battlers[i].index == battler.index
- battlers[i] = nil
- end
- }
- battlers.compact!
- end
- #--------------------------------------------------------------------------
- # ○ 連係スキル第二発動判定
- # battler : 行動者
- #--------------------------------------------------------------------------
- def judge_cooperation_skill_second(battler)
- # 判定用データ作成
- @current_cooperate_user = Game_CooperationSkillUser.new(battler)
- if battler.is_a?(Game_Actor)
- remove_cooperate_battler(:actor, battler)
- @cooperate_actors |= [@current_cooperate_user]
- elsif battler.is_a?(Game_Enemy)
- remove_cooperate_battler(:enemy, battler)
- @cooperate_enemies |= [@current_cooperate_user]
- end
- # 連係スキル発動判定
- KGC::CooperationSkill::SKILLS.each { |cs|
- # アクター判定
- if battler.is_a?(Game_Actor)
- judge_cooperation_skill_third(:actor, cs)
- # エネミー判定
- elsif battler.is_a?(Game_Enemy)
- judge_cooperation_skill_third(:enemy, cs)
- end
- break if @cooperation_skill_exec
- }
- return @cooperation_skill_exec
- end
- #--------------------------------------------------------------------------
- # ○ 連係スキル第三発動判定
- # type : :actor or :enemy
- # cs_data : Cooperation skill data
- #--------------------------------------------------------------------------
- def judge_cooperation_skill_third(type, cs_data)
- if type == :enemy
- # エネミーに発動させない場合は戻る
- return unless KGC::CooperationSkill::PERMIT_ENEMY
- end
- @cooperation_skill_exec = false
- case type
- when :actor
- cooperate_battlers = @cooperate_actors
- members = $game_party.members
- when :enemy
- cooperate_battlers = @cooperate_enemies
- members = $game_troop.members
- end
- @exec_battlers = create_cooperation_exec_battlers(type, cs_data,
- cooperate_battlers, members)
- # 行動者が加担していなければ戻る
- return if @exec_battlers.empty?
- # 同一ターゲットを指定していなければ戻る
- return unless same_target_include?(cs_data, cooperate_battlers, members)
- $game_temp.judging_cooperation_skill = true
- prepare_cooperation_exec(type, cs_data, cooperate_battlers, members)
- $game_temp.judging_cooperation_skill = false
- end
- #--------------------------------------------------------------------------
- # ○ 連係スキル発動者リスト作成
- # type : :actor or :enemy
- # cs_data : Cooperation skill data
- # cooperate_battlers : 連係加担者リスト
- # members : 連係加担側のメンバー全体
- #--------------------------------------------------------------------------
- def create_cooperation_exec_battlers(type, cs_data,
- cooperate_battlers, members)
- battlers = []
- cs_data.need_skills.each { |ns|
- battlers.clear
- # 行動者加担判定
- next unless ns.include?(@current_cooperate_user.skill_id)
- # 全必要スキル充足判定
- skills = ns.clone
- ns.each { |skill_id|
- user = cooperate_battlers.find { |cb|
- skill_id == cb.skill_id && !battlers.include?(cb)
- }
- # 使用者がいなければ失敗判定
- if user == nil
- battlers.clear
- skills = [0]
- break
- end
- battlers << user
- skills.delete(skill_id)
- }
- break if skills.empty? # 判定用配列が空 ==> 必要スキル充足
- }
- unless cooperation_conditions_satisfy?(type, cs_data, battlers, members)
- battlers = []
- end
- return battlers
- end
- #--------------------------------------------------------------------------
- # ○ 使用条件充足判定
- # type : :actor or :enemy
- # cs_data : Cooperation skill data
- # candidate_battlers : 判定対象の連係加担者リスト
- # members : 連係加担側のメンバー全体
- #--------------------------------------------------------------------------
- def cooperation_conditions_satisfy?(type, cs_data,
- candidate_battlers, members)
- return false if candidate_battlers.empty?
- return true if type == :enemy
- # パラメータ算出
- level_avg = 0
- levels = []
- candidate_battlers.each { |cb|
- battler = members[cb.index]
- level_avg += battler.level
- levels << battler.level
- }
- level_avg /= members.size
- comp = Proc.new { |a, b, over| over ? a >= b : a <= b } # 判定用 Proc
- cs_data.params.each { |k, v|
- param = 0
- case k
- when :level_avg # 平均レベル
- param = level_avg
- when :level_min # 最低レベル
- param = levels.min
- when :level_max # 最高レベル
- param = levels.max
- end
- return false unless comp.call(param, v, cs_data.params_over[k])
- }
- return true
- end
- #--------------------------------------------------------------------------
- # ○ 連係ターゲット一致判定
- # cs_data : Cooperation skill data
- # cooperate_battlers : 連係加担者リスト
- # members : 連係加担側のメンバー全体
- #--------------------------------------------------------------------------
- def same_target_include?(cs_data, cooperate_battlers, members)
- return true unless KGC::CooperationSkill::SAME_TARGET_ONLY
- # 同じターゲットを指定しているか判定
- duplicate_battlers = (0..99).to_a
- @exec_battlers.each { |eb|
- duplicate_battlers &= eb.target_battlers
- }
- return (duplicate_battlers.size > 0)
- end
- #--------------------------------------------------------------------------
- # ○ 連係発動準備
- # type : :actor or :enemy
- # cs_data : Cooperation skill data
- # cooperate_battlers : 連係加担者リスト
- # members : 連係加担側のメンバー全体
- #--------------------------------------------------------------------------
- def prepare_cooperation_exec(type, cs_data, cooperate_battlers, members)
- # 発動可否判定
- @exec_battlers.each { |eb|
- battler = members[eb.index]
- unless battler.exist? && battler.skill_can_use?(cs_data.skill)
- return
- end
- }
- @cooperation_skill_exec = true
- @cooperation_skill_data = cs_data
- @cooperation_skill_user = type
- # 発動者を行動順リストから削除
- cooperate_battlers.each_with_index { |cb, i|
- if @exec_battlers.include?(cb)
- @action_battlers.delete(members[cb.index])
- cooperate_battlers[i] = nil
- end
- }
- cooperate_battlers.compact!
- end
- #--------------------------------------------------------------------------
- # ○ 連係スキル発動
- #--------------------------------------------------------------------------
- def execute_cooperation_skill
- # ダミーを登録
- @action_battlers.unshift(create_cooperation_skill_battler)
- end
- #--------------------------------------------------------------------------
- # ○ 連係発動者 (ダミーバトラー) 作成
- #--------------------------------------------------------------------------
- def create_cooperation_skill_battler
- battler = Game_CooperationBattler.new
- battler.battler_type = @cooperation_skill_user
- battler.coop_skill = @cooperation_skill_data
- battler.action.set_skill(@cooperation_skill_data.id)
- # ターゲット取得
- members = (@cooperation_skill_user == :actor ?
- $game_party : $game_troop).members
- target = (0..99).to_a
- @exec_battlers.each { |eb|
- battler.exec_battlers << members[eb.index]
- target &= eb.target_battlers
- }
- if target.empty?
- # ターゲット不明なら最後の行動者のターゲットを採用
- target = @current_cooperate_user.target_battlers
- end
- battler.action.target_index = target[rand(target.size)]
- return battler
- end
- #--------------------------------------------------------------------------
- # ○ 連係スキル終了
- #--------------------------------------------------------------------------
- def finish_cooperation_skill
- @cooperation_skill_exec = false
- @cooperation_skill_data = nil
- @exec_battlers = []
- end
- #--------------------------------------------------------------------------
- # ○ 連係スキル加担判定
- # battler : 判定するバトラー
- #--------------------------------------------------------------------------
- def cooperation_exec?(battler)
- return false unless @cooperation_skill_exec
- if battler.is_a?(Game_Actor) || KGC::CooperationSkill::PERMIT_ENEMY
- # 発動者に含まれているか判定
- @exec_battlers.each_index { |i|
- return true if @exec_battlers[i].index == battler.index
- }
- end
复制代码 |
|