Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- #_/ ◆ Restored Combat Functions - KGC_ReproduceFunctions ◆ VX ◆
- #_/ ◇ Last Update: 01/18/2009
- #_/ ◆ Written by TOMY
- #_/ ◆ Translation by Mr. Anonymous
- #_/ ◆ KGC Site:
- #_/ ◆ http://ytomy.sakura.ne.jp/
- #_/ ◆ Translator's Blog:
- #_/ ◆ http://mraprojects.wordpress.com
- #_/----------------------------------------------------------------------------
- #_/ This script restores some lost combat functionality since the release of
- #_/ RPG Maker VX. These functions were in RPG Maker 2000, 2003, and XP.
- #_/============================================================================
- #_/ ◆ Instructions For Usage ◆
- #_/ To make use of these functions, you must insert the desired tag into the
- #_/ "Notes" box located in the appropriate section of the database. For
- #_/ example, you want a Great Sword to inflict damage to all enemies on-screen
- #_/ during combat, you would locate Great Sword in the weapons tab of the
- #_/ database and insert "<target all>" (without quotations) in the note box.
- #_/ Simple, no?
- #_/
- #_/ Key: n = Number
- #_/ SkillID = The ID number of the desired skill in the skills database
- #_/ StateID = The ID number of the desired state in the state database
- #_/
- #_/ This may be obvious, but to the right of the tag inside the brackets
- #_/ is either a number or the word StateID/SkillID. Replace these with the
- #_/ desired value.
- #_/
- #_/ ◆ Restored Combat Functions ◆
- #_/
- #_/ ◆ Skill Related ◆
- #_/ <minimum_atk n>
- #_/ Assigns a minimum requirement of a designated amount of Attack to a skill.
- #_/ (Ex. <minimum_atk 80>)
- #_/
- #_/ <minimum_spi n>
- #_/ Assigns a minimum requirement of a designated amount of Spirit to a skill.
- #_/ (Ex. <minimum_spi 40>)
- #_/
- #_/ ◆ Item Related ◆
- #_/ <multi_use n>
- #_/ Sets an item to be used a specified amount of times.
- #_/ (Ex. <multi_use 5>)
- #_/
- #_/ <exec_skill SkillID>
- #_/ Allows you to set an item to force the character to use a specified skill.
- #_/ (Ex. <exec_skill 7>)
- #_/
- #_/ ◆ Equipment Related ◆
- #_/ <auto_state ID>
- #_/ Automatically adds the indictacted state to the equipped character.
- #_/ These can be assigned in multiples. (Ex. <auto_state 1,2,3>)
- #_/
- #_/ <target_all>
- #_/ Treats basic attack made by the equipped character as Target: All
- #_/
- #_/ <ignore_eva>
- #_/ Attacks made by equipped character ignore the target's evasion ratio.
- #_/
- #_/ <mp_cost n>
- #_/ Sets a weapon to consume a specified amount of MP each time it is used.
- #_/ (Ex. <mp_cost 10>)
- #_/
- #_/ <critical n>
- #_/ Increase the critical ratio of the equipped character by a specified amount
- #_/ in percentage. (Ex. <critical 20>)
- #_/
- #_/ ◆ Enemy Related ◆
- #_/ <translucent>
- #_/ Makes an enemy semi-transparent.
- #_/
- #_/ <critical n>
- #_/ Increase the critical ratio of an enemy by a specified amount in percentage
- #_/ (Ex. <critical 30>)
- #_/
- #_/ ◆ State Related ◆
- #_/ <maxmp_rate n%>
- #_/ Increase the maximum hitpoints by a specified amount in percentage.
- #_/ (Ex. <maxhp_rate 150%>)
- #_/
- #_/ <maxmp_rate n%>
- #_/ Increase the maximum magic points by a specified amount in percentage.
- #_/ (Ex. <maxmp_rate 150%>)
- #_/
- #_/ <plus_state StateID>
- #_/ Adds additional state(s) affects to a designated state. These can be
- #_/ assigned in multiples (Ex. <plus_state 1,2,3>).
- #_/
- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- #=============================================================================#
- # ★ Customization ★ #
- #=============================================================================#
- module KGC
- module ReproduceFunctions
- # If a weapon is set to cost MP when used, this toggle will show the amount
- # of MP when used if set to true.
- SHOW_WEAPON_MP_COST_ON_ATTACK = true
- # ★ Weapon Attributes Assignment ★
- # If the equipped weapon has the same attribute(s) as the skill being
- # then that skill is usable. If the attributes are different, then the skill
- # is unusable. These attributes are the same as the first six elements in
- # the database.
- #
- # If you have more attributes you'd like to assign for weapon types, you
- # may assign them in the box below.
- # For example, let's say you have an element labeled "Bullet" on ElementID 14
- # You'd then enter WEAPON_ELEMENTS = [1..6, 14] (assuming the first six are
- # weapon types)
- WEAPON_ELEMENTS = [1..6]
- # Attributes may be written as an array or abbreviated arrays.
- # Ex. [1..6] Which begins at 1 and counts each number to six.
- # [1..6] is the same as [1, 2, 3, 4, 5, 6]
- # [1..4, 5, 6] is also the same as the above.
- end
- end
- #=============================================================================#
- # ★ End Customization ★ #
- #=============================================================================#
- $imported = {} if $imported == nil
- $imported["ReproduceFunctions"] = true
- module KGC::ReproduceFunctions
- #--------------------------------------------------------------------------
- # ○ Convert attribute array of weapons to an integer.
- #--------------------------------------------------------------------------
- def self.create_weapon_element_list
- result = []
- WEAPON_ELEMENTS.each { |e|
- if e.is_a?(Range)
- result |= e.to_a
- elsif e.is_a?(Integer)
- result |= [e]
- end
- }
- return result.sort
- end
- # Attribute array of weapons
- WEAPON_ELEMENT_ID_LIST = create_weapon_element_list
- #==============================================================================
- # □ KGC::ReproduceFunctions::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
- # an item, weapon, armor, enemy, or state.
- # Define Regular Expressions
- module Regexp
- # Base Item Module
- module BaseItem
- # Auto State tag string
- AUTO_STATE = /<(?:AUTO_STATE|auto_state)\s*(\d+(?:\s*,\s*\d+)*)>/i
- # Whole Attack tag string
- WHOLE_ATTACK = /<(?:WHOLE_ATTACK|target_all)>/i
- # Ignore Evasion tag string
- IGNORE_EVA = /<(?:IGNORE_EVA|ignore_eva)>/i
- # Consume MP tag string
- MP_COST = /<(?:MP_COST|mp_cost)\s*([\-]?\d+)>/i
- # Critical tag string
- CRITICAL = /<(?:CRITICAL|critical)\s*(\-?\d+)>/i
- end
- # Item Module
- module Item
- # Multi-Usable Items Tag String
- MULTI_USABLE = /<(?:MULTI_USABLE|multi_use)\s*(\d+)>/i
- # Execute Skill Tag String
- EXEC_SKILL = /<(?:EXEC_SKILL|exec_skill)\s*(\d+)>/i
- end
- # Enemy Module
- module Enemy
- # Translucent tag string
- TRANSLUCENT = /<(?:TRANSLUCENT|translucent)>/i
- # Critical tag string
- CRITICAL = /<(?:CRITICAL|critical)\s*(\d+)>/i
- end
- # State module
- module State
- # MaxHP / MaxMP Rate Tag Strings
- PARAMETER_NAME = {
- "maxhp"=>"MAXHP_RATE|maxhp_rate",
- "maxmp"=>"MAXMP_RATE|maxmp_rate"
- }
- # Stat-Dependant Skills
- # Attack Dependant Skill Tag String (Originally Japanese)
- SEAL_ATK_F_JP = /<SEAL_ATK_F\s*(\d+)\s*minimum>/
- # Attack Dependant Skill Tag String
- SEAL_ATK_F_EN = /<minimum_atk\s*(\d+)>/i
- # Spirit Dependant Skill Tag String (Originally Japanese)
- SEAL_SPI_F_JP = /<SEAL_SPI_F\s*(\d+)\s*以上封印>/
- # # Spirit Dependant Skill Tag String
- SEAL_SPI_F_EN = /<minimum_spi\s*(\d+)>/i
- # Add State Tag String
- PLUS_STATE = /<(?:PLUS_STATE|plus_state)\s*(\d+(?:\s*,\s*\d+)*)>/i
- end
- end
- end
- #=================================End Module===================================#
- #==============================================================================
- # ■ RPG::BaseItem
- #==============================================================================
- class RPG::BaseItem
- #--------------------------------------------------------------------------
- # ○ Generated feature reproduction cache
- #--------------------------------------------------------------------------
- def create_reproduce_functions_cache
- @__whole_attack = false
- @__ignore_eva = false
- @__mp_cost = 0
- @__cri = 0
- self.note.each_line { |line|
- case line
- when KGC::ReproduceFunctions::Regexp::BaseItem::WHOLE_ATTACK
- # 全体攻撃
- @__whole_attack = true
- when KGC::ReproduceFunctions::Regexp::BaseItem::IGNORE_EVA
- # 回避率無視
- @__ignore_eva = true
- when KGC::ReproduceFunctions::Regexp::BaseItem::MP_COST
- # 通常攻撃消費 MP
- @__mp_cost += $1.to_i
- when KGC::ReproduceFunctions::Regexp::BaseItem::CRITICAL
- # クリティカル修正
- @__cri += $1.to_i
- end
- }
- create_auto_state_cache
- end
- #--------------------------------------------------------------------------
- # ○ オートステートのキャッシュ生成
- #--------------------------------------------------------------------------
- def create_auto_state_cache
- # ID のキャッシュ生成
- @__auto_state_ids = []
- @__auto_state_ids_battle = []
- self.note.each_line { |line|
- next unless line =~ KGC::ReproduceFunctions::Regexp::BaseItem::AUTO_STATE
- $1.scan(/\d+/).each { |num|
- if (state = $data_states[num.to_i]) != nil
- @__auto_state_ids_battle << state.id
- unless state.battle_only
- @__auto_state_ids << state.id
- end
- end
- }
- }
- # オブジェクトのキャッシュ作成
- @__auto_states = []
- @__auto_state_ids.each { |i|
- @__auto_states << $data_states[i]
- }
- @__auto_states_battle = []
- @__auto_state_ids_battle.each { |i|
- @__auto_states_battle << $data_states[i]
- }
- end
- #--------------------------------------------------------------------------
- # ○ 全体攻撃判定
- #--------------------------------------------------------------------------
- def whole_attack
- create_reproduce_functions_cache if @__whole_attack == nil
- return @__whole_attack
- end
- #--------------------------------------------------------------------------
- # ○ 回避無視判定
- #--------------------------------------------------------------------------
- def ignore_eva
- create_reproduce_functions_cache if @__ignore_eva == nil
- return @__ignore_eva
- end
- #--------------------------------------------------------------------------
- # ○ 通常攻撃消費 MP
- #--------------------------------------------------------------------------
- def mp_cost
- create_reproduce_functions_cache if @__mp_cost == nil
- return @__mp_cost
- end
- #--------------------------------------------------------------------------
- # ○ クリティカル修正
- #--------------------------------------------------------------------------
- def cri
- create_reproduce_functions_cache if @__cri == nil
- return @__cri
- end
- #--------------------------------------------------------------------------
- # ○ オートステート ID
- #--------------------------------------------------------------------------
- def auto_state_ids
- return ($game_temp.in_battle ? auto_state_ids_battle : auto_state_ids_always)
- end
- #--------------------------------------------------------------------------
- # ○ オートステート ID (常時)
- #--------------------------------------------------------------------------
- def auto_state_ids_always
- create_reproduce_functions_cache if @__auto_state_ids == nil
- return @__auto_state_ids
- end
- #--------------------------------------------------------------------------
- # ○ オートステート ID (戦闘時)
- #--------------------------------------------------------------------------
- def auto_state_ids_battle
- create_reproduce_functions_cache if @__auto_state_ids_battle == nil
- return @__auto_state_ids_battle
- end
- #--------------------------------------------------------------------------
- # ○ オートステート
- #--------------------------------------------------------------------------
- def auto_states
- return ($game_temp.in_battle ? auto_states_battle : auto_states_always)
- end
- #--------------------------------------------------------------------------
- # ○ オートステート (常時)
- #--------------------------------------------------------------------------
- def auto_states_always
- create_reproduce_functions_cache if @__auto_states == nil
- return @__auto_states
- end
- #--------------------------------------------------------------------------
- # ○ オートステート (戦闘時)
- #--------------------------------------------------------------------------
- def auto_states_battle
- create_reproduce_functions_cache if @__auto_states_battle == nil
- return @__auto_states_battle
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ RPG::Item
- #==============================================================================
- class RPG::Item < RPG::UsableItem
- #--------------------------------------------------------------------------
- # ○ 再現機能のキャッシュ生成
- #--------------------------------------------------------------------------
- def create_reproduce_functions_cache
- super
- @__usable_count = 1
- @__skill_id = 0
- self.note.each_line { |line|
- case line
- when KGC::ReproduceFunctions::Regexp::Item::MULTI_USABLE
- # 使用可能回数
- @__usable_count = $1.to_i
- when KGC::ReproduceFunctions::Regexp::Item::EXEC_SKILL
- # 発動スキル ID
- @__skill_id = $1.to_i
- end
- }
- end
- #--------------------------------------------------------------------------
- # ● アニメーション ID
- #--------------------------------------------------------------------------
- def animation_id
- if exec_skill?
- return $data_skills[skill_id].animation_id
- else
- return @animation_id
- end
- end
- #--------------------------------------------------------------------------
- # ○ 使用可能回数
- #--------------------------------------------------------------------------
- def usable_count
- create_reproduce_functions_cache if @__usable_count == nil
- return @__usable_count
- end
- #--------------------------------------------------------------------------
- # ○ スキル発動判定
- #--------------------------------------------------------------------------
- def exec_skill?
- return (skill_id > 0)
- end
- #--------------------------------------------------------------------------
- # ○ 発動スキル ID
- #--------------------------------------------------------------------------
- def skill_id
- create_reproduce_functions_cache if @__skill_id == nil
- return @__skill_id
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ RPG::Skill
- #==============================================================================
- class RPG::Skill < RPG::UsableItem
- #--------------------------------------------------------------------------
- # ○ 再現機能のキャッシュ生成
- #--------------------------------------------------------------------------
- def create_reproduce_functions_cache
- super
- @__weapon_element_set =
- self.element_set & KGC::ReproduceFunctions::WEAPON_ELEMENT_ID_LIST
- end
- #--------------------------------------------------------------------------
- # ○ 使用時に必要な武器属性を取得
- #--------------------------------------------------------------------------
- def weapon_element_set
- create_reproduce_functions_cache if @__weapon_element_set == nil
- return @__weapon_element_set
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ RPG::Enemy
- #==============================================================================
- class RPG::Enemy
- #--------------------------------------------------------------------------
- # ○ 再現機能のキャッシュ生成
- #--------------------------------------------------------------------------
- def create_reproduce_functions_cache
- @__translucent = false
- @__cri = 0
- self.note.each_line { |line|
- case line
- when KGC::ReproduceFunctions::Regexp::Enemy::TRANSLUCENT
- # 半透明
- @__translucent = true
- when KGC::ReproduceFunctions::Regexp::Enemy::CRITICAL
- # クリティカル修正
- @__cri += $1.to_i
- end
- }
- end
- #--------------------------------------------------------------------------
- # ○ 半透明
- #--------------------------------------------------------------------------
- def translucent?
- create_reproduce_functions_cache if @__translucent == nil
- return @__translucent
- end
- #--------------------------------------------------------------------------
- # ○ クリティカル修正
- #--------------------------------------------------------------------------
- def cri
- create_reproduce_functions_cache if @__cri == nil
- return @__cri
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ RPG::State
- #==============================================================================
- class RPG::State
- #--------------------------------------------------------------------------
- # ○ 再現機能のキャッシュ生成
- #--------------------------------------------------------------------------
- def create_reproduce_functions_cache
- @__seal_atk_f = 999
- @__seal_spi_f = 999
- @__plus_state_set = []
- self.note.each_line { |line|
- case line
- when KGC::ReproduceFunctions::Regexp::State::SEAL_ATK_F_JP,
- KGC::ReproduceFunctions::Regexp::State::SEAL_ATK_F_EN
- # 封印するスキルの打撃関係度
- @__seal_atk_f = $1.to_i
- when KGC::ReproduceFunctions::Regexp::State::SEAL_SPI_F_JP,
- KGC::ReproduceFunctions::Regexp::State::SEAL_SPI_F_EN
- # 封印するスキルの精神関係度
- @__seal_spi_f = $1.to_i
- when KGC::ReproduceFunctions::Regexp::State::PLUS_STATE
- # 付加ステート
- $1.scan(/\d+/).each { |num|
- if (state = $data_states[num.to_i]) != nil
- @__plus_state_set << state.id
- end
- }
- end
- }
- create_parameter_rate_cache
- end
- #--------------------------------------------------------------------------
- # ○ パラメータ修正値のキャッシュ生成
- #--------------------------------------------------------------------------
- def create_parameter_rate_cache
- @__parameter_rate = {}
- # 初期化
- KGC::ReproduceFunctions::Regexp::State::PARAMETER_NAME.each_key { |k|
- @__parameter_rate[k] = 100
- }
- # メモ反映
- self.note.each_line { |line|
- KGC::ReproduceFunctions::Regexp::State::PARAMETER_NAME.each { |k, v|
- if line =~ /<(?:#{v})[ ]*(\d+)[%%]>/i
- @__parameter_rate[k] = @__parameter_rate[k] * $1.to_i / 100
- break
- end
- }
- }
- end
- #--------------------------------------------------------------------------
- # ○ MaxHP 修正
- #--------------------------------------------------------------------------
- def maxhp_rate
- create_reproduce_functions_cache if @__parameter_rate == nil
- return @__parameter_rate["maxhp"]
- end
- #--------------------------------------------------------------------------
- # ○ MaxMP 修正
- #--------------------------------------------------------------------------
- def maxmp_rate
- create_reproduce_functions_cache if @__parameter_rate == nil
- return @__parameter_rate["maxmp"]
- end
- #--------------------------------------------------------------------------
- # ○ 封印するスキルの打撃関係度
- #--------------------------------------------------------------------------
- def seal_atk_f
- create_reproduce_functions_cache if @__seal_atk_f == nil
- return @__seal_atk_f
- end
- #--------------------------------------------------------------------------
- # ○ 封印するスキルの精神関係度
- #--------------------------------------------------------------------------
- def seal_spi_f
- create_reproduce_functions_cache if @__seal_spi_f == nil
- return @__seal_spi_f
- end
- #--------------------------------------------------------------------------
- # ○ 付加ステート
- #--------------------------------------------------------------------------
- def plus_state_set
- create_reproduce_functions_cache if @__plus_state_set == nil
- return @__plus_state_set
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Temp
- #==============================================================================
- class Game_Temp
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :exec_skill_on_item # アイテムによるスキル発動フラグ
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias initialize_KGC_ReproduceFunctions initialize unless $@
- def initialize
- initialize_KGC_ReproduceFunctions
- @exec_skill_on_item = false
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Battler
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # ● 現在のステートをオブジェクトの配列で取得
- #--------------------------------------------------------------------------
- alias states_KGC_ReproduceFunctions states unless $@
- def states
- result = states_KGC_ReproduceFunctions + auto_states
- result.sort! { |a, b| b.priority <=> a.priority }
- return result
- end
- #--------------------------------------------------------------------------
- # ● MaxHP の取得
- #--------------------------------------------------------------------------
- alias maxhp_KGC_ReproduceFunctions maxhp unless $@
- def maxhp
- n = maxhp_KGC_ReproduceFunctions
- states.each { |state| n *= state.maxhp_rate / 100.0 }
- return [[Integer(n), 1].max, maxhp_limit].min
- end
- #--------------------------------------------------------------------------
- # ● MaxMP の取得
- #--------------------------------------------------------------------------
- alias maxmp_KGC_ReproduceFunctions maxmp unless $@
- def maxmp
- n = maxmp_KGC_ReproduceFunctions
- states.each { |state| n *= state.maxmp_rate / 100.0 }
- limit = (defined?(maxmp_limit) ? maxmp_limit : 9999)
- return [[Integer(n), 0].max, limit].min
- end
- #--------------------------------------------------------------------------
- # ● HP の取得
- #--------------------------------------------------------------------------
- alias hp_KGC_ReproduceFunctions_Battler hp unless $@
- def hp
- @hp = maxhp if @hp > maxhp
- return hp_KGC_ReproduceFunctions_Battler
- end
- #--------------------------------------------------------------------------
- # ● MP の取得
- #--------------------------------------------------------------------------
- alias mp_KGC_ReproduceFunctions_Battler mp unless $@
- def mp
- @mp = maxmp if @mp > maxmp
- return mp_KGC_ReproduceFunctions_Battler
- end
- #--------------------------------------------------------------------------
- # ○ オートステートの ID を取得
- #--------------------------------------------------------------------------
- def auto_state_ids
- return auto_states(true)
- end
- #--------------------------------------------------------------------------
- # ○ オートステートの配列を取得
- # id_only : ID のみを取得
- #--------------------------------------------------------------------------
- def auto_states(id_only = false)
- return []
- end
- #--------------------------------------------------------------------------
- # ● ステートの検査
- # state_id : ステート ID
- # 該当するステートが付加されていれば true を返す。
- #--------------------------------------------------------------------------
- alias state_KGC_ReproduceFunctions? state? unless $@
- def state?(state_id)
- return (state_KGC_ReproduceFunctions?(state_id) || auto_state?(state_id))
- end
- #--------------------------------------------------------------------------
- # ● ステートの付加
- # state_id : ステート ID
- #--------------------------------------------------------------------------
- alias add_state_KGC_ReproduceFunctions add_state unless $@
- def add_state(state_id)
- last_states = @states.dup
- add_state_KGC_ReproduceFunctions(state_id)
- if (@states - last_states).include?(state_id) # ステートが付加された場合
- state = $data_states[state_id]
- # [付加するステート] を適用
- state.plus_state_set.each { |i|
- add_state(i)
- }
- end
- end
- #--------------------------------------------------------------------------
- # ○ オートステートの検査
- # state_id : ステート ID
- # 該当するステートが付加されていれば true を返す。
- #--------------------------------------------------------------------------
- def auto_state?(state_id)
- return auto_state_ids.include?(state_id)
- end
- #--------------------------------------------------------------------------
- # ● ステートの解除
- # state_id : ステート ID
- #--------------------------------------------------------------------------
- alias remove_state_KGC_ReproduceFunctions remove_state unless $@
- def remove_state(state_id)
- if auto_state?(state_id) # オートステートは解除しない
- return
- end
- remove_state_KGC_ReproduceFunctions(state_id)
- end
- #--------------------------------------------------------------------------
- # ○ 半透明化判定
- #--------------------------------------------------------------------------
- def translucent?
- # エネミーの場合は Game_Enemy で再定義
- return false
- end
- #--------------------------------------------------------------------------
- # ○ 装備オプション [全体攻撃] の取得
- #--------------------------------------------------------------------------
- def whole_attack
- return false
- end
- #--------------------------------------------------------------------------
- # ○ 装備オプション [回避無視] の取得
- #--------------------------------------------------------------------------
- def ignore_eva
- return false
- end
- #--------------------------------------------------------------------------
- # ○ MP ダメージ加算
- # value : 加算する値
- #--------------------------------------------------------------------------
- def add_mp_damage(value)
- @mp_damage += value
- end
- #--------------------------------------------------------------------------
- # ○ 通常攻撃の消費 MP 計算
- #--------------------------------------------------------------------------
- def calc_attack_mp_cost
- return 0
- end
- #--------------------------------------------------------------------------
- # ● スキルの使用可能判定
- # skill : スキル
- #--------------------------------------------------------------------------
- alias skill_can_use_KGC_ReproduceFunctions? skill_can_use? unless $@
- def skill_can_use?(skill)
- return false unless skill.is_a?(RPG::Skill)
- unless $imported["CooperationSkill"] && $game_temp.judging_cooperation_skill
- return false if skill_seal?(skill)
- return false unless skill_satisfied_weapon_element?(skill)
- end
- return skill_can_use_KGC_ReproduceFunctions?(skill)
- end
- #--------------------------------------------------------------------------
- # ○ スキル封印判定
- #--------------------------------------------------------------------------
- def skill_seal?(skill)
- return (seal_atk_f <= skill.atk_f || seal_spi_f <= skill.spi_f)
- end
- #--------------------------------------------------------------------------
- # ○ 封印する打撃関係度を取得
- #--------------------------------------------------------------------------
- def seal_atk_f
- n = 999
- states.each { |state| n = [n, state.seal_atk_f].min }
- return n
- end
- #--------------------------------------------------------------------------
- # ○ 封印する精神関係度を取得
- #--------------------------------------------------------------------------
- def seal_spi_f
- n = 999
- states.each { |state| n = [n, state.seal_spi_f].min }
- return n
- end
- #--------------------------------------------------------------------------
- # ○ 必要な武器属性を満たしているか判定
- #--------------------------------------------------------------------------
- def skill_satisfied_weapon_element?(skill)
- return true
- end
- #--------------------------------------------------------------------------
- # ● 最終回避率の計算
- # user : 攻撃者、スキルまたはアイテムの使用者
- # obj : スキルまたはアイテム (通常攻撃の場合は nil)
- #--------------------------------------------------------------------------
- alias calc_eva_KGC_ReproduceFunctions calc_eva unless $@
- def calc_eva(user, obj = nil)
- eva = calc_eva_KGC_ReproduceFunctions(user, obj)
- physical = (obj == nil || obj.physical_attack)
- if physical && user.ignore_eva # 物理攻撃かつ回避無視の場合
- eva = 0
- end
- return eva
- end
- #--------------------------------------------------------------------------
- # ● アイテムの効果適用
- # user : アイテムの使用者
- # item : アイテム
- #--------------------------------------------------------------------------
- alias item_effect_KGC_ReproduceFunctions item_effect unless $@
- def item_effect(user, item)
- # スキル発動判定
- if item.exec_skill?
- $game_temp.exec_skill_on_item = true
- skill_effect(user, $data_skills[item.skill_id])
- $game_temp.exec_skill_on_item = false
- else
- item_effect_KGC_ReproduceFunctions(user, item)
- end
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_BattleAction
- #==============================================================================
- class Game_BattleAction
- #--------------------------------------------------------------------------
- # ● 通常攻撃のターゲット作成
- #--------------------------------------------------------------------------
- alias make_attack_targets_KGC_ReproduceFunctions make_attack_targets unless $@
- def make_attack_targets
- unless battler.whole_attack # 全体攻撃でない
- return make_attack_targets_KGC_ReproduceFunctions
- end
- targets = []
- if battler.confusion?
- targets += friends_unit.existing_members
- else
- targets += opponents_unit.existing_members
- end
- if battler.dual_attack # 連続攻撃
- targets += targets
- end
- return targets.compact
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● クリティカル率の取得
- #--------------------------------------------------------------------------
- alias cri_KGC_ReproduceFunctions cri unless $@
- def cri
- n = cri_KGC_ReproduceFunctions
- equips.compact.each { |item| n += item.cri }
- return n
- end
- #--------------------------------------------------------------------------
- # ○ オートステートの配列を取得
- # id_only : ID のみを取得
- #--------------------------------------------------------------------------
- def auto_states(id_only = false)
- result = []
- equips.compact.each { |item|
- result |= (id_only ? item.auto_state_ids : item.auto_states)
- }
- return result
- end
- #--------------------------------------------------------------------------
- # ○ 装備オプション [全体攻撃] の取得
- #--------------------------------------------------------------------------
- def whole_attack
- equips.compact.each { |item|
- return true if item.whole_attack
- }
- return false
- end
- #--------------------------------------------------------------------------
- # ○ 装備オプション [回避無視] の取得
- #--------------------------------------------------------------------------
- def ignore_eva
- equips.compact.each { |item|
- return true if item.ignore_eva
- }
- return false
- end
- #--------------------------------------------------------------------------
- # ○ 通常攻撃の消費 MP 計算
- #--------------------------------------------------------------------------
- def calc_attack_mp_cost
- n = 0
- equips.compact.each { |item|
- n += item.mp_cost
- }
- return n
- end
- #--------------------------------------------------------------------------
- # ○ 必要な武器属性を満たしているか判定
- #--------------------------------------------------------------------------
- def skill_satisfied_weapon_element?(skill)
- elements = skill.weapon_element_set
- return (self.element_set & elements) == elements
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # ○ 半透明化判定
- #--------------------------------------------------------------------------
- def translucent?
- return enemy.translucent?
- end
- #--------------------------------------------------------------------------
- # ● クリティカル率の取得
- #--------------------------------------------------------------------------
- alias cri_KGC_ReproduceFunctions cri unless $@
- def cri
- n = cri_KGC_ReproduceFunctions
- if enemy.has_critical && enemy.cri != 0
- n += enemy.cri - 10
- end
- return n
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Party
- #==============================================================================
- class Game_Party < Game_Unit
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias initialize_KGC_ReproduceFunctions initialize unless $@
- def initialize
- initialize_KGC_ReproduceFunctions
- @item_use_count = {} # 所持品使用回数ハッシュ (アイテム ID)
- end
- #--------------------------------------------------------------------------
- # ● アイテムの減少
- # item : アイテム
- # n : 個数
- # include_equip : 装備品も含める
- #--------------------------------------------------------------------------
- alias lose_item_KGC_ReproduceFunctions lose_item unless $@
- def lose_item(item, n, include_equip = false)
- lose_item_KGC_ReproduceFunctions(item, n, include_equip)
- # アイテムが無くなったら使用回数をリセット
- if item.is_a?(RPG::Item) && item.consumable && item_number(item) == 0
- @item_use_count[item.id] = 0
- end
- end
- #--------------------------------------------------------------------------
- # ● アイテムの消耗
- # item : アイテム
- #--------------------------------------------------------------------------
- alias consume_item_KGC_ReproduceFunctions consume_item unless $@
- def consume_item(item)
- if item.is_a?(RPG::Item) && item.consumable
- update_use_count(item)
- # 使用回数が 0 の場合のみ消耗
- if @item_use_count[item.id] == 0
- consume_item_KGC_ReproduceFunctions(item)
- end
- else
- consume_item_KGC_ReproduceFunctions(item)
- end
- end
- #--------------------------------------------------------------------------
- # ○ 使用回数の更新
- # item : アイテム
- # 指定アイテムの使用回数を 1 増やす。
- # 使用後に消耗する場合は、使用回数を 0 にする。
- #--------------------------------------------------------------------------
- def update_use_count(item)
- if @item_use_count == nil
- @item_use_count = {}
- end
- unless @item_use_count.has_key?(item.id)
- @item_use_count[item.id] = 0
- end
- @item_use_count[item.id] += 1
- # 使用可能回数に達したら、使用回数を 0 にする
- if @item_use_count[item.id] >= item.usable_count
- @item_use_count[item.id] = 0
- end
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Sprite_Battler
- #==============================================================================
- class Sprite_Battler < Sprite_Base
- #--------------------------------------------------------------------------
- # ● エフェクトの更新
- #--------------------------------------------------------------------------
- alias update_effect_KGC_ReproduceFunctions update_effect unless $@
- def update_effect
- # エフェクト実行前に半透明化判定をしておく
- trans_flag = (@effect_duration > 0 && @battler.translucent?)
- update_effect_KGC_ReproduceFunctions
- if trans_flag
- self.opacity /= 2
- end
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Scene_Battle
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● 対象敵キャラ選択の開始
- #--------------------------------------------------------------------------
- alias start_target_enemy_selection_KGC_ReproduceFunctions start_target_enemy_selection unless $@
- def start_target_enemy_selection
- # 全体通常攻撃なら選択をスキップ
- if @active_battler.action.kind == 0 &&
- @active_battler.action.basic == 0 &&
- @active_battler.whole_attack
- next_actor
- return
- end
- start_target_enemy_selection_KGC_ReproduceFunctions
- end
- #--------------------------------------------------------------------------
- # ● 戦闘行動の実行 : 攻撃
- #--------------------------------------------------------------------------
- alias execute_action_attack_KGC_ReproduceFunctions execute_action_attack unless $@
- def execute_action_attack
- execute_action_attack_KGC_ReproduceFunctions
- # 攻撃者の MP 消費
- mp_cost = @active_battler.calc_attack_mp_cost
- return if mp_cost == 0
- @active_battler.mp -= mp_cost
- if KGC::ReproduceFunctions::SHOW_WEAPON_MP_COST_ON_ATTACK
- @active_battler.add_mp_damage(mp_cost)
- display_mp_damage(@active_battler)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment