#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #_/ ◆ Cooperation Skills - KGC_CooperationSkill ◆ VX ◆ #_/ ◇ Last Update: 02/15/2009 #_/ ◆ Written by TOMY #_/ ◆ Translation by Mr. Anonymous #_/ ◆ KGC Site: #_/ ◆ http://ytomy.sakura.ne.jp/ #_/ ◆ Translator's Blog: #_/ ◆ http://mraprojects.wordpress.com #_/---------------------------------------------------------------------------- #_/ This script grants the user the ability to create skills are automatically #_/ used as the result of two (or more) allies using appropriate skills. #_/============================================================================ #_/ ◆ Instructions For Usage ◆ #_/ To make use of this function, you must insert the tags into the "Note" box #_/ located in the skills section of the database. #_/ This is a little more complicated than most KGC scripts note box formats, #_/ similar to KGC_Counter. #_/ #_/ You begin setting up the Cooperation Skill requirements with a tag... #_/ or #_/ You end the requirements block with the tag... #_/ or #_/ In between these tags, you'll insert the subtags that determine what the #_/ requirements are. Here's are the subtags you can use. #_/ #_/ need_skill SkillID, SkillID #_/ * Used to determine which two (or more) skills are required to create the #_/ cooperation skill. This can be multiple times to allow the same effect to #_/ be triggered by multiple skill configurations. #_/ Where SkillID = the ID number of the desired skills. #_/ #_/ avg_level xx #_/ min_level xx #_/ max_level xx #_/ * Used to determine the average, minimum and/or maximum levels that the #_/ participating battlers must be in order for the cooperation skill to carry #_/ out. After a number defined, you may insert OVER or UNDER to broaden the #_/ definition. (Note: I haven't tested this. That's what TOMY notes.) #_/ Where xx = The level requirement #_/ #_/ * Example: #_/ #_/ need_skill 59, 86 #_/ need_skill 60, 86 #_/ need_skill 61, 86 #_/ need_skill 62, 86 #_/ min_level 24 over #_/ #_/ This creates a skill that requires Skill IDs 59 + 86, OR 60 + 86, OR 61 + 86, #_/ OR 62 + 86, and additionally all participating skill users MUST be level 24 #_/ or higher in order for the skill to carry out. #_/ #_/============================================================================ #_/ Install: Insert below KGC_Counter and KGC_Overdrive, if applicable. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #============================================================================== # ★ BEGIN Customization ★ #============================================================================== module KGC module CooperationSkill # ◆ Battler Name Separator # This is displayed in battle between battler names who are combinding their # skills for a cooperation skill. NAME_SEPARATOR = "," # ◆ Skill Execution Type # true : Both the linkable skills and the cooperation skill are used. # false : Only the cooperation skills is used. * # * This option may cause unexpected behavior with some scripts. EXECUTE_ORIGIN_SKILL = false # ◆ Invoke Effect By Target # true : Cooperation skills are only invoked when both battlers target the # same enemy. * # * This does not include random and ally target type skills. # false : Cooperation skills are invoked as long as the two skills are used # at all. SAME_TARGET_ONLY = true # ◆ Permit Enemy Cooperation Skills # true : Enemies will also be able to make use of cooperation skills. # false : Enemies will not be able to make use of cooperation skills. PERMIT_ENEMY = true end end #============================================================================== # ★ END Customization ★ #============================================================================== $imported = {} if $imported == nil $imported["CooperationSkill"] = true module KGC module CooperationSkill # Parameter vocab for skill linkage PARAMS = { :level_avg => "LEVEL_AVG|avg_level", :level_min => "LEVEL_MIN|min_level", :level_max => "LEVEL_MAX|mav_level", } # Element and state list for linked skills ARRAYS = { :attack_element => "ATTACK_ELEMENT|atk_elem", :state => "STATE|state", } module Regexp module Skill # Begin link skill BEGIN_COOPERATE = /<(?:COOPERATION_SKILL|link_skill)>/i # End link skill END_COOPERATE = /<\/(?:COOPERATION_SKILL|link_skill)>/i # Needed skills list NEED_SKILLS = /^\s*(?:NEED_SKILLS?|need_skill)\s*(\d+(?:\s*,\s*\d+)*)\s*/i REG_NAME = '[^:\+\-\d\s]+' REG_OU = 'OVER|UNDER|over|under' # Conditional parameters # Level 10 or higher COOPERATE_PARAMS = /^\s*(#{REG_NAME})\s*(\d+)\s*(#{REG_OU})?\s*$/i # Element and state list # Include States 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|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 return false end end