CyberForte

DoW Passive

Oct 10th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 33.59 KB | None | 0 0
  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/   ◆                  Passive Skills - KGC_PassiveSkill               ◆ VX ◆
  3. #_/   ◇                      Last Update: 2008/09/13                          ◇
  4. #_/   ◆                    Translation by Mr. Anonymous                       ◆
  5. #_/   ◆ KGC Site:                                                             ◆
  6. #_/   ◆ http://f44.aaa.livedoor.jp/~ytomy/                                    ◆
  7. #_/   ◆ Translator's Blog:                                                    ◆
  8. #_/   ◆ http://mraprojects.wordpress.com                                      ◆
  9. #_/-----------------------------------------------------------------------------
  10. #_/  This script allows the designer to create "passive" skills, which may
  11. #_/   augment a character's abilities, rather than simple attacks.
  12. #_/=============================================================================
  13. #_/                       ◆ Instructions For Usage ◆
  14. #_/  To assign a skill as passive, the following must be added into the skill's
  15. #_/    "Notes" box:
  16. #_/
  17. #_/ <PASSIVE_SKILL> Attribute   Modifier   Rate </PASSIVE_SKILL>
  18. #_/  
  19. #_/  Example:
  20. #_/  
  21. #_/ <PASSIVE_SKILL> ATK +5 </PASSIVE_SKILL>
  22. #_/  (Increase the character's attack by 5.)
  23. #_/  
  24. #_/  You can have an unlimited amount of attribute settings within the passive
  25. #_/  skill tags. Percentiles and other mathematical expressions can also be used
  26. #_/  as demonstrated:
  27. #_/  
  28. #_/  <PASSIVE_SKILL> MAXHP +20% MAXMP -20% DEF +5 SPI -5 </PASSIVE_SKILL>
  29. #_/  (Increase the character's maximum HP by 20 percent, decrease maximum MP by
  30. #_/   20 percent. increase defense by 5, and decrease "spirit" by 5)
  31. #_/  
  32. #_/  Also, you can assign other attributes to a character, such as adding the
  33. #_/  fire element to their basic attack function, state changes, such as adding
  34. #_/  stun to their basic attack, or adding resistance to states, such as making
  35. #_/  a character immune to being blinded. Using the default terminology setup:
  36. #_/  
  37. #_/  ATTACK_ELEMENT = Adds an element to the character's basic attack
  38. #_/  PLUS_STATE = Adds a state change to an attack (State change affects target)
  39. #_/  INVALID_STATE = Adds a resistance to specified state changes to a character
  40. #_/  The modifiers for these are the Element ID#s and State ID#s, respectively.
  41. #_/  You can assign multiple values to each parameter. IE: 1,2,3, etc
  42. #_/
  43. #_/  FAST_ATTACK = Grants the actor automatic preemptive attacks.
  44. #_/  DUAL_ATTACK = The actor attacks twice in a row when attacking.
  45. #_/  CRITICAL_BONUS = Increases the actor's critical hit percentile.
  46. #_/  PREVENT_CRITICAL = Eliminate the chance of taking a critical hit from foe.
  47. #_/  HALF_MP_COST = MP cost for skills is halved.
  48. #_/  DOUBLE_EXP_GAIN = Doubles the experience points gained.
  49. #_/
  50. #_/   * The following tags require KCG_ReproduceFunctions *
  51. #_/   WHOLE_ATTACK = Actor attacks all enemies on-screen.
  52. #_/   IGNORE_EVA = Actor's attacks completely ignore the foe's evasion.
  53. #_/
  54. #_/   * The following tag requires KCG_AddEquipmentOptions *
  55. #_/   n TIMES_ATTACK = (Where n = Number) Normal attack strikes multiple times.
  56. #_/
  57. #_/   * The following tag requires KGC_EquipExtension *
  58. #_/   TWO_SWORDS_STYLE = Grants the two-weapon fighting ability.
  59. #_/   AUTO_BATTLE = Makes the actor preform actions automatically in battle.
  60. #_/   SUPER_GUARD = Reduces damage to 1/4 when using the defend command.
  61. #_/   PHARMACOLOGY = Doubles the healing effect for items.
  62. #_/
  63. #_/  Example:
  64. #_/  
  65. #_/ <PASSIVE_SKILL> ATTACK_ELEMENT 8,9 PLUS_STATE 8 INVALID_STATE 6 </PASSIVE_SKILL>
  66. #_/  (Add Fire and Ice element to attack, add Stun state to attack, add
  67. #_/   resistance to Sleep state to character.)
  68. #_/
  69. #_/  You can also combine the use of stat increases/decreases and element/state
  70. #_/  changes into a single <PASSIVE_SKILL> statement.
  71. #_/
  72. #_/  One last note: When entering these values into the Skill's "Notes",
  73. #_/  each line needs to be separated by pressing enter. So, in our final example
  74. #_/  your setup should look something like this:
  75. #_/  
  76. #_/ <PASSIVE_SKILL>
  77. #_/  MAXHP +20%
  78. #_/  MAXMP -20%
  79. #_/  ATTACK_ELEMENT 8,9
  80. #_/  PLUS_STATE 8
  81. #_/ </PASSIVE_SKILL>
  82. #_/=============================================================================
  83. #_/  Install: Insert below KCG_ReproduceFunctions, KCG_AddEquipmentOptions,
  84. #_/           and KGC_EquipExtension
  85. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
  86.  
  87. #=================================================#
  88. #                    IMPORT                       #
  89. #=================================================#
  90.  
  91. $imported = {} if $imported == nil
  92. $imported["PassiveSkill"] = true
  93.  
  94. #=================================================#
  95.  
  96. #==============================================================================
  97. # □ KGC::PassiveSkill
  98. #==============================================================================
  99. # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
  100. #                          Note Field Tag Strings                             #
  101. # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
  102. #  Whatever word(s) are after the separator ( | ) in the following lines are
  103. #   what are used to determine what is searched for in the "Note" section of
  104. #   a skill.
  105.  
  106. module KGC
  107. module PassiveSkill
  108.  
  109.   #               ◆ Passive Skill State Change Parameters ◆
  110.   # These can be changed to fit your own purposes. (For memorization.)
  111.   # The (obvious) setup is OriginalString|PersonalAbbreviation
  112.   # These are what you'll use to set up the actual attribute bonus
  113.   # that the skill provides. (IE. MAXHP +10%)
  114.   # (ATTACK_ELEMENT 1,2 ) same as (atkelem 1,2)
  115.  
  116.   PARAMS = {
  117.     :maxhp => "MAXHP|maximum_hp",   # Maximum Hit Points
  118.     :maxmp => "MAXMP|maximum_mp",   # Maximum Magic Points
  119.     :atk   => "ATK|attack",         # Attack
  120.     :def   => "DEF|defense",        # Defense
  121.     :spi   => "SPI|spirit",         # AKA "INT|Intelligence"
  122.     :agi   => "AGI|agility",        # Agility
  123.     :hit   => "HIT|hit_ratio",      # AKA "ACU|Accuracy"
  124.     :eva   => "EVA|evasion",        # Evasion Ratio
  125.     :cri   => "CRI|critial",        # Critial Ratio
  126.     :odds  => "LCK|luck",           # Luck (See below)
  127.   }                                 # Affects the likelyhood of being targetted
  128.  
  129.  #                       ◆ Attribute State List ◆
  130.   ARRAYS = {
  131.     :attack_element => "ATTACK_ELEMENT|attack_element",
  132.     :plus_state     => "PLUS_STATE|plus_state",
  133.     :invalid_state  => "INVALID_STATE|invalid_state",
  134.     :auto_state     => "AUTO_STATE|auto_state",
  135.   }
  136.  
  137.   #                   ◆ Passive Skill Special Effects ◆
  138.   EFFECTS = {
  139.     :two_swords_style => "TWO_SWORDS_STYLE|two_swords_style",
  140.     :auto_battle      => "AUTO_BATTLE|auto_battle",
  141.     :super_guard      => "SUPER_GUARD|super_guard",
  142.     :pharmacology     => "PHARMACOLOGY|pharmacology",
  143.     :fast_attack      => "FAST_ATTACK|fast_attack",
  144.     :dual_attack      => "DUAL_ATTACK|dual_attack",
  145.     :critical_bonus   => "CRITICAL_BONUS|critical_bonus",
  146.     :prevent_critical => "PREVENT_CRITICAL|prevent_critical",
  147.     :half_mp_cost     => "HALF_MP_COST|half_mp_cost",
  148.     :double_exp_gain  => "DOUBLE_EXP_GAIN|double_exp_gain",
  149.     # From KGC_ReproduceFunctions
  150.     :whole_attack     => "WHOLE_ATTACK|target_all",
  151.     :ignore_eva       => "IGNORE_EVA|ignore_evasion",
  152.     # From KGC_AddEquipmentOptions
  153.     :multi_attack_count => '(\d+)\s*(?:TIMES_ATTACK|multi_attack_count)',
  154.   }
  155.  
  156. #==============================================================================
  157. # □ KGC::EquipExtension::Regexp
  158. #==============================================================================
  159. # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
  160. #                          Note Field Tag Strings                             #
  161. # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
  162. #  Whatever word(s) are after the separator ( | ) in the following lines are
  163. #   what are used to determine what is searched for in the "Note" section of
  164. #   a skill.
  165.  
  166.   # Regular Expression Definition
  167.   module Regexp
  168.     # Base Skill Module
  169.     module Skill
  170.       # Passive Skill Tag begin
  171.       BEGIN_PASSIVE = /<(?:PASSIVE_SKILL|passive_skill)>/i
  172.       # Passive Skill Tag end
  173.       END_PASSIVE = /<\/(?:PASSIVE_SKILL|passive_skill)>/i
  174.       # Parameter Tag Additions
  175.       PASSIVE_PARAMS = /^\s*([^:\+\-\d\s]+)\s*([\+\-]\d+)([%%])?/
  176.       # Passive arrays
  177.       #  Attack Element 1,2,3  etc
  178.       PASSIVE_ARRAYS = /^\s*([^:\+\-\d\s]+)\s*(\d+(?:\s*,\s*\d+)*)/
  179.       # Passive effects
  180.       PASSIVE_EFFECTS = /^\s*([^:\+\-\d\s]+)/
  181.     end
  182.   end
  183. end
  184. end
  185.  
  186. #=================================================#
  187.  
  188. #==============================================================================
  189. # □ KGC::Commands
  190. #==============================================================================
  191.  
  192. module KGC
  193.   module Commands
  194.     module_function
  195.     #--------------------------------------------------------------------------
  196.     # ○ パッシブスキルの修正値を再設定
  197.     #--------------------------------------------------------------------------
  198.     def restore_passive_rev
  199.       (1...$data_actors.size).each { |i|
  200.         actor = $game_actors[i]
  201.         actor.restore_passive_rev
  202.       }
  203.     end
  204.   end
  205. end
  206.  
  207. #=================================================#
  208. #             INCLUDE COMMANDS                    #
  209. #=================================================#
  210. #    Include KGC::Commands in Game_Interpreter    #
  211. #=================================================#
  212.  
  213. class Game_Interpreter
  214.   include KGC::Commands
  215. end
  216.  
  217. #=================================================#
  218.  
  219. #==============================================================================
  220. # ■ RPG::Skill
  221. #==============================================================================
  222.  
  223. class RPG::Skill < RPG::UsableItem
  224.   #--------------------------------------------------------------------------
  225.   # ○ パッシブスキルのキャッシュを生成
  226.   #--------------------------------------------------------------------------
  227.   def create_passive_skill_cache
  228.     @__passive = false
  229.     @__passive_params = {}
  230.     @__passive_params_rate = {}
  231.     @__passive_arrays = {}
  232.     @__passive_effects = { :multi_attack_count => 1 }
  233.  
  234.     passive_flag = false
  235.     self.note.each_line { |line|
  236.       case line
  237.       when KGC::PassiveSkill::Regexp::Skill::BEGIN_PASSIVE
  238.         # パッシブスキル定義開始
  239.         passive_flag = true
  240.         @__passive = true
  241.       when KGC::PassiveSkill::Regexp::Skill::END_PASSIVE
  242.         # パッシブスキル定義終了
  243.         passive_flag = false
  244.       when KGC::PassiveSkill::Regexp::Skill::PASSIVE_PARAMS
  245.         # 能力値修正
  246.         if passive_flag
  247.           apply_passive_params($1, $2.to_i, $3 != nil)
  248.         end
  249.       when KGC::PassiveSkill::Regexp::Skill::PASSIVE_ARRAYS
  250.         # 属性・ステート
  251.         if passive_flag
  252.           apply_passive_arrays($1, $2.scan(/\d+/))
  253.         end
  254.       else
  255.         # 特殊効果
  256.         if passive_flag
  257.           apply_passive_effects(line)
  258.         end
  259.       end
  260.     }
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ○ パッシブスキルの能力値修正を適用
  264.   #     param : 対象パラメータ
  265.   #     value : 修正値
  266.   #     rate  : true なら % 指定
  267.   #--------------------------------------------------------------------------
  268.   def apply_passive_params(param, value, rate)
  269.     KGC::PassiveSkill::PARAMS.each { |k, v|
  270.       if param =~ /(?:#{v})/i
  271.         if rate
  272.           @__passive_params_rate[k] = 0 if @__passive_params_rate[k] == nil
  273.           @__passive_params_rate[k] += value
  274.         else
  275.           @__passive_params[k] = 0 if @__passive_params[k] == nil
  276.           @__passive_params[k] += value
  277.         end
  278.         break
  279.       end
  280.     }
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ○ パッシブスキルの追加属性・ステートを適用
  284.   #     param : 対象パラメータ
  285.   #     list  : 属性・ステート一覧
  286.   #--------------------------------------------------------------------------
  287.   def apply_passive_arrays(param, list)
  288.     KGC::PassiveSkill::ARRAYS.each { |k, v|
  289.       if param =~ /(?:#{v})/i
  290.         values = []
  291.         list.each { |num| values << num.to_i }
  292.         @__passive_arrays[k] = [] if @__passive_arrays[k] == nil
  293.         @__passive_arrays[k] |= values
  294.         break
  295.       end
  296.     }
  297.   end
  298.   #--------------------------------------------------------------------------
  299.   # ○ パッシブスキルの特殊効果を適用
  300.   #     effect : 対象効果
  301.   #--------------------------------------------------------------------------
  302.   def apply_passive_effects(effect)
  303.     KGC::PassiveSkill::EFFECTS.each { |k, v|
  304.       if effect =~ /^\s*(#{v})/i
  305.         if k == :multi_attack_count
  306.           $1 =~ /#{v}/i
  307.           @__passive_effects[k] = [ $1.to_i, @__passive_effects[k] ].max
  308.         else
  309.           @__passive_effects[k] = true
  310.         end
  311.         break
  312.       end
  313.     }
  314.   end
  315.   #--------------------------------------------------------------------------
  316.   # ○ パッシブスキルであるか
  317.   #--------------------------------------------------------------------------
  318.   def passive
  319.     create_passive_skill_cache if @__passive == nil
  320.     return @__passive
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ○ パッシブスキルの能力値修正 (即値)
  324.   #--------------------------------------------------------------------------
  325.   def passive_params
  326.     create_passive_skill_cache if @__passive_params == nil
  327.     return @__passive_params
  328.   end
  329.   #--------------------------------------------------------------------------
  330.   # ○ パッシブスキルの能力値修正 (割合)
  331.   #--------------------------------------------------------------------------
  332.   def passive_params_rate
  333.     create_passive_skill_cache if @__passive_params_rate == nil
  334.     return @__passive_params_rate
  335.   end
  336.   #--------------------------------------------------------------------------
  337.   # ○ パッシブスキルの属性・ステートリスト
  338.   #--------------------------------------------------------------------------
  339.   def passive_arrays
  340.     create_passive_skill_cache if @__passive_arrays == nil
  341.     return @__passive_arrays
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # ○ パッシブスキルの特殊効果リスト
  345.   #--------------------------------------------------------------------------
  346.   def passive_effects
  347.     create_passive_skill_cache if @__passive_effects == nil
  348.     return @__passive_effects
  349.   end
  350. end
  351.  
  352. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  353.  
  354. #==============================================================================
  355. # ■ Game_Actor
  356. #==============================================================================
  357.  
  358. class Game_Actor < Game_Battler
  359.   #--------------------------------------------------------------------------
  360.   # ● セットアップ
  361.   #     actor_id : アクター ID
  362.   #--------------------------------------------------------------------------
  363.   alias setup_KGC_PassiveSkill setup unless $@
  364.   def setup(actor_id)
  365.     reset_passive_rev
  366.  
  367.     setup_KGC_PassiveSkill(actor_id)
  368.  
  369.     restore_passive_rev
  370.   end
  371.   #--------------------------------------------------------------------------
  372.   # ○ パッシブスキルの修正値を初期化
  373.   #--------------------------------------------------------------------------
  374.   def reset_passive_rev
  375.     @passive_params = {}
  376.     @passive_params_rate = {}
  377.     @passive_arrays = {}
  378.     @passive_effects = {}
  379.     KGC::PassiveSkill::PARAMS.each_key { |k|
  380.       @passive_params[k] = 0
  381.       @passive_params_rate[k] = 100
  382.     }
  383.     KGC::PassiveSkill::ARRAYS.each_key { |k| @passive_arrays[k] = [] }
  384.     KGC::PassiveSkill::EFFECTS.each_key { |k| @passive_effects[k] = false }
  385.     @passive_effects[:multi_attack_count] = 1
  386.   end
  387.   #--------------------------------------------------------------------------
  388.   # ○ パッシブスキルの修正値を再設定
  389.   #--------------------------------------------------------------------------
  390.   def restore_passive_rev
  391.     return if @__passive_rev_restoring
  392.  
  393.     # 修正前の値を保持
  394.     last_effects = @passive_effects.clone if @passive_effects != nil
  395.  
  396.     reset_passive_rev
  397.  
  398.     # ≪スキルCP制≫ の併用を考慮し、戦闘中フラグを一時的にオン
  399.     last_in_battle = $game_temp.in_battle
  400.     $game_temp.in_battle = true
  401.     # 修正値を取得
  402.     self.skills.each { |skill|
  403.       next unless skill.passive
  404.  
  405.       skill.passive_params.each { |k, v| @passive_params[k] += v }
  406.       skill.passive_params_rate.each { |k, v| @passive_params_rate[k] += v }
  407.       skill.passive_arrays.each { |k, v| @passive_arrays[k] |= v }
  408.       skill.passive_effects.each { |k, v|
  409.         if k == :multi_attack_count
  410.           @passive_effects[k] = [ v, @passive_effects[k] ].max
  411.         else
  412.           @passive_effects[k] |= v
  413.         end
  414.       }
  415.     }
  416.     $game_temp.in_battle = last_in_battle
  417.  
  418.     @__passive_rev_restoring = true
  419.     # HP/MP を修正
  420.     self.hp = self.hp
  421.     self.mp = self.mp
  422.  
  423.     # 二刀流違反を修正
  424. #    if last_effects[:two_swords_style] != nil &&
  425. #        last_effects[:two_swords_style] != two_swords_style
  426. #      @__one_time_two_swords_style = last_effects[:two_swords_style]
  427. #      change_equip(1, nil)
  428. #      @__one_time_two_swords_style = nil
  429. #    end
  430.     @__passive_rev_restoring = nil
  431.   end
  432.   #--------------------------------------------------------------------------
  433.   # ○ パッシブスキルによるパラメータ修正値 (即値)
  434.   #--------------------------------------------------------------------------
  435.   def passive_params
  436.     restore_passive_rev if @passive_params == nil
  437.     return @passive_params
  438.   end
  439.   #--------------------------------------------------------------------------
  440.   # ○ パッシブスキルによるパラメータ修正値 (割合)
  441.   #--------------------------------------------------------------------------
  442.   def passive_params_rate
  443.     restore_passive_rev if @passive_params_rate == nil
  444.     return @passive_params_rate
  445.   end
  446.   #--------------------------------------------------------------------------
  447.   # ○ パッシブスキルによる追加属性・ステート
  448.   #--------------------------------------------------------------------------
  449.   def passive_arrays
  450.     restore_passive_rev if @passive_arrays == nil
  451.     return @passive_arrays
  452.   end
  453.   #--------------------------------------------------------------------------
  454.   # ○ パッシブスキルによる特殊効果
  455.   #--------------------------------------------------------------------------
  456.   def passive_effects
  457.     restore_passive_rev if @passive_effects == nil
  458.     return @passive_effects
  459.   end
  460.   #--------------------------------------------------------------------------
  461.   # ● 装備の変更 (オブジェクトで指定)
  462.   #     equip_type : 装備部位 (0..4)
  463.   #     item       : 武器 or 防具 (nil なら装備解除)
  464.   #     test       : テストフラグ (戦闘テスト、または装備画面での一時装備)
  465.   #--------------------------------------------------------------------------
  466.   alias change_equip_KGC_PassiveSkill change_equip unless $@
  467.   def change_equip(equip_type, item, test = false)
  468.     change_equip_KGC_PassiveSkill(equip_type, item, test)
  469.  
  470.     restore_passive_rev
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # ● 装備の破棄
  474.   #     item : 破棄する武器 or 防具
  475.   #    武器/防具の増減で「装備品も含める」のとき使用する。
  476.   #--------------------------------------------------------------------------
  477.   alias discard_equip_KGC_PassiveSkill discard_equip unless $@
  478.   def discard_equip(item)
  479.     discard_equip_KGC_PassiveSkill(item)
  480.  
  481.     restore_passive_rev
  482.   end
  483.   #--------------------------------------------------------------------------
  484.   # ● ステート無効化判定
  485.   #     state_id : ステート ID
  486.   #--------------------------------------------------------------------------
  487.   alias state_resist_KGC_PassiveSkill? state_resist? unless $@
  488.   def state_resist?(state_id)
  489.     return true if passive_arrays[:invalid_state].include?(state_id)
  490.  
  491.     return state_resist_KGC_PassiveSkill?(state_id)
  492.   end
  493.   #--------------------------------------------------------------------------
  494.   # ● 通常攻撃の属性取得
  495.   #--------------------------------------------------------------------------
  496.   alias element_set_KGC_PassiveSkill element_set unless $@
  497.   def element_set
  498.     return (element_set_KGC_PassiveSkill | passive_arrays[:attack_element])
  499.   end
  500.   #--------------------------------------------------------------------------
  501.   # ● 通常攻撃の追加効果 (ステート変化) 取得
  502.   #--------------------------------------------------------------------------
  503.   alias plus_state_set_KGC_PassiveSkill plus_state_set unless $@
  504.   def plus_state_set
  505.     return (plus_state_set_KGC_PassiveSkill | passive_arrays[:plus_state])
  506.   end
  507.   #--------------------------------------------------------------------------
  508.   # ● 基本 MaxHP の取得
  509.   #--------------------------------------------------------------------------
  510.   alias base_maxhp_KGC_PassiveSkill base_maxhp unless $@
  511.   def base_maxhp
  512.     n = base_maxhp_KGC_PassiveSkill + passive_params[:maxhp]
  513.     n = n * passive_params_rate[:maxhp] / 100
  514.     return n
  515.   end
  516.   #--------------------------------------------------------------------------
  517.   # ● 基本 MaxMP の取得
  518.   #--------------------------------------------------------------------------
  519.   alias base_maxmp_KGC_PassiveSkill base_maxmp unless $@
  520.   def base_maxmp
  521.     n = base_maxmp_KGC_PassiveSkill + passive_params[:maxmp]
  522.     n = n * passive_params_rate[:maxmp] / 100
  523.     return n
  524.   end
  525.   #--------------------------------------------------------------------------
  526.   # ● 基本攻撃力の取得
  527.   #--------------------------------------------------------------------------
  528.   alias base_atk_KGC_PassiveSkill base_atk unless $@
  529.   def base_atk
  530.     n = base_atk_KGC_PassiveSkill + passive_params[:atk]
  531.     n = n * passive_params_rate[:atk] / 100
  532.     return n
  533.   end
  534.   #--------------------------------------------------------------------------
  535.   # ● 基本防御力の取得
  536.   #--------------------------------------------------------------------------
  537.   alias base_def_KGC_PassiveSkill base_def unless $@
  538.   def base_def
  539.     n = base_def_KGC_PassiveSkill + passive_params[:def]
  540.     n = n * passive_params_rate[:def] / 100
  541.     return n
  542.   end
  543.   #--------------------------------------------------------------------------
  544.   # ● 基本精神力の取得
  545.   #--------------------------------------------------------------------------
  546.   alias base_spi_KGC_PassiveSkill base_spi unless $@
  547.   def base_spi
  548.     n = base_spi_KGC_PassiveSkill + passive_params[:spi]
  549.     n = n * passive_params_rate[:spi] / 100
  550.     return n
  551.   end
  552.   #--------------------------------------------------------------------------
  553.   # ● 基本敏捷性の取得
  554.   #--------------------------------------------------------------------------
  555.   alias base_agi_KGC_PassiveSkill base_agi unless $@
  556.   def base_agi
  557.     n = base_agi_KGC_PassiveSkill + passive_params[:agi]
  558.     n = n * passive_params_rate[:agi] / 100
  559.     return n
  560.   end
  561.   #--------------------------------------------------------------------------
  562.   # ● 命中率の取得
  563.   #--------------------------------------------------------------------------
  564.   alias hit_KGC_PassiveSkill hit unless $@
  565.   def hit
  566.     n = hit_KGC_PassiveSkill + passive_params[:hit]
  567.     n = n * passive_params_rate[:hit] / 100
  568.     return n
  569.   end
  570.   #--------------------------------------------------------------------------
  571.   # ● 回避率の取得
  572.   #--------------------------------------------------------------------------
  573.   alias eva_KGC_PassiveSkill eva unless $@
  574.   def eva
  575.     n = eva_KGC_PassiveSkill + passive_params[:eva]
  576.     n = n * passive_params_rate[:eva] / 100
  577.     return n
  578.   end
  579.   #--------------------------------------------------------------------------
  580.   # ● クリティカル率の取得
  581.   #--------------------------------------------------------------------------
  582.   alias cri_KGC_PassiveSkill cri unless $@
  583.   def cri
  584.     n = cri_KGC_PassiveSkill + passive_params[:cri]
  585.     n = n * passive_params_rate[:cri] / 100
  586.     n += 4 if passive_effects[:critical_bonus]
  587.     return n
  588.   end
  589.   #--------------------------------------------------------------------------
  590.   # ● 狙われやすさの取得
  591.   #--------------------------------------------------------------------------
  592.   alias odds_KGC_PassiveSkill odds unless $@
  593.   def odds
  594.     n = odds_KGC_PassiveSkill + passive_params[:odds]
  595.     n = n * passive_params_rate[:odds] / 100
  596.     return n
  597.   end
  598.   #--------------------------------------------------------------------------
  599.   # ● オプション [二刀流] の取得
  600.   #--------------------------------------------------------------------------
  601.   alias two_swords_style_KGC_PassiveSkill two_swords_style unless $@
  602.   def two_swords_style
  603.     return @__one_time_two_swords_style if @__one_time_two_swords_style != nil
  604.  
  605.     return (two_swords_style_KGC_PassiveSkill ||
  606.       passive_effects[:two_swords_style])
  607.   end
  608.   #--------------------------------------------------------------------------
  609.   # ● オプション [自動戦闘] の取得
  610.   #--------------------------------------------------------------------------
  611.   alias auto_battle_KGC_PassiveSkill auto_battle unless $@
  612.   def auto_battle
  613.     return (auto_battle_KGC_PassiveSkill || passive_effects[:auto_battle])
  614.   end
  615.   #--------------------------------------------------------------------------
  616.   # ● オプション [強力防御] の取得
  617.   #--------------------------------------------------------------------------
  618.   alias super_guard_KGC_PassiveSkill super_guard unless $@
  619.   def super_guard
  620.     return (super_guard_KGC_PassiveSkill || passive_effects[:super_guard])
  621.   end
  622.   #--------------------------------------------------------------------------
  623.   # ● オプション [薬の知識] の取得
  624.   #--------------------------------------------------------------------------
  625.   alias pharmacology_KGC_PassiveSkill pharmacology unless $@
  626.   def pharmacology
  627.     return (pharmacology_KGC_PassiveSkill || passive_effects[:pharmacology])
  628.   end
  629.   #--------------------------------------------------------------------------
  630.   # ● 武器オプション [ターン内先制] の取得
  631.   #--------------------------------------------------------------------------
  632.   alias fast_attack_KGC_PassiveSkill fast_attack unless $@
  633.   def fast_attack
  634.     return (fast_attack_KGC_PassiveSkill || passive_effects[:fast_attack])
  635.   end
  636.   #--------------------------------------------------------------------------
  637.   # ● 武器オプション [連続攻撃] の取得
  638.   #--------------------------------------------------------------------------
  639.   alias dual_attack_KGC_PassiveSkill dual_attack unless $@
  640.   def dual_attack
  641.     if $imported["AddEquipmentOptions"]
  642.       # 2回攻撃以上なら無視
  643.       return false if passive_effects[:multi_attack_count] >= 2
  644.     end
  645.  
  646.     return (dual_attack_KGC_PassiveSkill || passive_effects[:dual_attack])
  647.   end
  648.   #--------------------------------------------------------------------------
  649.   # ● 防具オプション [クリティカル防止] の取得
  650.   #--------------------------------------------------------------------------
  651.   alias prevent_critical_KGC_PassiveSkill prevent_critical unless $@
  652.   def prevent_critical
  653.     return (prevent_critical_KGC_PassiveSkill ||
  654.       passive_effects[:prevent_critical])
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # ● 防具オプション [消費 MP 半分] の取得
  658.   #--------------------------------------------------------------------------
  659.   alias half_mp_cost_KGC_KGC_PassiveSkill half_mp_cost unless $@
  660.   def half_mp_cost
  661.     return (half_mp_cost_KGC_KGC_PassiveSkill ||
  662.       passive_effects[:half_mp_cost])
  663.   end
  664.   #--------------------------------------------------------------------------
  665.   # ● 防具オプション [取得経験値 2 倍] の取得
  666.   #--------------------------------------------------------------------------
  667.   alias double_exp_gain_KGC_PassiveSkill double_exp_gain unless $@
  668.   def double_exp_gain
  669.     return (double_exp_gain_KGC_PassiveSkill ||
  670.       passive_effects[:double_exp_gain])
  671.   end
  672.   #--------------------------------------------------------------------------
  673.   # ● スキルを覚える
  674.   #     skill_id : スキル ID
  675.   #--------------------------------------------------------------------------
  676.   alias learn_skill_KGC_PassiveSkill learn_skill unless $@
  677.   def learn_skill(skill_id)
  678.     learn_skill_KGC_PassiveSkill(skill_id)
  679.  
  680.     restore_passive_rev
  681.   end
  682.   #--------------------------------------------------------------------------
  683.   # ● スキルを忘れる
  684.   #     skill_id : スキル ID
  685.   #--------------------------------------------------------------------------
  686.   alias forget_skill_KGC_PassiveSkill forget_skill unless $@
  687.   def forget_skill(skill_id)
  688.     forget_skill_KGC_PassiveSkill(skill_id)
  689.  
  690.     restore_passive_rev
  691.   end
  692.  
  693. if $imported["ReproduceFunctions"]
  694.  
  695.   #--------------------------------------------------------------------------
  696.   # ○ オートステートの配列を取得
  697.   #     id_only : ID のみを取得
  698.   #--------------------------------------------------------------------------
  699.   alias auto_states_KGC_PassiveSkill auto_states unless $@
  700.   def auto_states(id_only = false)
  701.     result = auto_states_KGC_PassiveSkill(id_only)
  702.  
  703.     passive_arrays[:auto_state].each { |i|
  704.       result << (id_only ? i : $data_states[i])
  705.     }
  706.     result.uniq!
  707.     return result
  708.   end
  709.   #--------------------------------------------------------------------------
  710.   # ○ 装備オプション [全体攻撃] の取得
  711.   #--------------------------------------------------------------------------
  712.   alias whole_attack_KGC_PassiveSkill whole_attack unless $@
  713.   def whole_attack
  714.     return (whole_attack_KGC_PassiveSkill || passive_effects[:whole_attack])
  715.   end
  716.   #--------------------------------------------------------------------------
  717.   # ○ 装備オプション [回避無視] の取得
  718.   #--------------------------------------------------------------------------
  719.   alias ignore_eva_KGC_PassiveSkill ignore_eva unless $@
  720.   def ignore_eva
  721.     return (ignore_eva_KGC_PassiveSkill || passive_effects[:ignore_eva])
  722.   end
  723.  
  724. end  # <-- if $imported["ReproduceFunctions"]
  725.  
  726. if $imported["AddEquipmentOptions"]
  727.  
  728.   #--------------------------------------------------------------------------
  729.   # ○ 攻撃回数の取得
  730.   #--------------------------------------------------------------------------
  731.   alias multi_attack_count_KGC_PassiveSkill multi_attack_count unless $@
  732.   def multi_attack_count
  733.     n = multi_attack_count_KGC_PassiveSkill
  734.     return [ n, passive_effects[:multi_attack_count] ].max
  735.   end
  736.  
  737. end  # <-- if $imported["AddEquipmentOptions"]
  738.  
  739. end  # <-- class
  740.  
  741. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  742.  
  743. #==============================================================================
  744. # ■ Window_EquipItem
  745. #==============================================================================
  746.  
  747. class Window_EquipItem < Window_Item
  748.   #--------------------------------------------------------------------------
  749.   # ● オブジェクト初期化
  750.   #     x          : ウィンドウの X 座標
  751.   #     y          : ウィンドウの Y 座標
  752.   #     width      : ウィンドウの幅
  753.   #     height     : ウィンドウの高さ
  754.   #     actor      : アクター
  755.   #     equip_type : 装備部位 (0~4)
  756.   #--------------------------------------------------------------------------
  757.   alias initialize_KGC_PassiveSkill initialize unless $@
  758.   def initialize(x, y, width, height, actor, equip_type)
  759.     @original_equip_type = equip_type
  760.  
  761.     initialize_KGC_PassiveSkill(x, y, width, height, actor, equip_type)
  762.   end
  763.   #--------------------------------------------------------------------------
  764.   # ● リフレッシュ
  765.   #--------------------------------------------------------------------------
  766.   alias refresh_KGC_PassiveSkill refresh unless $@
  767.   def refresh
  768.     if @original_equip_type == 1
  769.       @equip_type = (@actor.two_swords_style ? 0 : 1)
  770.     end
  771.  
  772.     refresh_KGC_PassiveSkill
  773.   end
  774. end
  775.  
  776. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  777.  
  778. #==============================================================================
  779. # ■ Scene_File
  780. #==============================================================================
  781.  
  782. class Scene_File < Scene_Base
  783.   #--------------------------------------------------------------------------
  784.   # ● セーブデータの読み込み
  785.   #     file : 読み込み用ファイルオブジェクト (オープン済み)
  786.   #--------------------------------------------------------------------------
  787.   alias read_save_data_KGC_PassiveSkill read_save_data unless $@
  788.   def read_save_data(file)
  789.     read_save_data_KGC_PassiveSkill(file)
  790.  
  791.     KGC::Commands.restore_passive_rev
  792.     Graphics.frame_reset
  793.   end
  794. end
Advertisement
Add Comment
Please, Sign In to add comment