#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_ #_/ ◆ EXP & Gold Gain States - KGC_VariableExpGold ◆ #_/ ◇ Last Update: 2008/01/04 ◇ #_/ ◆ Translation by Mr. Anonymous ◆ #_/ ◆ http://ytomy.sakura.ne.jp/ ◆ #_/----------------------------------------------------------------------------- #_/ This script allows you to make an effect for states that can change the #_/ way gold and experience are aquired. #_/----------------------------------------------------------------------------- #_/ ◆ Instructions For Usage ◆ #_/ To make use of these functions, you must insert the desired tag into the #_/ desired state's "Notes" box located in the states tab of the database. #_/ #_/ #_/ Increase experience gained by a specified amount in percentage. #_/ (Ex. ) #_/ #_/ #_/ Increase experience gained by a specified amount in percentage. #_/ (Ex. ) #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_ #==============================================================================# # ★ Customization ★ # #==============================================================================# module KGC module VariableExpGold # ◆ State Overlap Processing # 0.Multiplication by all (AKA Stacking) 1.Highest Effect Priority REPEATED_STATE_TREAT = 0 end end #------------------------------------------------------------------------------# $imported = {} if $imported == nil $imported["VariableExpGold"] = true #============================================================================== # ■ RPG::State #============================================================================== class RPG::State #-------------------------------------------------------------------------- # ○ Experience Tag Tag #-------------------------------------------------------------------------- # Whatever word(s) are after the separator ( | ) in the following lines are # what are used to determine what is searched for in the "Notes" section of # a state. def exp_rate if @__exp_rate == nil # Cache @__exp_rate = 100 @note.split(/[\r\n]+/).each { |line| if line =~ /^<(?:EXP_RATE|exprate)[ ]*(\d+)(?:%|%)?>/i @__exp_rate = $1.to_i break end } end return @__exp_rate end #-------------------------------------------------------------------------- # ○ Gold Rate Tag #-------------------------------------------------------------------------- def gold_rate if @__gold_rate == nil @__gold_rate = 100 @note.split(/[\r\n]+/).each { |line| if line =~ /^<(?:GOLD_RATE|goldrate)[ ]*(\d+)(?:%|%)?>/i @__gold_rate = $1.to_i break end } end return @__gold_rate end end #============================================================================== # ■ Game_Troop #============================================================================== class Game_Troop < Game_Unit #-------------------------------------------------------------------------- # ● お金の合計計算 #-------------------------------------------------------------------------- alias gold_toral_KGC_VariableExpGold gold_total def gold_total gold = gold_toral_KGC_VariableExpGold # 戦闘中のみステート効果を適用 if $game_temp.in_battle $game_party.members.each { |actor| gold = gold * actor.gold_gain_rate / 100 } end return gold end end #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ #============================================================================== # ■ Game_Actor #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● 経験値の獲得 (経験値 2 倍のオプションを考慮) # exp : 経験値の増加量 # show : レベルアップ表示フラグ #-------------------------------------------------------------------------- alias gain_exp_KGC_VariableExpGold gain_exp def gain_exp(exp, show) exp = exp * exp_gain_rate / 100 gain_exp_KGC_VariableExpGold(exp, show) end #-------------------------------------------------------------------------- # ○ 獲得経験値の割合 #-------------------------------------------------------------------------- def exp_gain_rate n = 100 rate = [] states.each { |state| case KGC::VariableExpGold::REPEATED_STATE_TREAT when 0 # 全効果合計 n = n * state.exp_rate / 100 when 1 # 最良値選択 rate << state.exp_rate end } if rate.size > 0 n = rate.max end return n end #-------------------------------------------------------------------------- # ○ 獲得ゴールドの割合 #-------------------------------------------------------------------------- def gold_gain_rate n = 100 rate = [] states.each { |state| case KGC::VariableExpGold::REPEATED_STATE_TREAT when 0 # 全効果合計 n = n * state.gold_rate / 100 when 1 # 最良値選択 rate << state.gold_rate end } if rate.size > 0 n = rate.max end return n end end