|
| Auteur | Message |
---|
Xavioo Chevalier Mage (niveau 4)
Messages postés : 466 Date d'inscription : 24/12/2011 Jauge LPC :
| Sujet: Parameters Distributers Jeu 6 Sep 2012 - 2:53 | |
| Salut j'aimerais juste faire en sorte qu'au lieu d'avoir 3 points à chaque niveau, on en ai 1 ^^ Les Points sont des points qu'on gagne chaque niveau pour augementer les statistiques de notre personnage. Est-ce clair? Voilà c'est assez simple au final - Code:
-
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #_/ ◆ Attribute Point Stat Distribution2 - KGC_DistributeParameter2 ◆ VX ◆ #_/ ◇ Last update : 2009/09/26 ◇ #_/ ◆ Translated by Mr. Bubble ◆ #_/ ◆ KGC Site: ◆ #_/ ◆ http://ytomy.sakura.ne.jp/ ◆ #_/---------------------------------------------------------------------------- #_/ This script allows players to freely distribute their stats to actors #_/ with points gained when leveling up. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #_/ Before diving into customizing this script, it's important to understand #_/ the distinction between parameters points and actor stats. #_/ #_/ *Actor stats* are the default stats provided by VX. (HP, MP, ATK, DEF, #_/ SPI, AGI, etc...) These actor stats have a direct effect in battle. #_/ #_/ *Parameters* have the option of increasing actor stats per allocated point #_/ they are given. For example, the Parameter "Health" increases the actor #_/ stats HP and DEF per point. The Parameter "Magic" increases the actor #_/ stats MP and SPI per point. You can, of course, change what actor #_/ stats these default parameters raise. #_/ #_/ This the biggest different between KGC_DistributeParameter2 and the #_/ original KGC_DistributeParameter script. You can raise multiple #_/ actor stats with a single allocated point with DistributeParameter2. #_/ #_/ However, with the flexibility gained from this version, the user #_/ customization module is slightly more overwhelming to regular users. #_/ It's important that you read the comments and study the syntax for #_/ how to make and modify your own parameters. #_/----------------------------------------------------------------------------- #_/ ++ Script Commands ++ #_/ These commands are used in "Script" function in the third page of event #_/ commands under "Advanced". Do not include the asterisk. #_/ #_/ * gain_rp(ActorID, Value) #_/ Increases the MaxRP of a given actor. #_/ #_/ * reset_distributed_count(ActorID) #_/ Resets the distributed RP of a given actor. #_/ #_/ * call_distribute_parameter(ActorID) #_/ Calls the Distribute Parameter screen for a given actor.
#============================================================================== # + BEGIN - Customize + #==============================================================================
module KGC module DistributeParameter # ++ Default Parameter Growth Settings # This section lets you define the default parameters for player # stat distribution. # # { # <-- Each parameter starts with an opening curly bracket # :key => Key, # :name => "Name", # :limit => Maximum Parameter Limit (a number), # :cost => [Base RP Usage, RP Usage Adjustment], # :stat => [Stat Increase Value, Stat Increase Adjustment], # # You can add as many "stat" hashes within a single parameter # }, # <-- Each parameter ends with a closing curly bracket and comma # # Parameters are listed in the stat distribution scene in the order they # are defined in this script. # # Key - Parameter key for internal usage. Make sure it is unique. # Name - Name of the parameter. # Max Param Limit - Maximum number of points allowed for the parameter. # If set to 0, there is no parameter limit. # Base RP Usage - Base amount of RP required to increase the parameter. # Negative & floating point values are OK to use. # RP Usage Adjust - Increases the RP required after every point allocated. # Negative & floating point values are OK to use. # Stat Increase Value - Increases the :stat per point allocated. # Negative & floating point values are OK to use. # Stat Increase Adjust - Adjusts the Stat Increase Value per point allocated. # Negative & floating point values are OK to use. # If this value is omitted, it is defaulted to 0. # # :stat can be replaced with the following actor stats keys and most should # be self-explanatory: # :maxhp, :maxmp, :atk, :def, :spi, :agi, :hit, :eva, # :cri, :skill_speed, :item_speed, :odds # GAIN_PARAMETER = [ # <-- Do not delete or modify this line! # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { # <-- Each parameter starts with an opening curly bracket :key => :health, :name => "Point de Vie", :limit => 30, :cost => [ 1, 0.4], # Stats raised per RP :maxhp => [30, 2], # Increase MAX HP :def => [ 1, 0.25], # Increase DEF }, # <-- Each parameter ends with a closing curly bracket and comma # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :magic, :name => "Point de Magie", :limit => 30, :cost => [1, 0.4], # Stats raised per RP :maxmp => [5, 0.5], # Increase MAX MP :spi => [2, 0.5], # Increase SPI }, # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :pow, :name => "Force", :limit => 30, :cost => [1, 0.4], # Stats raised per RP :atk => [2, 0.5], # Increase ATK :def => [1, 0.25], # Increase DEF }, # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :dex, :name => "Dexterité", :limit => 30, :cost => [1, 0.4], # Stats raised per RP :agi => [2, 0.5], # Increase AGI :hit => [0.5], # Increase HIT :eva => [0.5], # Increase EVA }, # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :hit, :name => "Précision", :limit => 20, :cost => [1, 0.5], # Stats raised per RP :hit => [1], # Increase HIT }, # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :eva, :name => "Esquive", :limit => 20, :cost => [1, 0.5], # Stats raised per RP :eva => [1], # Increase EVA }, # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :crt, :name => "Critique", :limit => 20, :cost => [1, 0.7], # Stats raised per RP :cri => [1], # Increase CRI }, # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :chant, :name => "Rapidité de compétence", :limit => 0, :cost => [1, 0.5], # Stats raised per RP :skill_speed => [1], # Increase Skill Speed }, # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :item, :name => "Rapidité d'objet", :limit => 0, :cost => [1, 0.5], # Stats raised per RP :item_speed => [1], # Increase Item Speed }, # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :odds, :name => "Hostilité", :limit => 5, :cost => [1], :odds => [1], # Increase Odds (chance of getting targeted by enemies) }, # - - - - - - You may add more parameters within this section - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ] # <-- Do not delete or modify this line!
# ++ Actor-Specific Parameter Growth Settings PERSONAL_GAIN_PARAMETER = [] # Here, you can define the growth parameters based on class. # PERSONAL_GAIN_PARAMETER[ActorID] = [ Parameter Settings ] # Format is the same as specified in the GAIN_PARAMETER section. # The "Parameter Settings" is where you define growth paramaters # similarly to the GAIN_PARAMETER section. # If a parameter Key is not defined here, the default is used. # If a parameter has the same Key as one in GAIN_PARAMETER, the one # defined here will take precedence. # # Example: In this section, the parameter "Health" is uniquely defined for # actor ID 1. # - - - - - You may add class parameters within this section - - - - - - - PERSONAL_GAIN_PARAMETER[1] = [ { :key => :health, :name => "Health", :limit => 30, :cost => [ 1, 0.4], :maxhp => [50, 3], :def => [ 1, 0.3], },
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ] # <-- Do not delete or modify this line! # ++ Class-Specific Parameter Growth Settings CLASS_GAIN_PARAMETER = [] # Here, you can define the growth parameters based on class. # CLASS_GAIN_PARAMETER[ClassID] = [ Parameter Settings ] # Format is the same as specified in the GAIN_PARAMETER section. # ( Parameter Growth Settings Priority : Class > Actor > Default ) # - - - - - You may add class parameters within this section - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ++ RP (Reinforce Point) Vocab VOCAB_RP = "Ex" # ++ RP Abbreviation Vocab VOCAB_RP_A = "Ex"
# ++ MaxRP Formula Setting # level : Actor's current level # If the result is a floating point value, it is automatically rounded # to an integer. # Regular math symbols can be used ( +, -, *, / ). # "**" is an exponential symbol similar to "^". MAXRP_EXP = "(level ** 0.25 + 2.0) * level"
# ++ Parameter Name # KGC_ExtendedEquipScene has a higher priority for the definition # of these actor stat vocabulary. VOCAB_PARAM = { :hit => "Hit", # Hit :eva => "Evasion", # Evade :cri => "Critical", # Critical :skill_speed => "Skill Speed", # Skill Use Speed :item_speed => "Item Speed", # Item Use Speed :odds => "Emnity", # Odds of being targeted } # <-- Do not delete or modify this line!
# ++ Display Unlimited Distribution Symbol # true : Only show a number # false : Show dashes in place of max limit ( ##/--- ) HIDE_MAX_COUNT_INFINITE = false
# ++ Distribute Parameters Gauge Colors # ColorIndex : Window text index value (same as used with \C[n]) # Color : Can also be defined as Color.new(255, 128, 128) GAUGE_START_COLOR = 28 # Start color GAUGE_END_COLOR = 29 # End color
# ++ KGC_GenericGauge Settings # These gauge settings only apply when KGC_GenericGauge is installed # true : Use GenericGauge image # false : Do not use generic gauge image ENABLE_GENERIC_GAUGE = true # ++ Distribute Parameter Gauge Image Settings # Images must be placed in the Graphics/System folder in your project. GAUGE_IMAGE = "GaugeDist" # Gauge Image Filename GAUGE_OFFSET = [-23, -2] # Position Offset[x, y] GAUGE_LENGTH = -4 # Length Correction GAUGE_SLOPE = 30 # Gauge slope in degrees (-89 ~ 89)
# ++ Confirmation Window Command Names CONFIRM_COMMANDS = [ "Confirm", # Confirm Stat Distribution "Cancel", # Cancel Stat Distribution "Continue", # Continue Stat Distribution ] # <-- Do not delete or modify this line!
# ++ Confirmation Window Help Text CONFIRM_COMMAND_HELP = [ "Confirm current point distribution.", # Confirm Stat Distribution "Cancel current point distribution.", # Cancel Stat Distribution "Continue with point distribution.", # Continue Stat Distribution ] # <-- Do not delete or modify this line!
# ++ Distribute Parameter Confirmation Window Width CONFIRM_WIDTH = 128
# ++ Allow "Distribute Parameters" to Menu Command List # The Parameters command will appear the bottom of the menu. # If you want to move the menu command, use KGC_CustomMenuCommand # or any other custom menu script. USE_MENU_DISTRIBUTE_PARAMETER_COMMAND = true # ++ Distribute Parameters Menu Command Name VOCAB_MENU_DISTRIBUTE_PARAMETER = "Parameters"
# ++ Allow Parameter Redistribution # true : Allow free redistribution of parameters at any time. # false : Parameter points are locked after player confirmation. ENABLE_REVERSE_DISTRIBUTE = true end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
$imported = {} if $imported == nil $imported["distributeparameter"] = true
module KGC::DistributeParameter # 振り分け対象パラメータ PARAMS = [:maxhp, :maxmp, :atk, :def, :spi, :agi, :hit, :eva, :cri, :skill_speed, :item_speed, :odds]
# パラメータ増加量構造体 GainInfo = Struct.new(:key, :name, :limit, :cost, :cost_rev, :params) ParamInfo = Struct.new(:value, :value_rev)
# 振り分け情報構造体 DistInfo = Struct.new(:count, :hp, :mp)
#-------------------------------------------------------------------------- # ○ パラメータ増加量を構造体化 #-------------------------------------------------------------------------- def self.create_gain_param_structs(target) result = [] target.each { |v| info = GainInfo.new info.key = v[:key] info.name = v[:name] info.limit = v[:limit] info.cost = v[:cost][0] info.cost_rev = (v[:cost][1] == nil ? 0 : v[:cost][1]) info.params = {}
PARAMS.each { |param| next unless v.has_key?(param) pinfo = ParamInfo.new pinfo.value = v[param][0] pinfo.value_rev = (v[param][1] == nil ? 0 : v[param][1]) info.params[param] = pinfo } result << info } return result end #-------------------------------------------------------------------------- # ○ パラメータ増加量を構造体化 (固有増加量用) #-------------------------------------------------------------------------- def self.create_gain_param_structs_for_personal(target) result = [] target.each { |list| next if list == nil result << create_gain_param_structs(list) } return result end #-------------------------------------------------------------------------- # ○ パラメータ増加量を併合 #-------------------------------------------------------------------------- def self.merge(list1, list2) result = list1.clone list2.each { |info2| overwrite = false list1.each_with_index { |info1, i| if info1.key == info2.key result[i] = info2 overwrite = true break end } result << info2 unless overwrite } return result end
# パラメータ増加量を構造体化 GAIN_PARAMS = create_gain_param_structs(GAIN_PARAMETER) PERSONAL_GAIN_PARAMS = create_gain_param_structs_for_personal(PERSONAL_GAIN_PARAMETER) CLASS_GAIN_PARAMS = create_gain_param_structs_for_personal(CLASS_GAIN_PARAMETER) end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
|
| | | Xavioo Chevalier Mage (niveau 4)
Messages postés : 466 Date d'inscription : 24/12/2011 Jauge LPC :
| Sujet: Re: Parameters Distributers Jeu 6 Sep 2012 - 2:53 | |
| 2e partie du script: - Code:
-
#============================================================================== # ■ Vocab #==============================================================================
module Vocab # 命中率 def self.hit return KGC::DistributeParameter::VOCAB_PARAM[:hit] end
# 回避率 def self.eva return KGC::DistributeParameter::VOCAB_PARAM[:eva] end
# クリティカル率 def self.cri return KGC::DistributeParameter::VOCAB_PARAM[:cri] end
# スキル速度補正 def self.skill_speed return KGC::DistributeParameter::VOCAB_PARAM[:skill_speed] end
# アイテム速度補正 def self.item_speed return KGC::DistributeParameter::VOCAB_PARAM[:item_speed] end
# 狙われやすさ def self.odds return KGC::DistributeParameter::VOCAB_PARAM[:odds] end
# RP def self.rp return KGC::DistributeParameter::VOCAB_RP end
# RP (略) def self.rp_a return KGC::DistributeParameter::VOCAB_RP_A end
# パラメータ振り分け def self.distribute_parameter return KGC::DistributeParameter::VOCAB_MENU_DISTRIBUTE_PARAMETER end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # □ KGC::Commands #==============================================================================
module KGC module Commands module_function #-------------------------------------------------------------------------- # ○ パラメータ振り分けに関する値をチェック #-------------------------------------------------------------------------- def check_distribution_values (1...$data_actors.size).each { |i| actor = $game_actors[i] actor.check_distribution_values actor.restore_distribution_values } end #-------------------------------------------------------------------------- # ○ RP の増減 # actor_id : アクター ID # value : 増減量 #-------------------------------------------------------------------------- def gain_rp(actor_id, value) actor = $game_actors[actor_id] return if actor == nil actor.gain_rp(value) end #-------------------------------------------------------------------------- # ○ 振り分け回数をリセット # actor_id : アクター ID #-------------------------------------------------------------------------- def reset_distributed_count(actor_id) actor = $game_actors[actor_id] return if actor == nil actor.clear_distribution_values actor.restore_distribution_values end #-------------------------------------------------------------------------- # ○ パラメータ振り分け画面の呼び出し # actor_index : アクターインデックス #-------------------------------------------------------------------------- def call_distribute_parameter(actor_index = 0) return if $game_temp.in_battle $game_temp.next_scene = :distribute_parameter $game_temp.next_scene_actor_index = actor_index end end end
class Game_Interpreter include KGC::Commands end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # ■ Game_Battler #==============================================================================
class Game_Battler #-------------------------------------------------------------------------- # ● 能力値に加算する値をクリア #-------------------------------------------------------------------------- alias clear_extra_values_KGC_DistributeParameter clear_extra_values def clear_extra_values clear_extra_values_KGC_DistributeParameter
clear_distribution_values calc_distribution_values end #-------------------------------------------------------------------------- # ○ パラメータ振り分けに関する値をクリア #-------------------------------------------------------------------------- def clear_distribution_values @distributed_count = {} KGC::DistributeParameter::PARAMS.each { |param| @distributed_count[param] = 0 } end #-------------------------------------------------------------------------- # ○ パラメータ振り分けに関する値をチェック #-------------------------------------------------------------------------- def check_distribution_values last_distributed_count = @distributed_count
clear_distribution_values
@distributed_count = last_distributed_count if last_distributed_count != nil end #-------------------------------------------------------------------------- # ○ 各種修正値を計算 #-------------------------------------------------------------------------- def calc_distribution_values # 継承先で定義 end #-------------------------------------------------------------------------- # ○ 振り分けによる上昇値を取得 # param : パラメータの Symbol #-------------------------------------------------------------------------- def distributed_param(param) return 0 end #-------------------------------------------------------------------------- # ○ 振り分けに関する情報を取得 #-------------------------------------------------------------------------- def distribution_info info = KGC::DistributeParameter::DistInfo.new info.count = @distributed_count.clone info.hp = self.hp info.mp = self.mp return info end #-------------------------------------------------------------------------- # ○ 振り分けに関する情報を設定 #-------------------------------------------------------------------------- def set_distribution_info(info) return unless info.is_a?(KGC::DistributeParameter::DistInfo)
@distributed_count = info.count calc_distribution_values self.hp = info.hp self.mp = info.mp end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # ■ Game_BattleAction #==============================================================================
class Game_BattleAction #-------------------------------------------------------------------------- # ● 行動スピードの決定 #-------------------------------------------------------------------------- alias make_speed_KGC_DistributeParameter make_speed def make_speed make_speed_KGC_DistributeParameter
if skill? && skill.speed < 0 n = [battler.distributed_param(:skill_speed), skill.speed].min @speed -= n end if item? && item.speed < 0 n = [battler.distributed_param(:item_speed), item.speed].min @speed -= n end end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # ■ Game_Actor #==============================================================================
class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ○ クラス変数 #-------------------------------------------------------------------------- @@__distribute_gain_params = {} #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor_id : アクター ID #-------------------------------------------------------------------------- alias initialize_KGC_DistributeParameter initialize def initialize(actor_id) @actor_id = actor_id @class_id = $data_actors[actor_id].class_id
initialize_KGC_DistributeParameter(actor_id) end #-------------------------------------------------------------------------- # ○ パラメータ増加量一覧を取得 #-------------------------------------------------------------------------- def gain_parameter_list key = "#{self.id}_#{self.class_id}" unless @@__distribute_gain_params.has_key?(key) result = KGC::DistributeParameter::GAIN_PARAMS # アクター固有 list = KGC::DistributeParameter::PERSONAL_GAIN_PARAMS[self.id] result = KGC::DistributeParameter.merge(result, list) if list != nil # 職業固有 list = KGC::DistributeParameter::CLASS_GAIN_PARAMS[self.class_id] result = KGC::DistributeParameter.merge(result, list) if list != nil
@@__distribute_gain_params[key] = result end
return @@__distribute_gain_params[key] end #-------------------------------------------------------------------------- # ○ パラメータ増加量を取得 # key : 振り分けキー #-------------------------------------------------------------------------- def gain_parameter(key) return gain_parameter_list.find { |v| v.key == key } end #-------------------------------------------------------------------------- # ○ 各種修正値を計算 #-------------------------------------------------------------------------- def calc_distribution_values @rp_cost = 0 @distributed_param = {} KGC::DistributeParameter::PARAMS.each { |param| @distributed_param[param] = 0 }
gain_parameter_list.each { |gain| next if gain == nil cost = 0 distributed_count(gain.key).times { |i| cost += Integer(gain.cost + gain.cost_rev * i) gain.params.each { |param, v| @distributed_param[param] += v.value + v.value_rev * i } } @rp_cost += [cost, 0].max }
KGC::DistributeParameter::PARAMS.each { |param| @distributed_param[param] = Integer(@distributed_param[param]) } end #-------------------------------------------------------------------------- # ○ 各種修正値を修復 #-------------------------------------------------------------------------- def restore_distribution_values calc_distribution_values self.hp = self.hp self.mp = self.mp end #-------------------------------------------------------------------------- # ○ 振り分けによる上昇値を取得 # param : パラメータの Symbol #-------------------------------------------------------------------------- def distributed_param(param) return 0 if @distributed_param == nil return 0 if @distributed_param[param] == nil return @distributed_param[param] end #-------------------------------------------------------------------------- # ● 基本 MaxHP の取得 #-------------------------------------------------------------------------- alias base_maxhp_KGC_DistributeParameter base_maxhp def base_maxhp n = base_maxhp_KGC_DistributeParameter + distributed_param(:maxhp) return n end #-------------------------------------------------------------------------- # ● 基本 MaxMP の取得 #-------------------------------------------------------------------------- alias base_maxmp_KGC_DistributeParameter base_maxmp def base_maxmp n = base_maxmp_KGC_DistributeParameter + distributed_param(:maxmp) return n end #-------------------------------------------------------------------------- # ● 基本攻撃力の取得 #-------------------------------------------------------------------------- alias base_atk_KGC_DistributeParameter base_atk def base_atk n = base_atk_KGC_DistributeParameter + distributed_param(:atk) return n end #-------------------------------------------------------------------------- # ● 基本防御力の取得 #-------------------------------------------------------------------------- alias base_def_KGC_DistributeParameter base_def def base_def n = base_def_KGC_DistributeParameter + distributed_param(:def) return n end #-------------------------------------------------------------------------- # ● 基本精神力の取得 #-------------------------------------------------------------------------- alias base_spi_KGC_DistributeParameter base_spi def base_spi n = base_spi_KGC_DistributeParameter + distributed_param(:spi) return n end #-------------------------------------------------------------------------- # ● 基本敏捷性の取得 #-------------------------------------------------------------------------- alias base_agi_KGC_DistributeParameter base_agi def base_agi n = base_agi_KGC_DistributeParameter + distributed_param(:agi) return n end #-------------------------------------------------------------------------- # ● 命中率の取得 #-------------------------------------------------------------------------- alias hit_KGC_DistributeParameter hit def hit n = hit_KGC_DistributeParameter + distributed_param(:hit) return n end #-------------------------------------------------------------------------- # ● 回避率の取得 #-------------------------------------------------------------------------- alias eva_KGC_DistributeParameter eva def eva n = eva_KGC_DistributeParameter + distributed_param(:eva) return n end #-------------------------------------------------------------------------- # ● クリティカル率の取得 #-------------------------------------------------------------------------- alias cri_KGC_DistributeParameter cri def cri n = cri_KGC_DistributeParameter + distributed_param(:cri) return n end #-------------------------------------------------------------------------- # ● 狙われやすさの取得 #-------------------------------------------------------------------------- alias odds_KGC_DistributeParameter odds def odds n = odds_KGC_DistributeParameter + distributed_param(:odds) return n end #-------------------------------------------------------------------------- # ○ MaxRP の取得 #-------------------------------------------------------------------------- def maxrp n = Integer(eval(KGC::DistributeParameter::MAXRP_EXP)) return [n + maxrp_plus, 0].max end #-------------------------------------------------------------------------- # ○ MaxRP 補正値の取得 #-------------------------------------------------------------------------- def maxrp_plus @maxrp_plus = 0 if @maxrp_plus == nil return @maxrp_plus end #-------------------------------------------------------------------------- # ○ RP の取得 #-------------------------------------------------------------------------- def rp return [maxrp - @rp_cost, 0].max end #-------------------------------------------------------------------------- # ○ 振り分け回数の取得 # param : 振り分け先パラメータ (キー) #-------------------------------------------------------------------------- def distributed_count(param) clear_distribution_values if @distributed_count == nil @distributed_count[param] = 0 if @distributed_count[param] == nil return @distributed_count[param] end #-------------------------------------------------------------------------- # ○ RP の増減 # value : 増減量 #-------------------------------------------------------------------------- def gain_rp(value) @maxrp_plus = maxrp_plus + value end #-------------------------------------------------------------------------- # ○ 振り分け回数の増減 # param : 振り分け先パラメータ (キー) # value : 増減量 #-------------------------------------------------------------------------- def gain_distributed_count(param, value = 1) n = distributed_count(param) @distributed_count[param] += value if n.is_a?(Integer) end #-------------------------------------------------------------------------- # ○ RP 振り分けによる成長効果適用 # param : 振り分け先パラメータ (キー) # reverse : 逆加算のときは true #-------------------------------------------------------------------------- def rp_growth_effect(param, reverse = false) gain = gain_parameter(param) return if gain == nil # 無効なパラメータ
if reverse return if distributed_count(param) == 0 # 逆加算不可 else return unless can_distribute?(param) end
gain_distributed_count(param, reverse ? -1 : 1) restore_distribution_values end #-------------------------------------------------------------------------- # ○ パラメータ振り分け可否判定 # param : 振り分け先パラメータ (キー) #-------------------------------------------------------------------------- def can_distribute?(param) gain = gain_parameter(param) return false if gain == nil # 無効なパラメータ return false if self.rp < distribute_cost(param) # RP 不足 if gain.limit > 0 return false if gain.limit <= distributed_count(param) # 回数上限 end
return true end #-------------------------------------------------------------------------- # ○ パラメータ振り分けコスト計算 # param : 振り分け先パラメータ (キー) #-------------------------------------------------------------------------- def distribute_cost(param) gain = gain_parameter(param) return 0 if gain == nil # 無効なパラメータ
n = gain.cost count = distributed_count(param) count = [count, gain.limit - 1].min if gain.limit > 0 n += gain.cost_rev * count return [Integer(n), 0].max end #-------------------------------------------------------------------------- # ○ パラメータ振り分け後の増加量計算 # param : 振り分け先パラメータ (キー) # amt : 振り分け数 #-------------------------------------------------------------------------- def distribute_gain(param, amt = 1) gain = gain_parameter(param) # 無効なパラメータ return 0 if gain == nil
result = {} KGC::DistributeParameter::PARAMS.each { |par| result[par] = distributed_param(par) } # 振り分け不可 if amt > 0 return result if gain.limit > 0 && gain.limit == distributed_count(param) else return result if distributed_count(param) + amt < 0 end
last_hp = self.hp last_mp = self.mp last_count = distributed_count(param) rp_growth_effect(param) KGC::DistributeParameter::PARAMS.each { |par| result[par] = distributed_param(par) if gain.params.include?(par) } rp_growth_effect(param, true) if last_count < distributed_count(param) self.hp = last_hp self.mp = last_mp
return result end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # ■ Window_Base #==============================================================================
class Window_Base < Window #-------------------------------------------------------------------------- # ○ RP の文字色を取得 # actor : アクター #-------------------------------------------------------------------------- def rp_color(actor) return (actor.rp == 0 ? knockout_color : normal_color) end #-------------------------------------------------------------------------- # ○ 振り分けゲージの色 1 の取得 #-------------------------------------------------------------------------- def distribute_gauge_color1 color = KGC::DistributeParameter::GAUGE_START_COLOR return (color.is_a?(Integer) ? text_color(color) : color) end #-------------------------------------------------------------------------- # ○ 振り分けゲージの色 2 の取得 #-------------------------------------------------------------------------- def distribute_gauge_color2 color = KGC::DistributeParameter::GAUGE_END_COLOR return (color.is_a?(Integer) ? text_color(color) : color) end #-------------------------------------------------------------------------- # ○ RP の描画 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 # width : 幅 #-------------------------------------------------------------------------- def draw_actor_rp(actor, x, y, width = 120) self.contents.font.color = system_color self.contents.draw_text(x, y, 40, WLH, Vocab::rp_a) self.contents.font.color = rp_color(actor) xr = x + width if width < 120 self.contents.draw_text(xr - 40, y, 40, WLH, actor.rp, 2) else self.contents.draw_text(xr - 90, y, 40, WLH, actor.rp, 2) self.contents.font.color = normal_color self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2) self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxrp, 2) end self.contents.font.color = normal_color end #-------------------------------------------------------------------------- # ○ 振り分けゲージの描画 # actor : アクター # param : パラメータ # x : 描画先 X 座標 # y : 描画先 Y 座標 # width : 幅 #-------------------------------------------------------------------------- def draw_actor_distribute_gauge(actor, param, x, y, width = 120) gain = actor.gain_parameter(param) return if gain == nil || gain.limit <= 0
if KGC::DistributeParameter::ENABLE_GENERIC_GAUGE && $imported["GenericGauge"] # 汎用ゲージ draw_gauge(KGC::DistributeParameter::GAUGE_IMAGE, x, y, width, actor.distributed_count(param), gain.limit, KGC::DistributeParameter::GAUGE_OFFSET, KGC::DistributeParameter::GAUGE_LENGTH, KGC::DistributeParameter::GAUGE_SLOPE) else # デフォルトゲージ gw = width * actor.distributed_count(param) / gain.limit gc1 = distribute_gauge_color1 gc2 = distribute_gauge_color2 self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color) self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2) end end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # ■ Window_Command #==============================================================================
class Window_Command < Window_Selectable unless method_defined?(:add_command) #-------------------------------------------------------------------------- # ○ コマンドを追加 # 追加した位置を返す #-------------------------------------------------------------------------- def add_command(command) @commands << command @item_max = @commands.size item_index = @item_max - 1 refresh_command draw_item(item_index) return item_index end #-------------------------------------------------------------------------- # ○ コマンドをリフレッシュ #-------------------------------------------------------------------------- def refresh_command buf = self.contents.clone self.height = [self.height, row_max * WLH + 32].max create_contents self.contents.blt(0, 0, buf, buf.rect) buf.dispose end #-------------------------------------------------------------------------- # ○ コマンドを挿入 #-------------------------------------------------------------------------- def insert_command(index, command) @commands.insert(index, command) @item_max = @commands.size refresh_command refresh end #-------------------------------------------------------------------------- # ○ コマンドを削除 #-------------------------------------------------------------------------- def remove_command(command) @commands.delete(command) @item_max = @commands.size refresh end end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # □ Window_DistributeParameterActor #------------------------------------------------------------------------------ # 振り分け画面で、アクターの情報を表示するウィンドウです。 #==============================================================================
class Window_DistributeParameterActor < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y, actor) super(x, y, Graphics.width, WLH + 32) @actor = actor refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear draw_actor_name(@actor, 4, 0) draw_actor_level(@actor, 140, 0) draw_actor_rp(@actor, 240, 0) end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # □ Window_DistributeParameterList #------------------------------------------------------------------------------ # 振り分け画面で、成長させるパラメータを選択するウィンドウです。 #==============================================================================
class Window_DistributeParameterList < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor : アクター #-------------------------------------------------------------------------- def initialize(actor) off_h = WLH + 32 super(0, off_h, 286, Graphics.height - off_h) @actor = actor refresh self.index = 0 end #-------------------------------------------------------------------------- # ○ 選択中のパラメータの Symbol を取得 #-------------------------------------------------------------------------- def parameter_key return @data[self.index] end #-------------------------------------------------------------------------- # ● 1 ページに表示できる行数の取得 #-------------------------------------------------------------------------- def page_row_max return super - 1 end #-------------------------------------------------------------------------- # ● 項目を描画する矩形の取得 # index : 項目番号 #-------------------------------------------------------------------------- def item_rect(index) rect = super(index) rect.y += WLH return rect end #-------------------------------------------------------------------------- # ● カーソルを 1 ページ後ろに移動 #-------------------------------------------------------------------------- def cursor_pagedown return if Input.repeat?(Input::R) super end #-------------------------------------------------------------------------- # ● カーソルを 1 ページ前に移動 #-------------------------------------------------------------------------- def cursor_pageup return if Input.repeat?(Input::L) super end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh @gain_list = @actor.gain_parameter_list @data = [] @gain_list.each { |gain| @data << gain.key } @item_max = @data.size + 1 create_contents @item_max -= 1 draw_caption @item_max.times { |i| draw_item(i, @actor.can_distribute?(@data[i])) } end #-------------------------------------------------------------------------- # ○ 見出しの描画 #-------------------------------------------------------------------------- def draw_caption self.contents.font.color = system_color self.contents.draw_text( 4, 0, 96, WLH, "Parameters") self.contents.draw_text(120, 0, 40, WLH, Vocab.rp, 2) self.contents.draw_text(170, 0, 80, WLH, "Points", 2) self.contents.font.color = normal_color end #-------------------------------------------------------------------------- # ○ 項目の描画 # index : 項目番号 # enabled : 有効フラグ #-------------------------------------------------------------------------- def draw_item(index, enabled = true) rect = item_rect(index) self.contents.clear_rect(rect) item = @data[index] if item != nil draw_parameter(rect.x, rect.y, @data[index], enabled) end end #-------------------------------------------------------------------------- # ○ 能力値の描画 # x : 描画先 X 座標 # y : 描画先 Y 座標 # param : 振り分け先 # enabled : 有効フラグ #-------------------------------------------------------------------------- def draw_parameter(x, y, param, enabled) gain = @gain_list.find { |v| v.key == param } return if gain == nil
self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x + 4, y, 96, WLH, gain.name)
value = @actor.distribute_cost(param) self.contents.draw_text(x + 120, y, 40, WLH, value, 2) if gain.limit > 0 value = sprintf("%3d/%3d", @actor.distributed_count(param), gain.limit) else value = sprintf("%3d%s", @actor.distributed_count(param), KGC::DistributeParameter::HIDE_MAX_COUNT_INFINITE ? "" : "/---") end draw_actor_distribute_gauge(@actor, param, x + 170, y, 80) self.contents.draw_text(x + 170, y, 80, WLH, value, 2) self.contents.font.color = normal_color end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # □ Window_DistributeParameterStatus #------------------------------------------------------------------------------ # 振り分け画面で、アクターのステータスを表示するウィンドウです。 #==============================================================================
class Window_DistributeParameterStatus < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor : アクター #-------------------------------------------------------------------------- def initialize(actor) dx = 286 off_h = WLH + 32 super(dx, off_h, Graphics.width - dx, Graphics.height - off_h) @actor = actor refresh(actor.gain_parameter_list[0].key) end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh(param = nil) @distribute_gain = nil if param != nil @distribute_gain = @actor.distribute_gain(param) end
self.contents.clear self.contents.font.color = system_color self.contents.draw_text(0, 0, width - 32, WLH, "Stat Changes", 1) self.contents.font.color = normal_color dy = WLH KGC::DistributeParameter::PARAMS.each { |param| draw_parameter(0, dy, param) dy += WLH } end #-------------------------------------------------------------------------- # ○ 能力値の描画 # x : 描画先 X 座標 # y : 描画先 Y 座標 # type : 能力値の種類 #-------------------------------------------------------------------------- def draw_parameter(x, y, type) case type when :maxhp name = Vocab.hp value = @actor.maxhp when :maxmp name = Vocab.mp value = @actor.maxmp when :atk name = Vocab.atk value = @actor.atk when :def name = Vocab.def value = @actor.def when :spi name = Vocab.spi value = @actor.spi when :agi name = Vocab.agi value = @actor.agi when :hit name = Vocab.hit value = @actor.hit when :eva name = Vocab.eva value = @actor.eva when :cri name = Vocab.cri value = @actor.cri when :skill_speed name = Vocab.skill_speed value = @actor.distributed_param(type) when :item_speed name = Vocab.item_speed value = @actor.distributed_param(type) when :odds name = Vocab.odds value = @actor.odds else return end self.contents.font.color = system_color self.contents.draw_text(x + 4, y, 96, WLH, name) self.contents.font.color = normal_color self.contents.draw_text(x + 106, y, 48, WLH, value, 2) return if @distribute_gain == nil
self.contents.draw_text(x + 154, y, 16, WLH, ">", 1)
curr = @actor.distributed_param(type) gain = @distribute_gain[type] self.contents.font.color = (gain > curr ? text_color(3) : gain < curr ? text_color(2) : normal_color) self.contents.draw_text(x + 174, y, 48, WLH, value + (gain - curr), 2)
self.contents.font.color = normal_color end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # ■ Scene_Map #==============================================================================
class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # ● 画面切り替えの実行 #-------------------------------------------------------------------------- alias update_scene_change_KGC_DistributeParameter update_scene_change def update_scene_change return if $game_player.moving? # プレイヤーの移動中?
if $game_temp.next_scene == :distribute_parameter call_distribute_parameter return end
update_scene_change_KGC_DistributeParameter end #-------------------------------------------------------------------------- # ○ パラメータ振り分け画面への切り替え #-------------------------------------------------------------------------- def call_distribute_parameter $game_temp.next_scene = nil $scene = Scene_DistributeParameter.new( $game_temp.next_scene_actor_index, 0, Scene_DistributeParameter::HOST_MAP) end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # ■ Scene_Menu #==============================================================================
class Scene_Menu < Scene_Base if KGC::DistributeParameter::USE_MENU_DISTRIBUTE_PARAMETER_COMMAND #-------------------------------------------------------------------------- # ● コマンドウィンドウの作成 #-------------------------------------------------------------------------- alias create_command_window_KGC_DistributeParameter create_command_window def create_command_window create_command_window_KGC_DistributeParameter
return if $imported["CustomMenuCommand"]
@__command_distribute_parameter_index = @command_window.add_command(Vocab.distribute_parameter) if @command_window.oy > 0 @command_window.oy -= Window_Base::WLH end @command_window.index = @menu_index end end #-------------------------------------------------------------------------- # ● コマンド選択の更新 #-------------------------------------------------------------------------- alias update_command_selection_KGC_DistributeParameter update_command_selection def update_command_selection call_distribute_parameter_flag = false if Input.trigger?(Input::C) case @command_window.index when @__command_distribute_parameter_index # パラメータ振り分け call_distribute_parameter_flag = true end end
# パラメータ振り分け画面に移行 if call_distribute_parameter_flag if $game_party.members.size == 0 Sound.play_buzzer return end Sound.play_decision start_actor_selection return end
update_command_selection_KGC_DistributeParameter end #-------------------------------------------------------------------------- # ● アクター選択の更新 #-------------------------------------------------------------------------- alias update_actor_selection_KGC_DistributeParameter update_actor_selection def update_actor_selection if Input.trigger?(Input::C) $game_party.last_actor_index = @status_window.index Sound.play_decision case @command_window.index when @__command_distribute_parameter_index # パラメータ振り分け $scene = Scene_DistributeParameter.new( @status_window.index, @__command_distribute_parameter_index, Scene_DistributeParameter::HOST_MENU) return end end
update_actor_selection_KGC_DistributeParameter end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # □ Scene_DistributeParameter #------------------------------------------------------------------------------ # パラメータ振り分け画面の処理を行うクラスです。 #==============================================================================
class Scene_DistributeParameter < Scene_Base #-------------------------------------------------------------------------- # ○ 定数 #-------------------------------------------------------------------------- HOST_MENU = 0 # 呼び出し元 : メニュー HOST_MAP = 1 # 呼び出し元 : マップ #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor_index : アクターインデックス # menu_index : コマンドのカーソル初期位置 # host_scene : 呼び出し元 (0..メニュー 1..マップ) #-------------------------------------------------------------------------- def initialize(actor_index = 0, menu_index = 0, host_scene = HOST_MENU) @actor_index = actor_index @menu_index = menu_index @host_scene = host_scene end #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super create_menu_background
@actor = $game_party.members[@actor_index] @prev_info = @actor.distribution_info create_windows end #-------------------------------------------------------------------------- # ○ ウィンドウ作成 #-------------------------------------------------------------------------- def create_windows @actor_window = Window_DistributeParameterActor.new(0, 0, @actor) @parameter_window = Window_DistributeParameterList.new(@actor) @status_window = Window_DistributeParameterStatus.new(@actor)
@confirm_help_window = Window_Help.new @confirm_help_window.z = @status_window.z + 100 @confirm_help_window.openness = 0
@confirm_window = Window_Command.new( KGC::DistributeParameter::CONFIRM_WIDTH, KGC::DistributeParameter::CONFIRM_COMMANDS) @confirm_window.x = (Graphics.width - @confirm_window.width) / 2 @confirm_window.y = (Graphics.height - @confirm_window.height) / 2 @confirm_window.z = @confirm_help_window.z @confirm_window.active = false @confirm_window.openness = 0 end #-------------------------------------------------------------------------- # ● 終了処理 #-------------------------------------------------------------------------- def terminate super dispose_menu_background @actor_window.dispose @parameter_window.dispose @status_window.dispose @confirm_help_window.dispose @confirm_window.dispose end #-------------------------------------------------------------------------- # ○ 元の画面へ戻る #-------------------------------------------------------------------------- def return_scene case @host_scene when HOST_MENU $scene = Scene_Menu.new(@menu_index) when HOST_MAP $scene = Scene_Map.new end end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super update_menu_background update_window if @parameter_window.active update_parameter_list elsif @confirm_window.active update_confirm_command end end #-------------------------------------------------------------------------- # ○ ウィンドウ更新 #-------------------------------------------------------------------------- def update_window @actor_window.update @parameter_window.update @status_window.update @confirm_help_window.update @confirm_window.update end #-------------------------------------------------------------------------- # ○ ウィンドウ再描画 #-------------------------------------------------------------------------- def refresh_window @actor_window.refresh @parameter_window.refresh @status_window.refresh(@parameter_window.parameter_key) Graphics.frame_reset end #-------------------------------------------------------------------------- # ○ 次のアクターの画面に切り替え #-------------------------------------------------------------------------- def next_actor @actor_index += 1 @actor_index %= $game_party.members.size $scene = Scene_DistributeParameter.new(@actor_index, @menu_index, @host_scene) end #-------------------------------------------------------------------------- # ○ 前のアクターの画面に切り替え #-------------------------------------------------------------------------- def prev_actor @actor_index += $game_party.members.size - 1 @actor_index %= $game_party.members.size $scene = Scene_DistributeParameter.new(@actor_index, @menu_index, @host_scene) end #-------------------------------------------------------------------------- # ○ フレーム更新 (パラメータウィンドウがアクティブの場合) #-------------------------------------------------------------------------- def update_parameter_list if @last_index != @parameter_window.index @status_window.refresh(@parameter_window.parameter_key) @last_index = @parameter_window.index end
if Input.trigger?(Input::B) Sound.play_cancel activate_confirm_window elsif Input.trigger?(Input::C) Sound.play_decision activate_confirm_window elsif Input.repeat?(Input::RIGHT) # 加算 param = @parameter_window.parameter_key unless @actor.can_distribute?(param) Sound.play_buzzer return end Sound.play_cursor @actor.rp_growth_effect(param) refresh_window elsif Input.repeat?(Input::LEFT) # 減算 param = @parameter_window.parameter_key unless reversible?(param) Sound.play_buzzer return end Sound.play_cursor @actor.rp_growth_effect(param, true) refresh_window elsif Input.trigger?(Input::R) Sound.play_cursor next_actor elsif Input.trigger?(Input::L) Sound.play_cursor prev_actor end end #-------------------------------------------------------------------------- # ○ 減算可否判定 # param : 対象パラメータ #-------------------------------------------------------------------------- def reversible?(param) return false if @actor.distributed_count(param) == 0 return true if KGC::DistributeParameter::ENABLE_REVERSE_DISTRIBUTE
base = @prev_info.count[param] return ( base < @actor.distributed_count(param) ) end #-------------------------------------------------------------------------- # ○ 確認ウィンドウに切り替え #-------------------------------------------------------------------------- def activate_confirm_window @last_index = -1 @status_window.refresh @confirm_window.index = 0 @confirm_window.active = true @confirm_window.open @confirm_help_window.open @parameter_window.active = false @last_confirm_index = -1 end #-------------------------------------------------------------------------- # ○ フレーム更新 (確認ウィンドウがアクティブの場合) #-------------------------------------------------------------------------- def update_confirm_command if @last_confirm_index != @confirm_window.index @confirm_help_window.set_text( KGC::DistributeParameter::CONFIRM_COMMAND_HELP[@confirm_window.index]) @last_confirm_index = @confirm_window.index end
if Input.trigger?(Input::B) Sound.play_cancel # パラメータウィンドウに切り替え @confirm_window.active = false @confirm_window.close @confirm_help_window.close @parameter_window.active = true elsif Input.trigger?(Input::C) Sound.play_decision case @confirm_window.index when 0 # 確定 return_scene when 1 # 中止 @actor.set_distribution_info(@prev_info) return_scene when 2 # キャンセル # パラメータウィンドウに切り替え @confirm_window.active = false @confirm_window.close @confirm_help_window.close @parameter_window.active = true end end end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#============================================================================== # ■ Scene_File #==============================================================================
class Scene_File < Scene_Base #-------------------------------------------------------------------------- # ● セーブデータの読み込み # file : 読み込み用ファイルオブジェクト (オープン済み) #-------------------------------------------------------------------------- alias read_save_data_KGC_DistributeParameter read_save_data def read_save_data(file) read_save_data_KGC_DistributeParameter(file)
KGC::Commands.check_distribution_values Graphics.frame_reset end end |
| | | Jin Ancien staffeux
Messages postés : 8557 Date d'inscription : 08/12/2010 Jauge LPC :
| Sujet: Re: Parameters Distributers Jeu 6 Sep 2012 - 15:11 | |
| Essaie ca. C'est le 2eme code. - Spoiler:
- Code:
-
#============================================================================== # ¦ Vocab #==============================================================================
module Vocab # ??? def self.hit return KGC::DistributeParameter::VOCAB_PARAM[:hit] end
# ??? def self.eva return KGC::DistributeParameter::VOCAB_PARAM[:eva] end
# ??????? def self.cri return KGC::DistributeParameter::VOCAB_PARAM[:cri] end
# ??????? def self.skill_speed return KGC::DistributeParameter::VOCAB_PARAM[:skill_speed] end
# ???????? def self.item_speed return KGC::DistributeParameter::VOCAB_PARAM[:item_speed] end
# ?????? def self.odds return KGC::DistributeParameter::VOCAB_PARAM[:odds] end
# RP def self.rp return KGC::DistributeParameter::VOCAB_RP end
# RP (?) def self.rp_a return KGC::DistributeParameter::VOCAB_RP_A end
# ????????? def self.distribute_parameter return KGC::DistributeParameter::VOCAB_MENU_DISTRIBUTE_PARAMETER end end
#???????????????????????????????????????
#============================================================================== # ? KGC::Commands #==============================================================================
module KGC module Commands module_function #-------------------------------------------------------------------------- # ? ??????????????????? #-------------------------------------------------------------------------- def check_distribution_values (1...$data_actors.size).each { |i| actor = $game_actors[i] actor.check_distribution_values actor.restore_distribution_values } end #-------------------------------------------------------------------------- # ? RP ??? # actor_id : ???? ID # value : ??? #-------------------------------------------------------------------------- def gain_rp(actor_id, value) actor = $game_actors[actor_id] return if actor == nil actor.gain_rp(value) end #-------------------------------------------------------------------------- # ? ??????????? # actor_id : ???? ID #-------------------------------------------------------------------------- def reset_distributed_count(actor_id) actor = $game_actors[actor_id] return if actor == nil actor.clear_distribution_values actor.restore_distribution_values end #-------------------------------------------------------------------------- # ? ???????????????? # actor_index : ?????????? #-------------------------------------------------------------------------- def call_distribute_parameter(actor_index = 0) return if $game_temp.in_battle $game_temp.next_scene = :distribute_parameter $game_temp.next_scene_actor_index = actor_index end end end
class Game_Interpreter include KGC::Commands end
#???????????????????????????????????????
#============================================================================== # ¦ Game_Battler #==============================================================================
class Game_Battler #-------------------------------------------------------------------------- # ? ????????????? #-------------------------------------------------------------------------- alias clear_extra_values_KGC_DistributeParameter clear_extra_values def clear_extra_values clear_extra_values_KGC_DistributeParameter
clear_distribution_values calc_distribution_values end #-------------------------------------------------------------------------- # ? ?????????????????? #-------------------------------------------------------------------------- def clear_distribution_values @distributed_count = {} KGC::DistributeParameter::PARAMS.each { |param| @distributed_count[param] = 0 } end #-------------------------------------------------------------------------- # ? ??????????????????? #-------------------------------------------------------------------------- def check_distribution_values last_distributed_count = @distributed_count
clear_distribution_values
@distributed_count = last_distributed_count if last_distributed_count != nil end #-------------------------------------------------------------------------- # ? ???????? #-------------------------------------------------------------------------- def calc_distribution_values # ?????? end #-------------------------------------------------------------------------- # ? ????????????? # param : ?????? Symbol #-------------------------------------------------------------------------- def distributed_param(param) return 0 end #-------------------------------------------------------------------------- # ? ????????????? #-------------------------------------------------------------------------- def distribution_info info = KGC::DistributeParameter::DistInfo.new info.count = @distributed_count.clone info.hp = self.hp info.mp = self.mp return info end #-------------------------------------------------------------------------- # ? ????????????? #-------------------------------------------------------------------------- def set_distribution_info(info) return unless info.is_a?(KGC::DistributeParameter::DistInfo)
@distributed_count = info.count calc_distribution_values self.hp = info.hp self.mp = info.mp end end
#???????????????????????????????????????
#============================================================================== # ¦ Game_BattleAction #==============================================================================
class Game_BattleAction #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- alias make_speed_KGC_DistributeParameter make_speed def make_speed make_speed_KGC_DistributeParameter
if skill? && skill.speed < 0 n = [battler.distributed_param(:skill_speed), skill.speed].min @speed -= n end if item? && item.speed < 0 n = [battler.distributed_param(:item_speed), item.speed].min @speed -= n end end end
#???????????????????????????????????????
#============================================================================== # ¦ Game_Actor #==============================================================================
class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ? ????? #-------------------------------------------------------------------------- @@__distribute_gain_params = {} #-------------------------------------------------------------------------- # ? ????????? # actor_id : ???? ID #-------------------------------------------------------------------------- alias initialize_KGC_DistributeParameter initialize def initialize(actor_id) @actor_id = actor_id @class_id = $data_actors[actor_id].class_id
initialize_KGC_DistributeParameter(actor_id) end #-------------------------------------------------------------------------- # ? ????????????? #-------------------------------------------------------------------------- def gain_parameter_list key = "#{self.id}_#{self.class_id}" unless @@__distribute_gain_params.has_key?(key) result = KGC::DistributeParameter::GAIN_PARAMS # ?????? list = KGC::DistributeParameter::PERSONAL_GAIN_PARAMS[self.id] result = KGC::DistributeParameter.merge(result, list) if list != nil # ???? list = KGC::DistributeParameter::CLASS_GAIN_PARAMS[self.class_id] result = KGC::DistributeParameter.merge(result, list) if list != nil
@@__distribute_gain_params[key] = result end
return @@__distribute_gain_params[key] end #-------------------------------------------------------------------------- # ? ??????????? # key : ?????? #-------------------------------------------------------------------------- def gain_parameter(key) return gain_parameter_list.find { |v| v.key == key } end #-------------------------------------------------------------------------- # ? ???????? #-------------------------------------------------------------------------- def calc_distribution_values @rp_cost = 0 @distributed_param = {} KGC::DistributeParameter::PARAMS.each { |param| @distributed_param[param] = 0 }
gain_parameter_list.each { |gain| next if gain == nil cost = 0 distributed_count(gain.key).times { |i| cost += Integer(gain.cost + gain.cost_rev * i) gain.params.each { |param, v| @distributed_param[param] += v.value + v.value_rev * i } } @rp_cost += [cost, 0].max }
KGC::DistributeParameter::PARAMS.each { |param| @distributed_param[param] = Integer(@distributed_param[param]) } end #-------------------------------------------------------------------------- # ? ???????? #-------------------------------------------------------------------------- def restore_distribution_values calc_distribution_values self.hp = self.hp self.mp = self.mp end #-------------------------------------------------------------------------- # ? ????????????? # param : ?????? Symbol #-------------------------------------------------------------------------- def distributed_param(param) return 0 if @distributed_param == nil return 0 if @distributed_param[param] == nil return @distributed_param[param] end #-------------------------------------------------------------------------- # ? ?? MaxHP ??? #-------------------------------------------------------------------------- alias base_maxhp_KGC_DistributeParameter base_maxhp def base_maxhp n = base_maxhp_KGC_DistributeParameter + distributed_param(:maxhp) return n end #-------------------------------------------------------------------------- # ? ?? MaxMP ??? #-------------------------------------------------------------------------- alias base_maxmp_KGC_DistributeParameter base_maxmp def base_maxmp n = base_maxmp_KGC_DistributeParameter + distributed_param(:maxmp) return n end #-------------------------------------------------------------------------- # ? ???????? #-------------------------------------------------------------------------- alias base_atk_KGC_DistributeParameter base_atk def base_atk n = base_atk_KGC_DistributeParameter + distributed_param(:atk) return n end #-------------------------------------------------------------------------- # ? ???????? #-------------------------------------------------------------------------- alias base_def_KGC_DistributeParameter base_def def base_def n = base_def_KGC_DistributeParameter + distributed_param(:def) return n end #-------------------------------------------------------------------------- # ? ???????? #-------------------------------------------------------------------------- alias base_spi_KGC_DistributeParameter base_spi def base_spi n = base_spi_KGC_DistributeParameter + distributed_param(:spi) return n end #-------------------------------------------------------------------------- # ? ???????? #-------------------------------------------------------------------------- alias base_agi_KGC_DistributeParameter base_agi def base_agi n = base_agi_KGC_DistributeParameter + distributed_param(:agi) return n end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- alias hit_KGC_DistributeParameter hit def hit n = hit_KGC_DistributeParameter + distributed_param(:hit) return n end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- alias eva_KGC_DistributeParameter eva def eva n = eva_KGC_DistributeParameter + distributed_param(:eva) return n end #-------------------------------------------------------------------------- # ? ?????????? #-------------------------------------------------------------------------- alias cri_KGC_DistributeParameter cri def cri n = cri_KGC_DistributeParameter + distributed_param(:cri) return n end #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- alias odds_KGC_DistributeParameter odds def odds n = odds_KGC_DistributeParameter + distributed_param(:odds) return n end #-------------------------------------------------------------------------- # ? MaxRP ??? #-------------------------------------------------------------------------- def maxrp n = Integer(eval(KGC::DistributeParameter::MAXRP_EXP)) return [n + maxrp_plus, 0].max end #-------------------------------------------------------------------------- # ? MaxRP ?????? #-------------------------------------------------------------------------- def maxrp_plus @maxrp_plus = 0 if @maxrp_plus == nil return @maxrp_plus end #-------------------------------------------------------------------------- # ? RP ??? #-------------------------------------------------------------------------- def rp return [maxrp - @rp_cost, 0].max end #-------------------------------------------------------------------------- # ? ????????? # param : ?????????? (??) #-------------------------------------------------------------------------- def distributed_count(param) clear_distribution_values if @distributed_count == nil @distributed_count[param] = 0 if @distributed_count[param] == nil return @distributed_count[param] end #-------------------------------------------------------------------------- # ? RP ??? # value : ??? #-------------------------------------------------------------------------- def gain_rp(value) @maxrp_plus = maxrp_plus + value end #-------------------------------------------------------------------------- # ? ????????? # param : ?????????? (??) # value : ??? #-------------------------------------------------------------------------- def gain_distributed_count(param, value = 1) n = distributed_count(param) @distributed_count[param] += value if n.is_a?(Integer) end #-------------------------------------------------------------------------- # ? RP ????????????? # param : ?????????? (??) # reverse : ??????? true #-------------------------------------------------------------------------- def rp_growth_effect(param, reverse = false) gain = gain_parameter(param) return if gain == nil # ????????
if reverse return if distributed_count(param) == 0 # ????? else return unless can_distribute?(param) end
gain_distributed_count(param, reverse ? -1 : 1) restore_distribution_values end #-------------------------------------------------------------------------- # ? ????????????? # param : ?????????? (??) #-------------------------------------------------------------------------- def can_distribute?(param) gain = gain_parameter(param) return false if gain == nil # ???????? return false if self.rp < distribute_cost(param) # RP ?? if gain.limit > 0 return false if gain.limit <= distributed_count(param) # ???? end
return true end #-------------------------------------------------------------------------- # ? ?????????????? # param : ?????????? (??) #-------------------------------------------------------------------------- def distribute_cost(param) gain = gain_parameter(param) return 0 if gain == nil # ????????
n = gain.cost count = distributed_count(param) count = [count, gain.limit - 1].min if gain.limit > 0 n += gain.cost_rev * count return [Integer(n), 0].max end #-------------------------------------------------------------------------- # ? ???????????????? # param : ?????????? (??) # amt : ????? #-------------------------------------------------------------------------- def distribute_gain(param, amt = 1) gain = gain_parameter(param) # ???????? return 0 if gain == nil
result = {} KGC::DistributeParameter::PARAMS.each { |par| result[par] = distributed_param(par) } # ?????? if amt > 0 return result if gain.limit > 0 && gain.limit == distributed_count(param) else return result if distributed_count(param) + amt < 0 end
last_hp = self.hp last_mp = self.mp last_count = distributed_count(param) rp_growth_effect(param) KGC::DistributeParameter::PARAMS.each { |par| result[par] = distributed_param(par) if gain.params.include?(par) } rp_growth_effect(param, true) if last_count < distributed_count(param) self.hp = last_hp self.mp = last_mp
return result end end
#???????????????????????????????????????
#============================================================================== # ¦ Window_Base #==============================================================================
class Window_Base < Window #-------------------------------------------------------------------------- # ? RP ??????? # actor : ???? #-------------------------------------------------------------------------- def rp_color(actor) return (actor.rp == 0 ? knockout_color : normal_color) end #-------------------------------------------------------------------------- # ? ????????? 1 ??? #-------------------------------------------------------------------------- def distribute_gauge_color1 color = KGC::DistributeParameter::GAUGE_START_COLOR return (color.is_a?(Integer) ? text_color(color) : color) end #-------------------------------------------------------------------------- # ? ????????? 2 ??? #-------------------------------------------------------------------------- def distribute_gauge_color2 color = KGC::DistributeParameter::GAUGE_END_COLOR return (color.is_a?(Integer) ? text_color(color) : color) end #-------------------------------------------------------------------------- # ? RP ??? # actor : ???? # x : ??? X ?? # y : ??? Y ?? # width : ? #-------------------------------------------------------------------------- def draw_actor_rp(actor, x, y, width = 120) self.contents.font.color = system_color self.contents.draw_text(x, y, 40, WLH, Vocab::rp_a) self.contents.font.color = rp_color(actor) xr = x + width if width < 120 self.contents.draw_text(xr - 40, y, 40, WLH, actor.rp, 2) else self.contents.draw_text(xr - 90, y, 40, WLH, actor.rp, 2) self.contents.font.color = normal_color self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2) self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxrp, 2) end self.contents.font.color = normal_color end #-------------------------------------------------------------------------- # ? ?????????? # actor : ???? # param : ????? # x : ??? X ?? # y : ??? Y ?? # width : ? #-------------------------------------------------------------------------- def draw_actor_distribute_gauge(actor, param, x, y, width = 120) gain = actor.gain_parameter(param) return if gain == nil || gain.limit <= 0
if KGC::DistributeParameter::ENABLE_GENERIC_GAUGE && $imported["GenericGauge"] # ????? draw_gauge(KGC::DistributeParameter::GAUGE_IMAGE, x, y, width, actor.distributed_count(param), gain.limit, KGC::DistributeParameter::GAUGE_OFFSET, KGC::DistributeParameter::GAUGE_LENGTH, KGC::DistributeParameter::GAUGE_SLOPE) else # ???????? gw = width * actor.distributed_count(param) / gain.limit gc1 = distribute_gauge_color1 gc2 = distribute_gauge_color2 self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color) self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2) end end end
#???????????????????????????????????????
#============================================================================== # ¦ Window_Command #==============================================================================
class Window_Command < Window_Selectable unless method_defined?(:add_command) #-------------------------------------------------------------------------- # ? ??????? # ????????? #-------------------------------------------------------------------------- def add_command(command) @commands << command @item_max = @commands.size item_index = @item_max - 1 refresh_command draw_item(item_index) return item_index end #-------------------------------------------------------------------------- # ? ??????????? #-------------------------------------------------------------------------- def refresh_command buf = self.contents.clone self.height = [self.height, row_max * WLH + 32].max create_contents self.contents.blt(0, 0, buf, buf.rect) buf.dispose end #-------------------------------------------------------------------------- # ? ??????? #-------------------------------------------------------------------------- def insert_command(index, command) @commands.insert(index, command) @item_max = @commands.size refresh_command refresh end #-------------------------------------------------------------------------- # ? ??????? #-------------------------------------------------------------------------- def remove_command(command) @commands.delete(command) @item_max = @commands.size refresh end end end
#???????????????????????????????????????
#============================================================================== # ? Window_DistributeParameterActor #------------------------------------------------------------------------------ # ???????????????????????????? #==============================================================================
class Window_DistributeParameterActor < Window_Base #-------------------------------------------------------------------------- # ? ????????? # x : ?????? X ?? # y : ?????? Y ?? # actor : ???? #-------------------------------------------------------------------------- def initialize(x, y, actor) super(x, y, Graphics.width, WLH + 32) @actor = actor refresh end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def refresh self.contents.clear draw_actor_name(@actor, 4, 0) draw_actor_level(@actor, 140, 0) draw_actor_rp(@actor, 240, 0) end end
#???????????????????????????????????????
#============================================================================== # ? Window_DistributeParameterList #------------------------------------------------------------------------------ # ??????????????????????????????? #==============================================================================
class Window_DistributeParameterList < Window_Selectable #-------------------------------------------------------------------------- # ? ????????? # actor : ???? #-------------------------------------------------------------------------- def initialize(actor) off_h = WLH + 32 super(0, off_h, 286, Graphics.height - off_h) @actor = actor refresh self.index = 0 end #-------------------------------------------------------------------------- # ? ?????????? Symbol ??? #-------------------------------------------------------------------------- def parameter_key return @data[self.index] end #-------------------------------------------------------------------------- # ? 1 ?????????????? #-------------------------------------------------------------------------- def page_row_max return super - 1 end #-------------------------------------------------------------------------- # ? ???????????? # index : ???? #-------------------------------------------------------------------------- def item_rect(index) rect = super(index) rect.y += WLH return rect end #-------------------------------------------------------------------------- # ? ????? 1 ???????? #-------------------------------------------------------------------------- def cursor_pagedown return if Input.repeat?(Input::R) super end #-------------------------------------------------------------------------- # ? ????? 1 ??????? #-------------------------------------------------------------------------- def cursor_pageup return if Input.repeat?(Input::L) super end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def refresh @gain_list = @actor.gain_parameter_list @data = [] @gain_list.each { |gain| @data << gain.key } @item_max = @data.size + 1 create_contents @item_max -= 1 draw_caption @item_max.times { |i| draw_item(i, @actor.can_distribute?(@data[i])) } end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def draw_caption self.contents.font.color = system_color self.contents.draw_text( 4, 0, 96, WLH, "Parameters") self.contents.draw_text(120, 0, 40, WLH, Vocab.rp, 2) self.contents.draw_text(170, 0, 80, WLH, "Points", 2) self.contents.font.color = normal_color end #-------------------------------------------------------------------------- # ? ????? # index : ???? # enabled : ????? #-------------------------------------------------------------------------- def draw_item(index, enabled = true) rect = item_rect(index) self.contents.clear_rect(rect) item = @data[index] if item != nil draw_parameter(rect.x, rect.y, @data[index], enabled) end end #-------------------------------------------------------------------------- # ? ?????? # x : ??? X ?? # y : ??? Y ?? # param : ????? # enabled : ????? #-------------------------------------------------------------------------- def draw_parameter(x, y, param, enabled) gain = @gain_list.find { |v| v.key == param } return if gain == nil
self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x + 4, y, 96, WLH, gain.name)
value = @actor.distribute_cost(param) self.contents.draw_text(x + 120, y, 40, WLH, value, 2) if gain.limit > 0 value = sprintf("%1d/%1d", @actor.distributed_count(param), gain.limit) else value = sprintf("%1d%s", @actor.distributed_count(param), KGC::DistributeParameter::HIDE_MAX_COUNT_INFINITE ? "" : "/---") end draw_actor_distribute_gauge(@actor, param, x + 170, y, 80) self.contents.draw_text(x + 170, y, 80, WLH, value, 2) self.contents.font.color = normal_color end end
#???????????????????????????????????????
#============================================================================== # ? Window_DistributeParameterStatus #------------------------------------------------------------------------------ # ??????????????????????????????? #==============================================================================
class Window_DistributeParameterStatus < Window_Base #-------------------------------------------------------------------------- # ? ????????? # actor : ???? #-------------------------------------------------------------------------- def initialize(actor) dx = 286 off_h = WLH + 32 super(dx, off_h, Graphics.width - dx, Graphics.height - off_h) @actor = actor refresh(actor.gain_parameter_list[0].key) end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def refresh(param = nil) @distribute_gain = nil if param != nil @distribute_gain = @actor.distribute_gain(param) end
self.contents.clear self.contents.font.color = system_color self.contents.draw_text(0, 0, width - 32, WLH, "Stat Changes", 1) self.contents.font.color = normal_color dy = WLH KGC::DistributeParameter::PARAMS.each { |param| draw_parameter(0, dy, param) dy += WLH } end #-------------------------------------------------------------------------- # ? ?????? # x : ??? X ?? # y : ??? Y ?? # type : ?????? #-------------------------------------------------------------------------- def draw_parameter(x, y, type) case type when :maxhp name = Vocab.hp value = @actor.maxhp when :maxmp name = Vocab.mp value = @actor.maxmp when :atk name = Vocab.atk value = @actor.atk when :def name = Vocab.def value = @actor.def when :spi name = Vocab.spi value = @actor.spi when :agi name = Vocab.agi value = @actor.agi when :hit name = Vocab.hit value = @actor.hit when :eva name = Vocab.eva value = @actor.eva when :cri name = Vocab.cri value = @actor.cri when :skill_speed name = Vocab.skill_speed value = @actor.distributed_param(type) when :item_speed name = Vocab.item_speed value = @actor.distributed_param(type) when :odds name = Vocab.odds value = @actor.odds else return end self.contents.font.color = system_color self.contents.draw_text(x + 4, y, 96, WLH, name) self.contents.font.color = normal_color self.contents.draw_text(x + 106, y, 48, WLH, value, 2) return if @distribute_gain == nil
self.contents.draw_text(x + 154, y, 16, WLH, ">", 1)
curr = @actor.distributed_param(type) gain = @distribute_gain[type] self.contents.font.color = (gain > curr ? text_color(3) : gain < curr ? text_color(2) : normal_color) self.contents.draw_text(x + 174, y, 48, WLH, value + (gain - curr), 2)
self.contents.font.color = normal_color end end
#???????????????????????????????????????
#============================================================================== # ¦ Scene_Map #==============================================================================
class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- alias update_scene_change_KGC_DistributeParameter update_scene_change def update_scene_change return if $game_player.moving? # ??????????
if $game_temp.next_scene == :distribute_parameter call_distribute_parameter return end
update_scene_change_KGC_DistributeParameter end #-------------------------------------------------------------------------- # ? ????????????????? #-------------------------------------------------------------------------- def call_distribute_parameter $game_temp.next_scene = nil $scene = Scene_DistributeParameter.new( $game_temp.next_scene_actor_index, 0, Scene_DistributeParameter::HOST_MAP) end end
#???????????????????????????????????????
#============================================================================== # ¦ Scene_Menu #==============================================================================
class Scene_Menu < Scene_Base if KGC::DistributeParameter::USE_MENU_DISTRIBUTE_PARAMETER_COMMAND #-------------------------------------------------------------------------- # ? ???????????? #-------------------------------------------------------------------------- alias create_command_window_KGC_DistributeParameter create_command_window def create_command_window create_command_window_KGC_DistributeParameter
return if $imported["CustomMenuCommand"]
@__command_distribute_parameter_index = @command_window.add_command(Vocab.distribute_parameter) if @command_window.oy > 0 @command_window.oy -= Window_Base::WLH end @command_window.index = @menu_index end end #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- alias update_command_selection_KGC_DistributeParameter update_command_selection def update_command_selection call_distribute_parameter_flag = false if Input.trigger?(Input::C) case @command_window.index when @__command_distribute_parameter_index # ????????? call_distribute_parameter_flag = true end end
# ?????????????? if call_distribute_parameter_flag if $game_party.members.size == 0 Sound.play_buzzer return end Sound.play_decision start_actor_selection return end
update_command_selection_KGC_DistributeParameter end #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- alias update_actor_selection_KGC_DistributeParameter update_actor_selection def update_actor_selection if Input.trigger?(Input::C) $game_party.last_actor_index = @status_window.index Sound.play_decision case @command_window.index when @__command_distribute_parameter_index # ????????? $scene = Scene_DistributeParameter.new( @status_window.index, @__command_distribute_parameter_index, Scene_DistributeParameter::HOST_MENU) return end end
update_actor_selection_KGC_DistributeParameter end end
#???????????????????????????????????????
#============================================================================== # ? Scene_DistributeParameter #------------------------------------------------------------------------------ # ??????????????????????? #==============================================================================
class Scene_DistributeParameter < Scene_Base #-------------------------------------------------------------------------- # ? ?? #-------------------------------------------------------------------------- HOST_MENU = 0 # ????? : ???? HOST_MAP = 1 # ????? : ??? #-------------------------------------------------------------------------- # ? ????????? # actor_index : ?????????? # menu_index : ????????????? # host_scene : ????? (0..???? 1..???) #-------------------------------------------------------------------------- def initialize(actor_index = 0, menu_index = 0, host_scene = HOST_MENU) @actor_index = actor_index @menu_index = menu_index @host_scene = host_scene end #-------------------------------------------------------------------------- # ? ???? #-------------------------------------------------------------------------- def start super create_menu_background
@actor = $game_party.members[@actor_index] @prev_info = @actor.distribution_info create_windows end #-------------------------------------------------------------------------- # ? ??????? #-------------------------------------------------------------------------- def create_windows @actor_window = Window_DistributeParameterActor.new(0, 0, @actor) @parameter_window = Window_DistributeParameterList.new(@actor) @status_window = Window_DistributeParameterStatus.new(@actor)
@confirm_help_window = Window_Help.new @confirm_help_window.z = @status_window.z + 100 @confirm_help_window.openness = 0
@confirm_window = Window_Command.new( KGC::DistributeParameter::CONFIRM_WIDTH, KGC::DistributeParameter::CONFIRM_COMMANDS) @confirm_window.x = (Graphics.width - @confirm_window.width) / 2 @confirm_window.y = (Graphics.height - @confirm_window.height) / 2 @confirm_window.z = @confirm_help_window.z @confirm_window.active = false @confirm_window.openness = 0 end #-------------------------------------------------------------------------- # ? ???? #-------------------------------------------------------------------------- def terminate super dispose_menu_background @actor_window.dispose @parameter_window.dispose @status_window.dispose @confirm_help_window.dispose @confirm_window.dispose end #-------------------------------------------------------------------------- # ? ??????? #-------------------------------------------------------------------------- def return_scene case @host_scene when HOST_MENU $scene = Scene_Menu.new(@menu_index) when HOST_MAP $scene = Scene_Map.new end end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def update super update_menu_background update_window if @parameter_window.active update_parameter_list elsif @confirm_window.active update_confirm_command end end #-------------------------------------------------------------------------- # ? ??????? #-------------------------------------------------------------------------- def update_window @actor_window.update @parameter_window.update @status_window.update @confirm_help_window.update @confirm_window.update end #-------------------------------------------------------------------------- # ? ???????? #-------------------------------------------------------------------------- def refresh_window @actor_window.refresh @parameter_window.refresh @status_window.refresh(@parameter_window.parameter_key) Graphics.frame_reset end #-------------------------------------------------------------------------- # ? ?????????????? #-------------------------------------------------------------------------- def next_actor @actor_index += 1 @actor_index %= $game_party.members.size $scene = Scene_DistributeParameter.new(@actor_index, @menu_index, @host_scene) end #-------------------------------------------------------------------------- # ? ?????????????? #-------------------------------------------------------------------------- def prev_actor @actor_index += $game_party.members.size - 1 @actor_index %= $game_party.members.size $scene = Scene_DistributeParameter.new(@actor_index, @menu_index, @host_scene) end #-------------------------------------------------------------------------- # ? ?????? (???????????????????) #-------------------------------------------------------------------------- def update_parameter_list if @last_index != @parameter_window.index @status_window.refresh(@parameter_window.parameter_key) @last_index = @parameter_window.index end
if Input.trigger?(Input::B) Sound.play_cancel activate_confirm_window elsif Input.trigger?(Input::C) Sound.play_decision activate_confirm_window elsif Input.repeat?(Input::RIGHT) # ?? param = @parameter_window.parameter_key unless @actor.can_distribute?(param) Sound.play_buzzer return end Sound.play_cursor @actor.rp_growth_effect(param) refresh_window elsif Input.repeat?(Input::LEFT) # ?? param = @parameter_window.parameter_key unless reversible?(param) Sound.play_buzzer return end Sound.play_cursor @actor.rp_growth_effect(param, true) refresh_window elsif Input.trigger?(Input::R) Sound.play_cursor next_actor elsif Input.trigger?(Input::L) Sound.play_cursor prev_actor end end #-------------------------------------------------------------------------- # ? ?????? # param : ??????? #-------------------------------------------------------------------------- def reversible?(param) return false if @actor.distributed_count(param) == 0 return true if KGC::DistributeParameter::ENABLE_REVERSE_DISTRIBUTE
base = @prev_info.count[param] return ( base < @actor.distributed_count(param) ) end #-------------------------------------------------------------------------- # ? ???????????? #-------------------------------------------------------------------------- def activate_confirm_window @last_index = -1 @status_window.refresh @confirm_window.index = 0 @confirm_window.active = true @confirm_window.open @confirm_help_window.open @parameter_window.active = false @last_confirm_index = -1 end #-------------------------------------------------------------------------- # ? ?????? (????????????????) #-------------------------------------------------------------------------- def update_confirm_command if @last_confirm_index != @confirm_window.index @confirm_help_window.set_text( KGC::DistributeParameter::CONFIRM_COMMAND_HELP[@confirm_window.index]) @last_confirm_index = @confirm_window.index end
if Input.trigger?(Input::B) Sound.play_cancel # ??????????????? @confirm_window.active = false @confirm_window.close @confirm_help_window.close @parameter_window.active = true elsif Input.trigger?(Input::C) Sound.play_decision case @confirm_window.index when 0 # ?? return_scene when 1 # ?? @actor.set_distribution_info(@prev_info) return_scene when 2 # ????? # ??????????????? @confirm_window.active = false @confirm_window.close @confirm_help_window.close @parameter_window.active = true end end end end
#???????????????????????????????????????
#============================================================================== # ¦ Scene_File #==============================================================================
class Scene_File < Scene_Base #-------------------------------------------------------------------------- # ? ??????????? # file : ??????????????? (??????) #-------------------------------------------------------------------------- alias read_save_data_KGC_DistributeParameter read_save_data def read_save_data(file) read_save_data_KGC_DistributeParameter(file)
KGC::Commands.check_distribution_values Graphics.frame_reset end end
|
| | | Xavioo Chevalier Mage (niveau 4)
Messages postés : 466 Date d'inscription : 24/12/2011 Jauge LPC :
| Sujet: Re: Parameters Distributers Ven 7 Sep 2012 - 0:52 | |
| Non ça n'as rien changé :/ |
| | | shin Chevalier Dragon (niveau 1)
Messages postés : 726 Date d'inscription : 18/10/2011 Jauge LPC :
| Sujet: Re: Parameters Distributers Ven 7 Sep 2012 - 2:43 | |
| Test ça, normalement ça devrais marcher. (c'est le premier code) - Spoiler:
- Code:
-
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #_/ ◆ Attribute Point Stat Distribution2 - KGC_DistributeParameter2 ◆ VX ◆ #_/ ◇ Last update : 2009/09/26 ◇ #_/ ◆ Translated by Mr. Bubble ◆ #_/ ◆ KGC Site: ◆ #_/ ◆ http://ytomy.sakura.ne.jp/ ◆ #_/---------------------------------------------------------------------------- #_/ This script allows players to freely distribute their stats to actors #_/ with points gained when leveling up. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #_/ Before diving into customizing this script, it's important to understand #_/ the distinction between parameters points and actor stats. #_/ #_/ *Actor stats* are the default stats provided by VX. (HP, MP, ATK, DEF, #_/ SPI, AGI, etc...) These actor stats have a direct effect in battle. #_/ #_/ *Parameters* have the option of increasing actor stats per allocated point #_/ they are given. For example, the Parameter "Health" increases the actor #_/ stats HP and DEF per point. The Parameter "Magic" increases the actor #_/ stats MP and SPI per point. You can, of course, change what actor #_/ stats these default parameters raise. #_/ #_/ This the biggest different between KGC_DistributeParameter2 and the #_/ original KGC_DistributeParameter script. You can raise multiple #_/ actor stats with a single allocated point with DistributeParameter2. #_/ #_/ However, with the flexibility gained from this version, the user #_/ customization module is slightly more overwhelming to regular users. #_/ It's important that you read the comments and study the syntax for #_/ how to make and modify your own parameters. #_/----------------------------------------------------------------------------- #_/ ++ Script Commands ++ #_/ These commands are used in "Script" function in the third page of event #_/ commands under "Advanced". Do not include the asterisk. #_/ #_/ * gain_rp(ActorID, Value) #_/ Increases the MaxRP of a given actor. #_/ #_/ * reset_distributed_count(ActorID) #_/ Resets the distributed RP of a given actor. #_/ #_/ * call_distribute_parameter(ActorID) #_/ Calls the Distribute Parameter screen for a given actor.
#============================================================================== # + BEGIN - Customize + #==============================================================================
module KGC module DistributeParameter # ++ Default Parameter Growth Settings # This section lets you define the default parameters for player # stat distribution. # # { # <-- Each parameter starts with an opening curly bracket # :key => Key, # :name => "Name", # :limit => Maximum Parameter Limit (a number), # :cost => [Base RP Usage, RP Usage Adjustment], # :stat => [Stat Increase Value, Stat Increase Adjustment], # # You can add as many "stat" hashes within a single parameter # }, # <-- Each parameter ends with a closing curly bracket and comma # # Parameters are listed in the stat distribution scene in the order they # are defined in this script. # # Key - Parameter key for internal usage. Make sure it is unique. # Name - Name of the parameter. # Max Param Limit - Maximum number of points allowed for the parameter. # If set to 0, there is no parameter limit. # Base RP Usage - Base amount of RP required to increase the parameter. # Negative & floating point values are OK to use. # RP Usage Adjust - Increases the RP required after every point allocated. # Negative & floating point values are OK to use. # Stat Increase Value - Increases the :stat per point allocated. # Negative & floating point values are OK to use. # Stat Increase Adjust - Adjusts the Stat Increase Value per point allocated. # Negative & floating point values are OK to use. # If this value is omitted, it is defaulted to 0. # # :stat can be replaced with the following actor stats keys and most should # be self-explanatory: # :maxhp, :maxmp, :atk, :def, :spi, :agi, :hit, :eva, # :cri, :skill_speed, :item_speed, :odds # GAIN_PARAMETER = [ # <-- Do not delete or modify this line! # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { # <-- Each parameter starts with an opening curly bracket :key => :health, :name => "Point de Vie", :limit => 30, :cost => [ 1, 0.4], # Stats raised per RP :maxhp => [30, 2], # Increase MAX HP :def => [ 1, 0.25], # Increase DEF }, # <-- Each parameter ends with a closing curly bracket and comma # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :magic, :name => "Point de Magie", :limit => 30, :cost => [1, 0.4], # Stats raised per RP :maxmp => [5, 0.5], # Increase MAX MP :spi => [2, 0.5], # Increase SPI }, # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :pow, :name => "Force", :limit => 30, :cost => [1, 0.4], # Stats raised per RP :atk => [2, 0.5], # Increase ATK :def => [1, 0.25], # Increase DEF }, # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :dex, :name => "Dexterité", :limit => 30, :cost => [1, 0.4], # Stats raised per RP :agi => [2, 0.5], # Increase AGI :hit => [0.5], # Increase HIT :eva => [0.5], # Increase EVA }, # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :hit, :name => "Précision", :limit => 20, :cost => [1, 0.5], # Stats raised per RP :hit => [1], # Increase HIT }, # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :eva, :name => "Esquive", :limit => 20, :cost => [1, 0.5], # Stats raised per RP :eva => [1], # Increase EVA }, # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :crt, :name => "Critique", :limit => 20, :cost => [1, 0.7], # Stats raised per RP :cri => [1], # Increase CRI }, # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :chant, :name => "Rapidité de compétence", :limit => 0, :cost => [1, 0.5], # Stats raised per RP :skill_speed => [1], # Increase Skill Speed }, # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :item, :name => "Rapidité d'objet", :limit => 0, :cost => [1, 0.5], # Stats raised per RP :item_speed => [1], # Increase Item Speed }, # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { :key => :odds, :name => "Hostilité", :limit => 5, :cost => [1], :odds => [1], # Increase Odds (chance of getting targeted by enemies) }, # - - - - - - You may add more parameters within this section - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ] # <-- Do not delete or modify this line!
# ++ Actor-Specific Parameter Growth Settings PERSONAL_GAIN_PARAMETER = [] # Here, you can define the growth parameters based on class. # PERSONAL_GAIN_PARAMETER[ActorID] = [ Parameter Settings ] # Format is the same as specified in the GAIN_PARAMETER section. # The "Parameter Settings" is where you define growth paramaters # similarly to the GAIN_PARAMETER section. # If a parameter Key is not defined here, the default is used. # If a parameter has the same Key as one in GAIN_PARAMETER, the one # defined here will take precedence. # # Example: In this section, the parameter "Health" is uniquely defined for # actor ID 1. # - - - - - You may add class parameters within this section - - - - - - - PERSONAL_GAIN_PARAMETER[1] = [ { :key => :health, :name => "Health", :limit => 30, :cost => [ 1, 0.4], :maxhp => [50, 3], :def => [ 1, 0.3], },
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ] # <-- Do not delete or modify this line! # ++ Class-Specific Parameter Growth Settings CLASS_GAIN_PARAMETER = [] # Here, you can define the growth parameters based on class. # CLASS_GAIN_PARAMETER[ClassID] = [ Parameter Settings ] # Format is the same as specified in the GAIN_PARAMETER section. # ( Parameter Growth Settings Priority : Class > Actor > Default ) # - - - - - You may add class parameters within this section - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ++ RP (Reinforce Point) Vocab VOCAB_RP = "Ex" # ++ RP Abbreviation Vocab VOCAB_RP_A = "Ex"
# ++ MaxRP Formula Setting # level : Actor's current level # If the result is a floating point value, it is automatically rounded # to an integer. # Regular math symbols can be used ( +, -, *, / ). # "**" is an exponential symbol similar to "^". MAXRP_EXP = "level"
# ++ Parameter Name # KGC_ExtendedEquipScene has a higher priority for the definition # of these actor stat vocabulary. VOCAB_PARAM = { :hit => "Hit", # Hit :eva => "Evasion", # Evade :cri => "Critical", # Critical :skill_speed => "Skill Speed", # Skill Use Speed :item_speed => "Item Speed", # Item Use Speed :odds => "Emnity", # Odds of being targeted } # <-- Do not delete or modify this line!
# ++ Display Unlimited Distribution Symbol # true : Only show a number # false : Show dashes in place of max limit ( ##/--- ) HIDE_MAX_COUNT_INFINITE = false
# ++ Distribute Parameters Gauge Colors # ColorIndex : Window text index value (same as used with \C[n]) # Color : Can also be defined as Color.new(255, 128, 128) GAUGE_START_COLOR = 28 # Start color GAUGE_END_COLOR = 29 # End color
# ++ KGC_GenericGauge Settings # These gauge settings only apply when KGC_GenericGauge is installed # true : Use GenericGauge image # false : Do not use generic gauge image ENABLE_GENERIC_GAUGE = true # ++ Distribute Parameter Gauge Image Settings # Images must be placed in the Graphics/System folder in your project. GAUGE_IMAGE = "GaugeDist" # Gauge Image Filename GAUGE_OFFSET = [-23, -2] # Position Offset[x, y] GAUGE_LENGTH = -4 # Length Correction GAUGE_SLOPE = 30 # Gauge slope in degrees (-89 ~ 89)
# ++ Confirmation Window Command Names CONFIRM_COMMANDS = [ "Confirm", # Confirm Stat Distribution "Cancel", # Cancel Stat Distribution "Continue", # Continue Stat Distribution ] # <-- Do not delete or modify this line!
# ++ Confirmation Window Help Text CONFIRM_COMMAND_HELP = [ "Confirm current point distribution.", # Confirm Stat Distribution "Cancel current point distribution.", # Cancel Stat Distribution "Continue with point distribution.", # Continue Stat Distribution ] # <-- Do not delete or modify this line!
# ++ Distribute Parameter Confirmation Window Width CONFIRM_WIDTH = 128
# ++ Allow "Distribute Parameters" to Menu Command List # The Parameters command will appear the bottom of the menu. # If you want to move the menu command, use KGC_CustomMenuCommand # or any other custom menu script. USE_MENU_DISTRIBUTE_PARAMETER_COMMAND = true # ++ Distribute Parameters Menu Command Name VOCAB_MENU_DISTRIBUTE_PARAMETER = "Parameters"
# ++ Allow Parameter Redistribution # true : Allow free redistribution of parameters at any time. # false : Parameter points are locked after player confirmation. ENABLE_REVERSE_DISTRIBUTE = true end end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
$imported = {} if $imported == nil $imported["distributeparameter"] = true
module KGC::DistributeParameter # 振り分け対象パラメータ PARAMS = [:maxhp, :maxmp, :atk, :def, :spi, :agi, :hit, :eva, :cri, :skill_speed, :item_speed, :odds]
# パラメータ増加量構造体 GainInfo = Struct.new(:key, :name, :limit, :cost, :cost_rev, :params) ParamInfo = Struct.new(:value, :value_rev)
# 振り分け情報構造体 DistInfo = Struct.new(:count, :hp, :mp)
#-------------------------------------------------------------------------- # ○ パラメータ増加量を構造体化 #-------------------------------------------------------------------------- def self.create_gain_param_structs(target) result = [] target.each { |v| info = GainInfo.new info.key = v[:key] info.name = v[:name] info.limit = v[:limit] info.cost = v[:cost][0] info.cost_rev = (v[:cost][1] == nil ? 0 : v[:cost][1]) info.params = {}
PARAMS.each { |param| next unless v.has_key?(param) pinfo = ParamInfo.new pinfo.value = v[param][0] pinfo.value_rev = (v[param][1] == nil ? 0 : v[param][1]) info.params[param] = pinfo } result << info } return result end #-------------------------------------------------------------------------- # ○ パラメータ増加量を構造体化 (固有増加量用) #-------------------------------------------------------------------------- def self.create_gain_param_structs_for_personal(target) result = [] target.each { |list| next if list == nil result << create_gain_param_structs(list) } return result end #-------------------------------------------------------------------------- # ○ パラメータ増加量を併合 #-------------------------------------------------------------------------- def self.merge(list1, list2) result = list1.clone list2.each { |info2| overwrite = false list1.each_with_index { |info1, i| if info1.key == info2.key result[i] = info2 overwrite = true break end } result << info2 unless overwrite } return result end
# パラメータ増加量を構造体化 GAIN_PARAMS = create_gain_param_structs(GAIN_PARAMETER) PERSONAL_GAIN_PARAMS = create_gain_param_structs_for_personal(PERSONAL_GAIN_PARAMETER) CLASS_GAIN_PARAMS = create_gain_param_structs_for_personal(CLASS_GAIN_PARAMETER) end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
|
| | | Xavioo Chevalier Mage (niveau 4)
Messages postés : 466 Date d'inscription : 24/12/2011 Jauge LPC :
| Sujet: Re: Parameters Distributers Sam 8 Sep 2012 - 16:25 | |
| Ça marche Niquel merci |
| | | lidenvice Ancien staffeux
Messages postés : 1955 Date d'inscription : 18/10/2011 Jauge LPC :
| Sujet: Re: Parameters Distributers Sam 8 Sep 2012 - 18:22 | |
| Résolu et LPDM distribués. |
| | | Contenu sponsorisé
| Sujet: Re: Parameters Distributers | |
| |
| | | |
| Permission de ce forum: | Vous ne pouvez pas répondre aux sujets dans ce forum
| |
| |
| |