#============================================================================== # ■ XP-RGSS-11 熟練度システム [Ver.6.2.0] by Claimh #------------------------------------------------------------------------------ # 再定義 # Game_Battler#elements_correct # Scene_Battle#make_skill_action_result #============================================================================== module SysUpdate module_function #-------------------------------------------------------------------------- # ● 連続攻撃系スクリプトとの併用化処理 # 【仕様】連続攻撃系が動作中はレベルアップさせない。 # 他の連続攻撃系との併用についてもこのメソッドで吸収させる。 #-------------------------------------------------------------------------- def use_together_other_system(actor) # 追尾攻撃 併用時 if defined?(ExtraAttack) return false if $scene.add_atk_exercise end # スキル連撃 併用時 if defined?(ExtraSkill) return false if $scene.skill_chase_exercise end # 一人連携 併用時 if defined?(SkillLink) return false if $scene.skill_linked end # 閃きシステム 併用時 if defined?(SysFlash) return false if actor.flash_flg end return true # 有効 end #-------------------------------------------------------------------------- # ● 汎用データ取得 #-------------------------------------------------------------------------- def get_data(data, attr_id, actor_id) return data[0][attr_id] if data[actor_id].nil? or data[actor_id][attr_id].nil? return data[actor_id][attr_id] end #-------------------------------------------------------------------------- # ● 熟練度初期値 #-------------------------------------------------------------------------- def attr_first_lv(attr_id, actor_id) return get_data(INIT_LEVEL, attr_id, actor_id) end #-------------------------------------------------------------------------- # ● 熟練度上限 #-------------------------------------------------------------------------- def attr_limit_lv(attr_id, actor_id) return get_data(LV_LIMIT, attr_id, actor_id) end #-------------------------------------------------------------------------- # ● 熟練度上昇:基本値 #-------------------------------------------------------------------------- def attr_interval(attr_id, actor_id) return get_data(UP_INTERVAL, attr_id, actor_id) end #-------------------------------------------------------------------------- # ● 熟練度上昇:傾き #-------------------------------------------------------------------------- def attr_slope(attr_id, actor_id) return get_data(UP_SLOPE, attr_id, actor_id) end #-------------------------------------------------------------------------- # ● 通常攻撃の威力上昇率 #-------------------------------------------------------------------------- def attr_atk_rate(attr_id, actor_id) return get_data(ATK_RATE, attr_id, actor_id) end #-------------------------------------------------------------------------- # ● スキル攻撃の威力上昇率 #-------------------------------------------------------------------------- def attr_skill_rate(attr_id, actor_id) return get_data(SKILL_RATE, attr_id, actor_id) end #-------------------------------------------------------------------------- # ● スキル攻撃の威力上昇率 #-------------------------------------------------------------------------- def attr_item_rate(attr_id, actor_id) return get_data(ITEM_RATE, attr_id, actor_id) end #-------------------------------------------------------------------------- # ● 属性修正 取得 #-------------------------------------------------------------------------- def attr_guard_rate(attr_id, actor_id) return get_data(GUARD_RATE, attr_id, actor_id) end #-------------------------------------------------------------------------- # ● 熟練度EXPリスト(詳細版)取得 #-------------------------------------------------------------------------- def attr_exp(actor_id, attr_id, lv) return A_EXP[actor_id][attr_id][lv] if !A_EXP[actor_id].nil? and !A_EXP[actor_id][attr_id].nil? and !A_EXP[actor_id][attr_id][lv].nil? return A_EXP[actor_id][0][lv] if !A_EXP[actor_id].nil? and !A_EXP[actor_id][0].nil? and !A_EXP[actor_id][0][lv].nil? return A_EXP[0][attr_id][lv] if !A_EXP[0].nil? and !A_EXP[0][attr_id].nil? and !A_EXP[0][attr_id][lv].nil? return A_EXP[0][0][lv] if !A_EXP[0].nil? and !A_EXP[0][0].nil? and !A_EXP[0][0][lv].nil? return 0 end #-------------------------------------------------------------------------- # ● EXP 計算 #-------------------------------------------------------------------------- def make_attr_list(attr_id, actor_id, lv_limit) # 上昇間隔 up_interval = attr_interval(attr_id, actor_id) # 傾き up_slope = attr_slope(attr_id, actor_id) list = [] list[0] = list[1] = 0 # 熟練度EXPリスト作成 for lv in 2..lv_limit case LEVEL_UP_PATTERN when 0; exp = up_interval * (lv-1) when 1; exp = list[lv-1] + up_slope * (lv-1) + up_interval when 2; exp = list[lv-1] + up_slope * (lv-1) * (lv-1) + up_interval when 3; exp = attr_exp(actor_id, attr_id, lv) end list[lv] = exp.truncate end #p actor_id, attr_id, list return list end #-------------------------------------------------------------------------- # ● 属性情報管理クラス #-------------------------------------------------------------------------- class Attr attr_accessor :id # 属性id attr_accessor :level # 属性レベル def initialize @level = 0 @id = 0 end end #-------------------------------------------------------------------------- # ● 熟練度取得(共通処理) #-------------------------------------------------------------------------- def best_attr(actor, element_set) attr = Attr.new for w_element in element_set next unless ELEMENTS.include?(w_element) # 管理対象外 next if attr.level >= actor.attr[w_element].level # 最大でないので除外 attr.level = actor.attr[w_element].level attr.id = w_element end return attr end #-------------------------------------------------------------------------- # ● 熟練度取得(通常攻撃) #-------------------------------------------------------------------------- def atk_attr(actor) return best_attr(actor, actor.element_set) end #-------------------------------------------------------------------------- # ● 熟練度取得(スキル攻撃) #-------------------------------------------------------------------------- def skill_attr(actor, skill_id) if defined?(SkillUpdate) return best_attr(actor, SkillUpdate.skill_element($data_skills[skill_id], actor.id)) else return best_attr(actor, $data_skills[skill_id].element_set) end end #-------------------------------------------------------------------------- # ● 熟練度取得(アイテム攻撃) #-------------------------------------------------------------------------- def item_attr(actor, item_id) return best_attr(actor, $data_items[item_id].element_set) end #-------------------------------------------------------------------------- # ● 管理下属性の配列抽出 #-------------------------------------------------------------------------- def correct_element(element_set) ret_element = [] for element_id in element_set ret_element.push(element_id) if ELEMENTS.include?(element_id) end return ret_element end #-------------------------------------------------------------------------- # ● 得意/不得意属性 威力計算 #-------------------------------------------------------------------------- def calc_taste(taste, base_rate) case taste when ATTR_NORMAL; return base_rate when ATTR_GOOD; return base_rate + TASTE_RATE when ATTR_BAD; return base_rate - TASTE_RATE else; p "unknown taste:{#taste}" end end #-------------------------------------------------------------------------- # ● 得意/不得意属性 属性修正計算 #-------------------------------------------------------------------------- def calc_guard_taste(taste, base_rate) case taste when ATTR_NORMAL; return base_rate when ATTR_GOOD; return base_rate + TASTE_G_RATE when ATTR_BAD; return base_rate - TASTE_G_RATE else; p "unknown taste:{#taste}" end end #-------------------------------------------------------------------------- # ● 通常攻撃 攻撃力取得 #-------------------------------------------------------------------------- def atk_power(actor, base_atk) attr = atk_attr(actor) # 属性なしならデータベースのものを返す return base_atk if attr.id == 0 # 通常攻撃 攻撃力上昇率 rate = attr_atk_rate(attr.id, actor.id) * (attr.level-1) rate = calc_taste(actor.attr[attr.id].taste, rate) return base_atk + (base_atk * rate / 100).truncate end #-------------------------------------------------------------------------- # ● スキル攻撃力取得 #-------------------------------------------------------------------------- def skill_power(actor, skill) # 最優先属性ID取得 attr = skill_attr(actor, skill.id) # 属性なしならデータベースのものを返す return skill.power if attr.id == 0 # スキル攻撃力上昇率 rate = attr_skill_rate(attr.id, actor.id) * (attr.level-1) rate = calc_taste(actor.attr[attr.id].taste, rate) return skill.power + (skill.power * rate / 100).truncate end #-------------------------------------------------------------------------- # ● アイテム威力上昇率 取得 #-------------------------------------------------------------------------- def item_power_rate(actor, item) # 最優先属性ID取得 attr = item_attr(actor, item.id) # 属性なしなら0 return 0 if attr.id == 0 # アイテム威力上昇率 rate = attr_item_rate(attr.id, actor.id) * (attr.level-1) rate = calc_taste(actor.attr[attr.id].taste, rate) return rate end #-------------------------------------------------------------------------- # ● アイテム HP 回復率 取得 #-------------------------------------------------------------------------- def item_recover_hp_rate(actor, item) return item.recover_hp_rate + item_power_rate(actor, item) end #-------------------------------------------------------------------------- # ● アイテム HP 回復量 取得 #-------------------------------------------------------------------------- def item_recover_hp(actor, item) rate = item_power_rate(actor, item) return item.recover_hp + (item.recover_hp * rate / 100).truncate end #-------------------------------------------------------------------------- # ● アイテム SP 回復率 取得 #-------------------------------------------------------------------------- def item_recover_sp_rate(actor, item) return item.recover_sp_rate + item_power_rate(actor, item) end #-------------------------------------------------------------------------- # ● アイテム SP 回復量 取得 #-------------------------------------------------------------------------- def item_recover_sp(actor, item) rate = item_power_rate(actor, item) return item.recover_sp + (item.recover_sp * rate / 100).truncate end #-------------------------------------------------------------------------- # ● 属性修正 取得 #-------------------------------------------------------------------------- def attr_guard(actor, attr_id) rate = attr_guard_rate(attr_id, actor.id) * (actor.attr[attr_id].level-1) rate = calc_guard_taste(actor.attr[attr_id].taste, rate) return rate end #-------------------------------------------------------------------------- # ● 属性攻撃使用回数更新 #-------------------------------------------------------------------------- def element_use_count(actor, elements) return unless use_together_other_system(actor) # 併用認知 element_set = correct_element(elements) for attr_id in element_set old_level = actor.attr[attr_id].level actor.attr[attr_id].use_cnt += 1 # 使用回数のカウント if old_level < actor.attr[attr_id].level # レベルアップした場合は記憶 actor.attr_level_up.push(attr_id) end end end #-------------------------------------------------------------------------- # ● 属性攻撃使用回数再更新(後戻し) #-------------------------------------------------------------------------- def element_use_recount(actor, elements) return unless use_together_other_system(actor) # 併用認知 element_set = correct_element(elements) for attr_id in element_set actor.attr[attr_id].use_cnt -= 1 # 使用回数の再カウント end actor.attr_level_up = [] # レベルアップ情報は削除 end end #---------------------------------------------------------------------------- # ■ 熟練度クラス #---------------------------------------------------------------------------- class ActorAttr attr_accessor :use_cnt # 属性使用回数 attr_accessor :level # 属性レベル attr_accessor :lv_limit # 限界レベル attr_accessor :exp_list # 属性EXPリスト attr_accessor :taste # 属性好み #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(attr_id, actor_id) @attr_id = attr_id @actor_id = actor_id @level = SysUpdate.attr_first_lv(attr_id, actor_id) @lv_limit = SysUpdate.attr_limit_lv(attr_id, actor_id) @exp_list = SysUpdate.make_attr_list(attr_id, actor_id, @lv_limit) if !SysUpdate::GOOD_E[actor_id].nil? and SysUpdate::GOOD_E[actor_id].include?(attr_id) @taste = SysUpdate::ATTR_GOOD elsif !SysUpdate::BAD_E[actor_id].nil? and SysUpdate::BAD_E[actor_id].include?(attr_id) @taste = SysUpdate::ATTR_BAD else @taste = SysUpdate::ATTR_NORMAL end reset_use end #-------------------------------------------------------------------------- # ● 使用回数のリセット(現在のLV最小値に変更) #-------------------------------------------------------------------------- def reset_use @use_cnt = @exp_list[@level] end #-------------------------------------------------------------------------- # ● 使用回数設定 #-------------------------------------------------------------------------- def use_cnt=(exp) @use_cnt = [[exp, 9999999].min, 0].max # レベルアップ while levelup? and @exp_list[@level+1] > 0 @level += 1 end # レベルダウン while @use_cnt < @exp_list[@level] @level -= 1 end end #-------------------------------------------------------------------------- # ● レベルセット #-------------------------------------------------------------------------- def level=(new_level) return if new_level > @lv_limit return if new_level < 1 @level = new_level reset_use end #-------------------------------------------------------------------------- # ● レベルアップ判定 #-------------------------------------------------------------------------- def levelup? return false if limit_lv? # 最大レベル到達時は無視 return (@use_cnt >= @exp_list[@level+1]) end #-------------------------------------------------------------------------- # ● リミットレベル判定 #-------------------------------------------------------------------------- def limit_lv? return @level >= @lv_limit end #-------------------------------------------------------------------------- # ● 次のレベルアップ経験値 #-------------------------------------------------------------------------- def next_exp return @exp_list[@level+1] end #-------------------------------------------------------------------------- # ● 次のレベルアップまであといくら? #-------------------------------------------------------------------------- def diff_next_exp return @exp_list[@level+1] - @use_cnt end #-------------------------------------------------------------------------- # ● 得意属性? #-------------------------------------------------------------------------- def is_good_taste? return @taste == SysUpdate::ATTR_GOOD end #-------------------------------------------------------------------------- # ● 不得意属性? #-------------------------------------------------------------------------- def is_bad_taste? return @taste == SysUpdate::ATTR_BAD end end #---------------------------------------------------------------------------- # ■ 熟練度クラス #---------------------------------------------------------------------------- class ActorAttrList #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(actor_id) @actor_id = actor_id @attr = {} end #-------------------------------------------------------------------------- # ● 熟練度情報参照 #-------------------------------------------------------------------------- def [](attr_id) if @attr[attr_id].nil? if SysUpdate::ELEMENTS.include?(attr_id) @attr[attr_id] = ActorAttr.new(attr_id, @actor_id) else p "Game_Actor.attr[] 不正属性ID #{attr_id}" exit end end return @attr[attr_id] end end class Game_Actor attr_accessor :attr # 属性情報 attr_accessor :attr_level_up # レベルアップフラグ #-------------------------------------------------------------------------- # ● セットアップ #-------------------------------------------------------------------------- alias setup_sysupdate setup def setup(actor_id) setup_sysupdate(actor_id) @attr = ActorAttrList.new(actor_id) @attr_level_up = [] end #-------------------------------------------------------------------------- # ● 攻撃力の取得 #-------------------------------------------------------------------------- def atk ret_atk = super # 戦闘中のみ適応 if $game_temp.in_battle if self.weapon_id != 0 or defined?(Arm_Setting) ret_atk = SysUpdate.atk_power(self, ret_atk) end end return ret_atk end #-------------------------------------------------------------------------- # ● 属性補正値の取得 # element_id : 属性 ID #-------------------------------------------------------------------------- alias element_rate_sysupdate element_rate def element_rate(element_id) result = element_rate_sysupdate(element_id) # 原型 if SysUpdate::ELEMENTS.include?(element_id) # 熟練度対象の属性だけ result -= SysUpdate.attr_guard(self, element_id) # 熟練度による補正 end result = 0 if result < 0 and SysUpdate::G_NOT_RECOVER.include?(element_id) # 0未満にしない return result end end #============================================================================== # ■ Game_Battler #============================================================================== class Game_Battler #-------------------------------------------------------------------------- # ● スキルの効果適用 #-------------------------------------------------------------------------- alias skill_effect_sysupdate skill_effect def skill_effect(user, skill) if user.is_a?(Game_Actor) skill_base = $data_skills[skill.id].dup # 威力上昇 skill.power = SysUpdate.skill_power(user, skill) end ret = skill_effect_sysupdate(user, skill) if user.is_a?(Game_Actor) $data_skills[skill_base.id] = skill = skill_base.dup end return ret end #-------------------------------------------------------------------------- # ● 属性修正の計算 <再定義> # element_set : 属性 #-------------------------------------------------------------------------- def elements_correct(element_set) # 無属性の場合、100 を返す return 100 if element_set == [] elements = element_set.dup # 属性修正に含めない属性を除外 for ex in SysUpdate::EXCLUDE_ELEMENT elements.delete(ex) end # 無属性扱いになる場合、100 を返す return 100 if elements == [] # 属性修正計算 if SysUpdate::ELE_CORRECT_AVRAGE # 属性修正計算の仕様変更 # 与えられた属性の平均を返す # ※メソッド element_rate は、このクラスから継承される Game_Actor # および Game_Enemy クラスで定義される rate = 0 for i in elements rate += self.element_rate(i) end return (rate / elements.size).truncate else # デフォルト # 与えられた属性の中で最も弱いものを返す # ※メソッド element_rate は、このクラスから継承される Game_Actor # および Game_Enemy クラスで定義される weakest = -100 for i in elements weakest = [weakest, self.element_rate(i)].max end return weakest.truncate end end end #============================================================================== # ■ Scene_Battle #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # ● ミス判定 #-------------------------------------------------------------------------- def element_miss? for target in @target_battlers return false if target.damage != "Miss" # 命中ならOK. end return true end #-------------------------------------------------------------------------- # ● 基本アクション 結果作成 #-------------------------------------------------------------------------- alias make_basic_action_result_sysupdate make_basic_action_result def make_basic_action_result # 攻撃の場合 if @active_battler.current_action.basic == 0 and @active_battler.is_a?(Game_Actor) # 熟練度計算 SysUpdate.element_use_count(@active_battler, @active_battler.element_set) end make_basic_action_result_sysupdate # 原型 # 攻撃以外、敵なら無視 return if @active_battler.current_action.basic != 0 or @active_battler.is_a?(Game_Enemy) # ミスしていたなら回数を戻す SysUpdate.element_use_recount(@active_battler, @active_battler.element_set) if element_miss? end #-------------------------------------------------------------------------- # ● スキルアクション 結果作成 <再定義> #-------------------------------------------------------------------------- def make_skill_action_result enable_cnt = true # 閃き時には熟練度やスキルアップデートのカウントはしない if defined?(SysFlash) # 閃き判定(エネミー閃き時を考慮するとこのタイミング) SysFlash.skill_flash(@active_battler) enable_cnt = false if @active_battler.flash_flg end # スキルを取得 @skill = $data_skills[@active_battler.current_action.skill_id] # 強制アクションでなければ unless @active_battler.current_action.forcing # SP 切れなどで使用できなくなった場合 unless @active_battler.skill_can_use?(@skill.id) # アクション強制対象のバトラーをクリア $game_temp.forcing_battler = nil # ステップ 1 に移行 @phase4_step = 1 return end end if enable_cnt # 閃いてないときだけ。 enable_attr_lvup = true if defined?(SkillUpdate) and @active_battler.is_a?(Game_Actor) and SkillUpdate.can_update?(@active_battler) old_level = @active_battler.skill[@skill.id].level # スキル使用回数を加算 @active_battler.skill[@skill.id].use_cnt += 1 @actor_skill_lv_up = (old_level < @active_battler.skill[@skill.id].level ? true : false) enable_attr_lvup = false if @actor_skill_lv_up end if defined?(SysUpdate) and @active_battler.is_a?(Game_Actor) and enable_attr_lvup # 熟練度計算 SysUpdate.element_use_count(@active_battler, @skill.element_set) end end # SP 消費 if defined?(SysFlash) and SysFlash::FLASH_COST and @active_battler.flash_flg # 閃き時はSP消費なし elsif defined?(SysSkill_BP) and !SysSkill_BP::BATTLE_SP_USE # スキルBP制で戦闘中のSP消費なしなら何もしない elsif defined?(SkillUpdate) and SkillUpdate::SP_COST_DOWN and @active_battler.is_a?(Game_Actor) @active_battler.sp -= @active_battler.skill[@skill.id].sp_cost else # 原型 @active_battler.sp -= @skill.sp_cost end # BP消費 if defined?(SysSkill_BP) @active_battler.bp -= SysSkill_BP.bp_cost(@skill.id) end # ステータスウィンドウをリフレッシュ @status_window.refresh # ヘルプウィンドウにスキル名を表示 @help_window.set_text(@skill.name, 1) # アニメーション ID を設定 @animation1_id = @skill.animation1_id # アニメーション変化 if defined?(SkillUpdate) and SkillUpdate::USE_S_ANIME @animation2_id = SkillUpdate.skill_anime(@skill, @active_battler) else @animation2_id = @skill.animation2_id end # コモンイベント ID を設定 @common_event_id = @skill.common_event_id # 対象側バトラーを設定 set_target_battlers(@skill.scope) miss_flag = true # スキルの効果を適用 for target in @target_battlers target.skill_effect(@active_battler, @skill) miss_flag = false if target.damage != "Miss" # 一体でも命中ならOK. end if miss_flag and enable_cnt # ミス時はカウント戻す if defined?(SkillUpdate) and @active_battler.is_a?(Game_Actor) and SkillUpdate.can_update?(@active_battler) @active_battler.skill[@skill.id].use_cnt -= 1 @actor_skill_lv_up = false end if defined?(SysUpdate) and @active_battler.is_a?(Game_Actor) and enable_attr_lvup SysUpdate.element_use_recount(@active_battler, @skill.element_set) end end # スキル名表示を閃きアニメーションの後にする if defined?(SysFlash) and SysFlash::FLASH_SKILL_TEXT and @active_battler.flash_flg @help_window.visible = false # ヘルプ消去 @flash_skill_text = false # 消去したことを記憶 end end #-------------------------------------------------------------------------- # ● アイテムアクション 結果作成 #-------------------------------------------------------------------------- alias make_item_action_result_sysupdate make_item_action_result def make_item_action_result item_id = @active_battler.current_action.item_id if @active_battler.is_a?(Game_Actor) and $game_party.item_can_use?(item_id) item_base = $data_items[item_id].dup $data_items[item_id].recover_hp_rate = SysUpdate.item_recover_hp_rate(@active_battler, item_base) $data_items[item_id].recover_hp = SysUpdate.item_recover_hp(@active_battler, item_base) $data_items[item_id].recover_sp_rate = SysUpdate.item_recover_sp_rate(@active_battler, item_base) $data_items[item_id].recover_sp = SysUpdate.item_recover_sp(@active_battler, item_base) # 熟練度計算 SysUpdate.element_use_count(@active_battler, item_base.element_set) end make_item_action_result_sysupdate # 原型 # 敵なら無視 return if @active_battler.is_a?(Game_Enemy) or @phase4_step == 1 @item = $data_items[item_id] = item_base.dup # ミスしていたなら回数を戻す SysUpdate.element_use_recount(@active_battler, @item.element_set) if element_miss? end end #============================================================================== # ■ レベルアップ表示専用処理 START #============================================================================== if SysUpdate::SHOW_LV_UP == 1 #============================================================================== # ■ Window_Attribute #============================================================================== class Window_Attribute < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor : アクター #-------------------------------------------------------------------------- def initialize(actor) @actor = actor @element = actor.attr_level_up.dup win_width = 160 + 32 win_height = 32 * @element.size + 32 # アクターの頭上に表示 x_pos = actor.screen_x - 96 y_pos = 320 - win_height super(x_pos, y_pos, win_width, win_height) self.contents = Bitmap.new(width - 32, height - 32) self.opacity = 0 self.z = 100 refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh for i in 0...@element.size self.contents.font.color = normal_color draw_attr_icon_pm(@actor, @element[i], 4, 10 + i*32) self.contents.draw_text(40, i*32+4, 48, 32, @actor.attr[@element[i]].level.to_s) self.contents.font.color = Color.new(255, 64, 0) self.contents.draw_text(65, i*32+4, 150, 32, "Level UP!") end end end class Scene_Battle #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始) #-------------------------------------------------------------------------- alias update_phase4_step2_attribute update_phase4_step2 def update_phase4_step2 if @active_battler.is_a?(Game_Actor) @active_battler.attr_level_up = [] end @attr_lvup = false update_phase4_step2_attribute # 原物 end #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション) #-------------------------------------------------------------------------- alias update_phase4_step3_attribute update_phase4_step3 def update_phase4_step3 if @active_battler.is_a?(Game_Actor) if !@active_battler.attr_level_up.empty? and !@attr_lvup @attr_lvup = true @attr_lv_up_window = Window_Attribute.new(@active_battler) # LVアップSE演奏 if SysUpdate::SHOW_LV_SE != nil Audio.se_play("Audio/SE/" + SysUpdate::SHOW_LV_SE) end @active_battler.attr_level_up = [] return end end update_phase4_step3_attribute end #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ) #-------------------------------------------------------------------------- alias update_phase4_step6_attribute update_phase4_step6 def update_phase4_step6 if @active_battler.is_a?(Game_Actor) and !@attr_lv_up_window.nil? @attr_lv_up_window.dispose @attr_lv_up_window = nil @active_battler.attr_level_up = [] @attr_lvup = false end update_phase4_step6_attribute # 原物 end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias update_attribute update def update # レベルアップ表示中 if @attr_lvup and @attr_lv_up_window.contents_opacity > 0 @attr_lv_up_window.contents_opacity -= SysUpdate::LV_OPA_SPEED end update_attribute # 原物 end end end # if SysUpdate::SHOW_LV_UP == 1 if SysUpdate::SHOW_LV_UP == 2 class Scene_Battle #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション) #-------------------------------------------------------------------------- alias update_phase4_step3_sysupdate update_phase4_step3 def update_phase4_step3 update_phase4_step3_sysupdate # Lvupアニメーション表示 if @active_battler.is_a?(Game_Actor) and !@active_battler.attr_level_up.empty? # 行動側アニメーションを変更 @active_battler.animation_id = SysUpdate::LEVELUP_ANIME # ステップ 3 に最移行 @phase4_step = 3 @active_battler.attr_level_up = [] # 終了 end end end end # SysUpdate::SHOW_LV_UP == 2 #============================================================================== # ■ レベルアップ表示専用処理 END #============================================================================== #============================================================================== # ■ Interpreter [イベントスクリプト操作] #============================================================================== class Interpreter #-------------------------------------------------------------------------- # ● 熟練度設定(レベルセット) # actor_id : アクターID # attr_id : 属性ID # level : 設定レベル #-------------------------------------------------------------------------- def set_element_level(actor_id, attr_id, level) $game_actors[actor_id].attr[attr_id].level = level end #-------------------------------------------------------------------------- # ● 熟練度設定(レベルアップ) # actor_id : アクターID # element : 属性ID #-------------------------------------------------------------------------- def element_level_up(actor_id, attr_id) $game_actors[actor_id].attr[attr_id].level += 1 end #-------------------------------------------------------------------------- # ● 熟練度設定(レベルダウン) # actor_id : アクターID # attr_id : 属性ID #-------------------------------------------------------------------------- def element_level_down(actor_id, attr_id) $game_actors[actor_id].attr[attr_id].level -= 1 end #-------------------------------------------------------------------------- # ● 熟練度設定(熟練度上限操作) # actor_id : アクターID # attr_id : 属性ID # limit : 熟練度上限値 #-------------------------------------------------------------------------- def set_element_limit(actor_id, attr_id, limit) actor = $game_actors[actor_id] actor.attr[attr_id].lv_limit = limit if actor.attr[attr_id].level > limit set_element_level(actor_id, attr_id, limit) end end #-------------------------------------------------------------------------- # ● 得意属性/不得意属性の操作 # actor_id :アクターID # attr_id :属性ID # cnt_cmd :操作コマンド # 0:得意属性/不得意属性から解除 # 1:得意属性に設定 # 2:不得意属性に設定 #-------------------------------------------------------------------------- def control_attr(actor_id, attr_id, cnt_cmd) $game_actors[actor_id].attr[attr_id].taste = cnt_cmd end end #============================================================================== # ■ Window_Base #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● レベル限界色の指定(数値を変えると色が変わります) #-------------------------------------------------------------------------- def limit_lv_color return Color.new(255, 255, 64, 255) end #-------------------------------------------------------------------------- # ● レベルの描画 # actor : アクター # attr_id : レベルを表示させる属性 # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_actor_attr_level(actor, attr_id, x, y) self.contents.font.color = system_color self.contents.draw_text(x, y, 32, 32, "Lv") self.contents.font.color = actor.attr[attr_id].limit_lv? ? limit_lv_color : normal_color self.contents.draw_text(x + 32, y, 24, 32, actor.attr[attr_id].level.to_s, 2) self.contents.font.color = normal_color end #-------------------------------------------------------------------------- # ● アイコンの描画 # attr_id : アイコンを表示する属性 # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_attr_icon(attr_id, x, y) bitmap = RPG::Cache.icon(SysUpdate::ELE_ICON[attr_id]) src_rect = Rect.new(0, 0, bitmap.width, bitmap.height) self.contents.blt(x, y, bitmap, src_rect) end #-------------------------------------------------------------------------- # ● アイコン(+)の描画 # attr_id : アイコンを表示する属性 # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_attr_icon_p(attr_id, x, y) draw_attr_icon(attr_id, x, y) self.contents.draw_text(x+16, y-8, 24, 24, "+") end #-------------------------------------------------------------------------- # ● アイコン(-)の描画 # attr_id : アイコンを表示する属性 # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_attr_icon_m(attr_id, x, y) draw_attr_icon(attr_id, x, y) self.contents.draw_text(x+16, y-8, 24, 24, "-") end #-------------------------------------------------------------------------- # ● アイコン(+/-自動付与式)の描画 # actor : アクター # attr_id : アイコンを表示する属性 # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_attr_icon_pm(actor, attr_id, x, y) case actor.attr[attr_id].taste when SysUpdate::ATTR_NORMAL; draw_attr_icon(attr_id, x, y) when SysUpdate::ATTR_GOOD; draw_attr_icon_p(attr_id, x, y) when SysUpdate::ATTR_BAD; draw_attr_icon_m(attr_id, x, y) end end #-------------------------------------------------------------------------- # ● アイコン + Lvの描画 # actor : アクター # attr_id : アイコンを表示する属性 # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_attr_icon_lv(actor, attr_id, x, y) draw_attr_icon_pm(actor, attr_id, x, y+4) draw_actor_attr_level(actor, attr_id, x+32, y) end #-------------------------------------------------------------------------- # ● 熟練度Nextの表示(使用回数/NEXT) # actor : アクター # attr_id : 表示する属性 # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_attr_current_next(actor, attr_id, x, y) next_exp = actor.attr[attr_id].limit_lv? ? "−" : actor.attr[attr_id].next_exp.to_s attr_exp = actor.attr[attr_id].use_cnt.to_s + " / " + next_exp self.contents.draw_text(x, y, 100, 32, attr_exp) end #-------------------------------------------------------------------------- # ● 熟練度Nextの表示(次のLVまでいくら) # actor : アクター # attr_id : 表示する属性 # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_attr_next(actor, attr_id, x, y) next_exp = actor.attr[attr_id].limit_lv? ? "−" : actor.attr[attr_id].diff_next_exp.to_s attr_exp = actor.attr[attr_id].use_cnt.to_s + " / " + next_exp self.contents.draw_text(x, y, 100, 32, attr_exp) end end