Citadin Lv.7
Age : 25 Inscrit le : 24/09/2011 Messages : 200
| Sujet: apeller ce script? Jeu 27 Oct 2011 - 22:53 | |
| salut, j'utillise ce script de KGC Team qui permet de contre-attaquer : - Spoiler:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #_/ ◆ Counter - KGC_Counter ◆ VX ◆ #_/ ◇ Last Update: 2008/09/13 ◇ #_/ ◆ Translation by Mr. Anonymous ◆ #_/ ◆ KGC Site: ◆ #_/ ◆ http://f44.aaa.livedoor.jp/~ytomy/ ◆ #_/ ◆ Translator's Blog: ◆ #_/ ◆ http://mraprojects.wordpress.com ◆ #_/---------------------------------------------------------------------------- #_/ This script allows you to designate armors, weapons, or states that may #_/ grant the actor (or enemy) the ability to counter attack specific actions. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#==============================================================================# # ★ Customization ★ # #==============================================================================#
module KGC module Counter # ◆ Counter Use Limitation ◆ # This toggle allows you to set counter to attack only once, or behave just # like the actor's normal attack. # true : One-time use only. # false : If the actor can strike multiple times, counter will do the same. RESTRICT_COUNTER = false
# ◆ Counter Attack Message ◆ # This allows you to change the message displayed when an actor or enemy # performs a counter-attack. # %s = Counter Attacker's Name VOCAB_COUNTER_ATTACK = "%s contre-attaque!"
# ◆ Counter Interruption Message ◆ # This allows you to change the message displayed when an actor or enemy # successfully interrupts an attacker's action with a counter attack. # Special Formatting: # \\N : Attacker's name # \\C : Counter Attacker's name # \\A : Name of action interrupted VOCAB_INTERRUPT_COUNTER = "\\C interrupted \\N's \\A!" end end
#=============================================================================# # ★ End Customization ★ # #=============================================================================#
#=================================================# # IMPORT # #=================================================#
$imported = {} if $imported == nil $imported["Counter"] = true
#=================================================#
#============================================================================== # □ KGC::Counter::Regexp #============================================================================== # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # # Note Field Tag Strings # # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # # Whatever word(s) are after the separator ( | ) in the following lines are # what are used to determine what is searched for in the "Note" section of a # enemy, armor, weapon, or state.
module KGC module Counter module Regexp # Define Counter Start Tag BEGIN_COUNTER = /<(?:COUNTER|counter)\s*([ASI])(\s*\:\s*\d+)? (\s+\d+[%%])?(\s*\/)?>/ix # Define Counter End Tag END_COUNTER = /<\/(?:COUNTER|counter)>/i
# ~ Counter Conditions ~ # Action Designation KIND = /^\s*(?:KIND|type)\s*([AGSI])(\s*\:\s*\d+(?:\s*,\s*\d+)*)?/i # Attack Type ATTACK_TYPE = /^\s*(PHYSICAL|MAGICAL|physical|magic)(?:_ATTACK|attack)/i # Element Type ELEMENT = /^\s*(?:ELEMENT|element)\s*(\d+(?:\s*,\s*\d+)*)/i # Attack Level ATK_F = /^\s*(?:ATK_F|attack_level)\s*(\d+)(?:\s*above)?/i # Spirit Level SPI_F = /^\s*(?:SPI_F|spirit_level)\s*(\d+)(?:\s*above)?/i # Remaining HP/MP REMAIN_HPMP = /^\s*(?:REMAIN_|remaining_)?(HP|MP)\s*(\d+)(?:\s*[%%]\s*) (OVER|UNDER|over|under)/ix # Ignore Target IGNORE_TARGET = /^\s*(?:IGNORE_TARGET|ignore_target)/i # Interrupt Action INTERRUPT = /^\s*(?:ACTION_|action_)?(?:INTERRUPT|interrupt)\s*$/i
# Interrupt Message INTERRUPT_MESSAGE = /^\s*(?:INTERRUPT_MESSAGE|interrupt_message)\s*\" ([^\"]*)(\")?/ix end
KIND_ALL = -1 # Type : ALL KIND_BASIC = 0 # Type : Basic KIND_SKILL = 1 # Type : Skill KIND_ITEM = 2 # Type : Item
BASIC_ATTACK = 0 # Basic Action : Attack BASIC_GUARD = 1 # Basic Action : Defend
TYPE_ALL = -1 # Attack Type : ALL TYPE_PHYSICAL = 0 # Attack Type : Physical TYPE_MAGICAL = 1 # Attack Type : Magical
REMAIN_TYPE_OVER = 0 # Remaining HP/MP : x Or More REMAIN_TYPE_UNDER = 1 # Remaining HP/MP : x Or Less
# Counter Type Table COUNTER_KINDS = { "A" => KIND_BASIC, "G" => KIND_BASIC, "S" => KIND_SKILL, "I" => KIND_ITEM, }
# Basic Actions Counter Type Table COUNTER_BASIC = { "A" => BASIC_ATTACK, "G" => BASIC_GUARD }
# Counter Attack Type Table COUNTER_TYPES = { "PHYSICAL" => TYPE_PHYSICAL, "physical" => TYPE_PHYSICAL, "MAGICAL" => TYPE_MAGICAL, "magical" => TYPE_MAGICAL }
#-------------------------------------------------------------------------- # ○ カウンター行動リストの作成 # note : メモ欄 #-------------------------------------------------------------------------- def self.create_counter_action_list(note) result = []
counter_flag = false action = nil
interrupt_message = "" define_interrupt_message = false note.each_line { |line| if line =~ KGC::Counter::Regexp::BEGIN_COUNTER match = $~.clone # カウンター定義開始 action = Game_CounterAction.new if match[1] != nil action.kind = COUNTER_KINDS[match[1].upcase] end case action.kind when KIND_SKILL next if match[2] == nil action.skill_id = match[2][/\d+/].to_i when KIND_ITEM next if match[2] == nil action.item_id = match[2][/\d+/].to_i end if match[3] != nil action.execute_prob = match[3][/\d+/].to_i end counter_flag = true if match[4] != nil # そのまま定義終了 result << action counter_flag = false end end
next unless counter_flag
# 割り込みメッセージ定義中 if define_interrupt_message if line =~ /\s*([^\"]*)(\")?/ action.interrupt_message += $1.chomp define_interrupt_message = ($2 == nil) end next end
case line when KGC::Counter::Regexp::END_COUNTER # カウンター定義終了 result << action counter_flag = false
when KGC::Counter::Regexp::KIND # 行動種別 match = $~.clone action.condition.kind = COUNTER_KINDS[match[1].upcase] if action.condition.kind == KIND_BASIC action.condition.basic = COUNTER_BASIC[match[1].upcase] if action.condition.basic == nil action.condition.basic = KGC::Counter::BASIC_ATTACK end end if match[2] != nil ids = [] match[2].scan(/\d+/).each { |num| ids << num.to_i } case action.condition.kind when KIND_SKILL action.condition.skill_ids = ids when KIND_ITEM action.condition.item_ids = ids end end
when KGC::Counter::Regexp::ATTACK_TYPE # 攻撃タイプ action.condition.type = COUNTER_TYPES[$1.upcase]
when KGC::Counter::Regexp::ELEMENT # 属性 elements = [] $1.scan(/\d+/).each { |num| elements << num.to_i } action.condition.element_set |= elements
when KGC::Counter::Regexp::ATK_F # 打撃関係度 action.condition.atk_f = $1.to_i
when KGC::Counter::Regexp::SPI_F # 精神関係度 action.condition.spi_f = $1.to_i
when KGC::Counter::Regexp::REMAIN_HPMP type = REMAIN_TYPE_OVER case $3.upcase when "UNDER", "under" type = REMAIN_TYPE_UNDER end case $1.upcase when "HP" # 残存 HP action.condition.remain_hp = $2.to_i action.condition.remain_hp_type = type when "MP" # 残存 MP action.condition.remain_mp = $2.to_i action.condition.remain_mp_type = type end
when KGC::Counter::Regexp::IGNORE_TARGET # ターゲット無視 action.condition.ignore_target = true
when KGC::Counter::Regexp::INTERRUPT # 行動割り込み action.condition.interrupt = true
when KGC::Counter::Regexp::INTERRUPT_MESSAGE # 割り込みメッセージ define_interrupt_message = true action.interrupt_message += $1.chomp define_interrupt_message = ($2 == nil) end } return result end end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # ■ Vocab #==============================================================================
module Vocab # カウンター関連メッセージ CounterAttack = KGC::Counter::VOCAB_COUNTER_ATTACK InterruptCounter = KGC::Counter::VOCAB_INTERRUPT_COUNTER end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # ■ RPG::BaseItem #==============================================================================
class RPG::BaseItem #-------------------------------------------------------------------------- # ○ カウンター行動リスト #-------------------------------------------------------------------------- def counter_actions if @__counter_actions == nil @__counter_actions = KGC::Counter.create_counter_action_list(self.note) end return @__counter_actions end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # ■ RPG::Enemy #==============================================================================
class RPG::Enemy #-------------------------------------------------------------------------- # ○ カウンター行動リスト #-------------------------------------------------------------------------- def counter_actions if @__counter_actions == nil @__counter_actions = KGC::Counter.create_counter_action_list(self.note) end return @__counter_actions end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # ■ RPG::State #==============================================================================
class RPG::State #-------------------------------------------------------------------------- # ○ カウンター行動リスト #-------------------------------------------------------------------------- def counter_actions if @__counter_actions == nil @__counter_actions = KGC::Counter.create_counter_action_list(self.note) end return @__counter_actions end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # ■ Game_BattleAction #==============================================================================
class Game_BattleAction #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :made_targets # 作成済みターゲット #-------------------------------------------------------------------------- # ● ターゲットの配列作成 #-------------------------------------------------------------------------- alias make_targets_KGC_Counter make_targets def make_targets if @made_targets== nil @made_targets = make_targets_KGC_Counter end return @made_targets end #-------------------------------------------------------------------------- # ○ アクション名 #-------------------------------------------------------------------------- def action_name case kind when 0 # 基本 case basic when 0 # 攻撃 return Vocab.attack when 1 # 防御 return Vocab.guard when 2 # 逃走 return Vocab.escape when 3 # 待機 return Vocab.wait end when 1 # スキル return skill.name when 2 # アイテム return item.name end return "" end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # □ Game_CounterAction #------------------------------------------------------------------------------ # カウンター行動を扱うクラスです。 #==============================================================================
class Game_CounterAction #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :kind # 種別 (基本 / スキル / アイテム) attr_accessor :basic # 基本 (攻撃 / 防御 / 逃走 / 待機) attr_accessor :skill_id # スキル ID attr_accessor :item_id # アイテム ID attr_accessor :execute_prob # 発動確率 attr_accessor :condition # 発動条件 attr_accessor :interrupt_message # 割り込みメッセージ #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize clear end #-------------------------------------------------------------------------- # ○ クリア #-------------------------------------------------------------------------- def clear @kind = KGC::Counter::KIND_BASIC @basic = 0 @skill_id = 0 @item_id = 0 @execute_prob = 100 @condition = Game_CounterCondition.new @interrupt_message = "" end #-------------------------------------------------------------------------- # ○ 有効判定 # attacker : 攻撃者 # defender : 被攻撃者 #-------------------------------------------------------------------------- def valid?(attacker, defender) return false if attacker.class == defender.class # 味方からの攻撃
return condition.valid?(attacker, defender) end #-------------------------------------------------------------------------- # ○ 発動判定 #-------------------------------------------------------------------------- def exec? return (execute_prob > rand(100)) end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # □ Game_CounterCondition #------------------------------------------------------------------------------ # カウンター条件を扱うクラスです。 #==============================================================================
class Game_CounterCondition #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :kind # 種別 (ALL / 基本 / スキル / アイテム) attr_accessor :basic # 基本 (攻撃 / 防御 / 逃走 / 待機) attr_accessor :skill_ids # スキル ID リスト attr_accessor :item_ids # アイテム ID リスト attr_accessor :type # 攻撃タイプ (ALL / 物理 / 魔法) attr_accessor :element_set # 属性 attr_accessor :atk_f # 打撃関係度 attr_accessor :spi_f # 精神関係度 attr_accessor :remain_hp # 残存 HP attr_accessor :remain_hp_type # 残存 HP の形式 (以上 / 以下) attr_accessor :remain_mp # 残存 MP attr_accessor :remain_mp_type # 残存 MP の形式 (以上 / 以下) attr_accessor :ignore_target # ターゲット無視 attr_accessor :interrupt # 行動割り込み #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize clear end #-------------------------------------------------------------------------- # ○ クリア #-------------------------------------------------------------------------- def clear @kind = KGC::Counter::KIND_ALL @basic = KGC::Counter::BASIC_ATTACK @skill_ids = [] @item_ids = [] @type = KGC::Counter::TYPE_ALL @element_set = [] @atk_f = 0 @spi_f = 0 @remain_hp = 0 @remain_hp_type = KGC::Counter::REMAIN_TYPE_OVER @remain_mp = 0 @remain_mp_type = KGC::Counter::REMAIN_TYPE_OVER @ignore_target = false @interrupt = false end #-------------------------------------------------------------------------- # ○ 有効判定 # attacker : 攻撃者 # defender : 被攻撃者 #-------------------------------------------------------------------------- def valid?(attacker, defender) action_item = nil if attacker.action.skill? action_item = attacker.action.skill elsif attacker.action.item? action_item = attacker.action.item end
return false unless kind_valid?(attacker, defender, action_item) return false unless attack_type_valid?(attacker, defender, action_item) return false unless element_valid?(attacker, defender, action_item) return false unless atk_f_valid?(attacker, defender, action_item) return false unless spi_f_valid?(attacker, defender, action_item) return false unless remain_hpmp_valid?(attacker, defender, action_item)
return true end #-------------------------------------------------------------------------- # ○ 種別有効判定 # attacker : 攻撃者 # defender : 被攻撃者 # obj : スキルまたはアイテム #-------------------------------------------------------------------------- def kind_valid?(attacker, defender, obj) return true if self.kind == KGC::Counter::KIND_ALL return false if self.kind != attacker.action.kind
case self.kind when KGC::Counter::KIND_BASIC return (self.basic == attacker.action.basic) when KGC::Counter::KIND_SKILL # スキル ID 判定 return true if self.skill_ids.empty? self.skill_ids.each { |sid| return true if sid == attacker.action.skill_id } return false when KGC::Counter::KIND_ITEM # アイテム ID 判定 return true if self.item_ids.empty? self.item_ids.each { |iid| return true if iid == attacker.action.item_id } return false end return false end #-------------------------------------------------------------------------- # ○ 攻撃タイプ有効判定 # attacker : 攻撃者 # defender : 被攻撃者 # obj : スキルまたはアイテム #-------------------------------------------------------------------------- def attack_type_valid?(attacker, defender, obj) return true if self.type == KGC::Counter::TYPE_ALL
if obj == nil # 物理カウンターでない return false if self.type != KGC::Counter::TYPE_PHYSICAL else # [物理攻撃] なら物理、そうでなければ魔法カウンター判定 if self.type != (obj.physical_attack ? KGC::Counter::TYPE_PHYSICAL : KGC::Counter::TYPE_MAGICAL) return false end end return true end #-------------------------------------------------------------------------- # ○ 属性有効判定 # attacker : 攻撃者 # defender : 被攻撃者 # obj : スキルまたはアイテム #-------------------------------------------------------------------------- def element_valid?(attacker, defender, obj) return true if self.element_set.empty?
if attacker.action.attack? elements = attacker.element_set else return false if obj == nil # 属性リスト取得 if $imported["SetAttackElement"] elements = defender.get_inherited_element_set(attacker, obj) else elements = obj.element_set end end return !(self.element_set & elements).empty? end #-------------------------------------------------------------------------- # ○ 打撃関係度有効判定 # attacker : 攻撃者 # defender : 被攻撃者 # obj : スキルまたはアイテム #-------------------------------------------------------------------------- def atk_f_valid?(attacker, defender, obj) return true if self.atk_f == 0
n = (attacker.action.attack? ? 100 : (obj != nil ? obj.atk_f : 0) ) return (self.atk_f <= n) end #-------------------------------------------------------------------------- # ○ 精神関係度有効判定 # attacker : 攻撃者 # defender : 被攻撃者 # obj : スキルまたはアイテム #-------------------------------------------------------------------------- def spi_f_valid?(attacker, defender, obj) return true if self.spi_f == 0
n = (attacker.action.attack? ? 0 : (obj != nil ? obj.spi_f : 0) ) return (self.spi_f <= n) end #-------------------------------------------------------------------------- # ○ 残存 HP/MP 有効判定 # attacker : 攻撃者 # defender : 被攻撃者 # obj : スキルまたはアイテム #-------------------------------------------------------------------------- def remain_hpmp_valid?(attacker, defender, obj) hp_rate = defender.hp * 100 / defender.maxhp case @remain_hp_type when KGC::Counter::REMAIN_TYPE_OVER return false unless (hp_rate >= @remain_hp) when KGC::Counter::REMAIN_TYPE_UNDER return false unless (hp_rate <= @remain_hp) end
mp_rate = defender.mp * 100 / [defender.maxmp, 1].max case @remain_mp_type when KGC::Counter::REMAIN_TYPE_OVER return false unless (mp_rate >= @remain_mp) when KGC::Counter::REMAIN_TYPE_UNDER return false unless (mp_rate <= @remain_mp) end
return true end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # □ Game_CounterInfo #------------------------------------------------------------------------------ # カウンター情報を扱うクラスです。 #==============================================================================
class Game_CounterInfo #-------------------------------------------------------------------------- # ○ 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :battler # 行動者 attr_accessor :action # カウンター行動 attr_accessor :target_index # 対象インデックス #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize @battler = nil @action = nil @target_index = 0 end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # ■ Game_Battler #==============================================================================
class Game_Battler #-------------------------------------------------------------------------- # ○ カウンター行動リストの取得 #-------------------------------------------------------------------------- def counter_actions result = [] states.each { |state| result += state.counter_actions } return result end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # ■ Game_Actor #==============================================================================
class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ○ カウンター行動リストの取得 #-------------------------------------------------------------------------- def counter_actions result = super equips.compact.each { |item| result += item.counter_actions } return result end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # ■ Game_Enemy #==============================================================================
class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # ○ カウンター行動リストの取得 #-------------------------------------------------------------------------- def counter_actions return (super + enemy.counter_actions) end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # ■ Scene_Battle #==============================================================================
class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- alias start_KGC_Counter start def start start_KGC_Counter
@counter_added = false @counter_infos = [] end #-------------------------------------------------------------------------- # ● 戦闘行動の処理 #-------------------------------------------------------------------------- alias process_action_KGC_Counter process_action def process_action process_action_KGC_Counter
register_ignore_target_counter_action unset_counter_action end #-------------------------------------------------------------------------- # ○ カウンター行動の解除 #-------------------------------------------------------------------------- def unset_counter_action return unless @counter_exec
# 行動を元に戻す @active_battler.action.forcing = @former_action.forcing @active_battler.action.kind = @former_action.kind @active_battler.action.basic = @former_action.basic @active_battler.action.skill_id = @former_action.skill_id @active_battler.action.item_id = @former_action.item_id @active_battler.action.target_index = @former_action.target_index
@former_action = nil @counter_exec = false @counter_interrupt = false end #-------------------------------------------------------------------------- # ● 次に行動するべきバトラーの設定 #-------------------------------------------------------------------------- alias set_next_active_battler_KGC_Counter set_next_active_battler def set_next_active_battler set_counter_action
unless @counter_exec set_next_active_battler_KGC_Counter end end #-------------------------------------------------------------------------- # ○ カウンター行動の作成 #-------------------------------------------------------------------------- def set_counter_action @former_action = nil @counter_exec = false @counter_added = false @counter_interrupt = false counter = @counter_infos.shift return if counter == nil
last_active_battler = @active_battler @active_battler = counter.battler # 元の行動を退避 @former_action = @active_battler.action.clone @counter_exec = true # カウンター行動を設定 @active_battler.action.kind = counter.action.kind @active_battler.action.basic = counter.action.basic @active_battler.action.skill_id = counter.action.skill_id @active_battler.action.item_id = counter.action.item_id
# カウンター対象を設定 target_index = counter.target_index # 対象が味方なら自分に対して発動 if @active_battler.action.for_friend? target_index = @active_battler.index end @active_battler.action.target_index = target_index
unless @active_battler.action.valid? # カウンター発動不能ならキャンセル unset_counter_action @active_battler = last_active_battler else @active_battler.action.forcing = true end end #-------------------------------------------------------------------------- # ● 戦闘行動の実行 #-------------------------------------------------------------------------- alias execute_action_KGC_Counter execute_action def execute_action unless @counter_exec register_interrupt_counter_action end
if @counter_interrupt execute_interrupt_counter else execute_action_KGC_Counter end @active_battler.action.made_targets = nil end #-------------------------------------------------------------------------- # ● 戦闘行動の実行 : 攻撃 #-------------------------------------------------------------------------- alias execute_action_attack_KGC_Counter execute_action_attack def execute_action_attack if @counter_exec # 攻撃時メッセージを無理矢理書き換える old_DoAttack = Vocab::DoAttack Vocab.const_set(:DoAttack, Vocab::CounterAttack) end
execute_action_attack_KGC_Counter
if @counter_exec # 後始末 Vocab.const_set(:DoAttack, old_DoAttack) end end #-------------------------------------------------------------------------- # ● 行動結果の表示 # target : 対象者 # obj : スキルまたはアイテム #-------------------------------------------------------------------------- alias display_action_effects_KGC_Counter display_action_effects def display_action_effects(target, obj = nil) display_action_effects_KGC_Counter(target, obj)
unless target.skipped register_counter_action(target) end end #-------------------------------------------------------------------------- # ○ カウンター行動の登録 # target : 対象者 # interrupt : 割り込み判定 #-------------------------------------------------------------------------- def register_counter_action(target, interrupt = false) return if @counter_exec # カウンターに対するカウンターは行わない return if counter_added? # カウンター済み return unless target.movable? # 行動不能
# 有効なカウンター行動をセット target.counter_actions.each { |counter| break if counter_added? break if counter.condition.ignore_target break if counter.condition.interrupt != interrupt judge_counter_action(@active_battler, target, counter) } end #-------------------------------------------------------------------------- # ○ カウンター登録済み判定 #-------------------------------------------------------------------------- def counter_added? return (KGC::Counter::RESTRICT_COUNTER && @counter_added) end #-------------------------------------------------------------------------- # ○ カウンター判定 # attacker : 攻撃者 # target : 被攻撃者 # counter : カウンター行動 #-------------------------------------------------------------------------- def judge_counter_action(attacker, target, counter) if counter.valid?(attacker, target) && counter.exec? info = Game_CounterInfo.new info.battler = target info.action = counter info.target_index = attacker.index @counter_infos << info @counter_added = true end end #-------------------------------------------------------------------------- # ○ ターゲット無視のカウンター行動の登録 # interrupt : 割り込み判定 #-------------------------------------------------------------------------- def register_ignore_target_counter_action(interrupt = false) return if @counter_exec || counter_added?
unit = [] case @active_battler when Game_Actor unit = $game_troop.members when Game_Enemy unit = $game_party.members else return end
unit.each { |battler| battler.counter_actions.each { |counter| break if counter_added? break unless counter.condition.ignore_target break if counter.condition.interrupt != interrupt judge_counter_action(@active_battler, battler, counter) } } end #-------------------------------------------------------------------------- # ○ 割り込みカウンター行動の登録 #-------------------------------------------------------------------------- def register_interrupt_counter_action return if @counter_exec || counter_added?
# 自分が対象 targets = @active_battler.action.make_targets if targets != nil targets.each { |t| break if counter_added? register_counter_action(t, true) } end
# ターゲット無視 register_ignore_target_counter_action(true) unless counter_added?
@counter_interrupt = counter_added? end #-------------------------------------------------------------------------- # ○ 割り込みカウンターの実行 #-------------------------------------------------------------------------- def execute_interrupt_counter counter = @counter_infos[0] text = counter.action.interrupt_message.clone text = Vocab::InterruptCounter.clone if text.empty?
text.gsub!(/\\\\/, "\\") text.gsub!(/\\N([^\[]|$)/i) { "#{@active_battler.name}#{$1}" } text.gsub!(/\\C([^\[]|$)/i) { "#{counter.battler.name}#{$1}" } text.gsub!(/\\A([^\[]|$)/i) { "#{@active_battler.action.action_name}#{$1}" } @message_window.add_instant_text(text) wait(45) end end
je voudrais savoir c'est quoi le code pour appeler ce script. |
|
Croisé Lv.14
Age : 34 Inscrit le : 03/03/2009 Messages : 1141
| Sujet: Re: apeller ce script? Jeu 27 Oct 2011 - 22:57 | |
| Il n'y a pas d'appel concernant ce script tu dois juste regler le true et le false, me semble-t-il... |
|
Citadin Lv.7
Age : 25 Inscrit le : 24/09/2011 Messages : 200
| Sujet: Re: apeller ce script? Jeu 27 Oct 2011 - 23:01 | |
| je suis pas sur de comprendre, sur quelle ligne true false? (il y en a plusieurs...) |
|
Croisé Lv.14
Age : 34 Inscrit le : 03/03/2009 Messages : 1141
| Sujet: Re: apeller ce script? Jeu 27 Oct 2011 - 23:03 | |
| - Code:
-
#==============================================================================# # ★ Customization ★ # #==============================================================================#
module KGC module Counter # ◆ Counter Use Limitation ◆ # This toggle allows you to set counter to attack only once, or behave just # like the actor's normal attack. # true : One-time use only. # false : If the actor can strike multiple times, counter will do the same. RESTRICT_COUNTER = false
# ◆ Counter Attack Message ◆ # This allows you to change the message displayed when an actor or enemy # performs a counter-attack. # %s = Counter Attacker's Name VOCAB_COUNTER_ATTACK = "%s contre-attaque!"
# ◆ Counter Interruption Message ◆ # This allows you to change the message displayed when an actor or enemy # successfully interrupts an attacker's action with a counter attack. # Special Formatting: # \\N : Attacker's name # \\C : Counter Attacker's name # \\A : Name of action interrupted VOCAB_INTERRUPT_COUNTER = "\\C interrupted \\N's \\A!" end end
#=============================================================================# # ★ End Customization ★ # #=============================================================================#
Tout ceci concerne les modification que tu peux effectuer, donc à toi de jouer. |
|
Citadin Lv.7
Age : 25 Inscrit le : 24/09/2011 Messages : 200
| Sujet: Re: apeller ce script? Jeu 27 Oct 2011 - 23:12 | |
| et comment je fais pour appliquer ce script sur une capacité? |
|
Croisé Lv.14
Age : 34 Inscrit le : 03/03/2009 Messages : 1141
| Sujet: Re: apeller ce script? Jeu 27 Oct 2011 - 23:14 | |
| Il ne me semble pas que tu puisses. |
|
Citadin Lv.7
Age : 25 Inscrit le : 24/09/2011 Messages : 200
| Sujet: Re: apeller ce script? Jeu 27 Oct 2011 - 23:20 | |
| alors à quoi ça sert de créer un script de contre si on peut pas l'appliquer? |
|
Croisé Lv.14
Age : 34 Inscrit le : 03/03/2009 Messages : 1141
| Sujet: Re: apeller ce script? Jeu 27 Oct 2011 - 23:23 | |
| Il s'applique automatiquement.
This toggle allows you to set counter to attack only once, or behave just # like the actor's normal attack.
Traduis au lieu de ne pas chercher. |
|
Citadin Lv.7
Age : 25 Inscrit le : 24/09/2011 Messages : 200
| Sujet: Re: apeller ce script? Ven 28 Oct 2011 - 19:57 | |
| mais comment je l'applique à un apptitude? |
|
| Sujet: Re: apeller ce script? | |
| |
|