=begin RGSS3 ★ 天候による強化・弱体化 ★ 天候によってスキル・アイテムの効果、敵キャラのパラメータに補正をかけます。 ● スキル・アイテムへの設定 ●====================================== メモ欄に【天候補正】と記述。 m : 天候ID => 0(雨), 1(嵐), 2(雪) n : 補正率 => 0以上の数値を設定 ここに設定されている値がダメージ計算後の結果に乗算されます。 -------------------------------------------------------------------- 例) 嵐の際にダメージ0.7倍、雪の際にダメージ1.5倍とする場合、 メモ欄に次の2つを記述します。 天候補正<1,0.7> 天候補正<2,1.5> ==================================================================== ● 敵キャラへの設定 ●============================================== メモ欄に【天候補正】と記述。 m : 天候ID => 0(雨), 1(嵐), 2(雪) n : タイプ => 0(攻撃力),1(防御力),2(魔法力),3(魔法防御),4(敏捷性) 5(運),6(命中率),7(回避率),8(会心率),9(反撃率) o : 補正値 => 整数を設定。負の値も指定可能です。 ここに設定されている値を本来のパラメータに加算します。 -------------------------------------------------------------------- 例) 雨の際に敏捷性と回避率が上昇、防御力が低下とする場合、 メモ欄に次の3つを記述します。 天候補正<0,4,120> 天候補正<0,7,30> 天候補正<0,1,-50> ==================================================================== ● 属性への設定 ●================================================== スクリプト内の設定箇所にて設定してください。 ==================================================================== ● 注意 ●========================================================== このスクリプトを利用するには、当サイトで公開しているRGSS3素材 「戦闘内天候持ち越し」を別途導入してください。 ==================================================================== ver1.00 Last Update : 2012/08/18 08/18 : 新規 ろかん   http://kaisou-ryouiki.sakura.ne.jp/ =end #=========================================== # 設定箇所 #=========================================== module BattleWeather module Weather_Effect # 次の形式で天候による属性補正値を設定してください。 # ① => ②, # ① …… 属性ID(数値) # ② …… 補正率(数値) # ここに設定されている値が属性有効度の結果に乗算されます。 WE_LIST = { # 雨 :rain => { 3 => 0.7, # 雨の場合、炎の有効度を0.7倍 }, # 嵐 :storm => { 3 => 0.4, # 嵐の場合、炎の有効度を0.4倍 5 => 1.5, # 嵐の場合、雷の有効度を1.5倍 }, # 雪 :snow => { }, } end end #=========================================== # ここまで #=========================================== $rsi ||= {} $rsi["天候による強化・弱体化"] = true WETHER_LIST = [:rain, :storm, :snow] class RPG::Enemy < RPG::BaseItem def set_weather_effect_list unless @weather_effect_list @weather_effect_list = {} WETHER_LIST.each{|i| @weather_effect_list[i] = Array.new(10){0}} check_weather_effect end end def check_weather_effect self.note.each_line{|line| if line =~ /天候補正<(\d+),(\d+),(\-?\d+)>/i @weather_effect_list[WETHER_LIST[$1.to_i]][$2.to_i] += $3.to_i end } end def get_wether_effect_value(wether, type) wether == :none ? 0 : @weather_effect_list[wether][type] end end class RPG::UsableItem::Damage alias _wether_effect_eval eval unless $! def eval(a, b, v) _wether_effect_eval(a, b, v) * @parent.get_wether_effect_value end def item_accessor=(parent) unless @parent @parent = parent @parent.set_weather_effect_list end end end class RPG::UsableItem < RPG::BaseItem def set_weather_effect_list unless @weather_effect_list @weather_effect_list = {} WETHER_LIST.each{|i| @weather_effect_list[i] = 1} check_weather_effect end end def check_weather_effect self.note.each_line{|line| if line =~ /天候補正<(\d+),(\d+)>/i @weather_effect_list[WETHER_LIST[$1.to_i]] = $2.to_i end } end def get_wether_effect_value if $game_party.in_battle wether = $game_troop.screen.weather_type wether == :none ? 1 : @weather_effect_list[wether] else 1 end end # 再定義 def damage @damage.item_accessor = self @damage end end class Game_BattlerBase #-------------------------------------------------------------------------- # ● インクルード BattleWeather::Weather_Effect #-------------------------------------------------------------------------- include BattleWeather::Weather_Effect #-------------------------------------------------------------------------- # ● 属性有効度の取得 #-------------------------------------------------------------------------- alias _wether_effect_element_rate element_rate def element_rate(element_id) _wether_effect_element_rate(element_id) * get_wether_effect_value(element_id) end #-------------------------------------------------------------------------- # ● 天候による補正値を返して属性有効度に乗算 #-------------------------------------------------------------------------- def get_wether_effect_value(element_id) wether = $game_troop.screen.weather_type if wether == :none 1 else WE_LIST[wether][element_id] ? WE_LIST[wether][element_id] : 1 end end end class Game_Enemy < Game_Battler def atk; [super + wether_effect(0), 1].max; end # 攻撃力 def def; [super + wether_effect(1), 1].max; end # 防御力 def mat; [super + wether_effect(2), 1].max; end # 魔法力 def mdf; [super + wether_effect(3), 1].max; end # 魔法防御 def agi; [super + wether_effect(4), 1].max; end # 敏捷性 def luk; [super + wether_effect(5), 1].max; end # 運 def hit; [super + wether_effect(6), 0].max; end # 命中率 def eva; [super + wether_effect(7), 0].max; end # 回避率 def cri; [super + wether_effect(8), 0].max; end # 会心率 def cnt; [super + wether_effect(9), 0].max; end # 反撃率 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias _wether_effect_initialize initialize def initialize(index, enemy_id) _wether_effect_initialize(index, enemy_id) enemy.set_weather_effect_list end #-------------------------------------------------------------------------- # ● 天候による補正値を返してパラメータに加算 #-------------------------------------------------------------------------- def wether_effect(type) enemy.get_wether_effect_value($game_troop.screen.weather_type, type) end end