Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
- #_/ ◆ Skill CP System - KGC_SkillCPSystem ◆ VX ◆
- #_/ ◇ Last Update: 03/31/2009
- #_/ ◆ Written by TOMY
- #_/ ◆ Translation by Mr. Anonymous
- #_/ ◆ KGC Site:
- #_/ ◆ http://ytomy.sakura.ne.jp/
- #_/ ◆ Translator's Blog:
- #_/ ◆ http://mraprojects.wordpress.com
- #_/-----------------------------------------------------------------------------
- #_/ This script allows the designer to limit the amount of skills the player
- #_/ may have at his disposal in battle. The player may assign skills the
- #_/ actor has learned to an available skills list by using CP. Additional CP
- #_/ is gained upon level-up.
- #_/-----------------------------------------------------------------------------
- #_/ ◆ Instructions For Usage ◆
- #_/ ◆ Assign CP Cost to a skill:
- #_/ To manually set individual CP requirements to a given skill, locate the
- #_/ desired skill in the Skills tab of the database, and enter:
- #_/
- #_/ <CP Value>
- #_/
- #_/ into that skill's "Note" box.
- #_/ Where Value = the desired number of CP it costs to assign that skill to
- #_/ a skill slot.
- #_/ Example: You'd like Dual Strike to cost 2 CP to equip. You'd locate
- #_/ 'Dual Strike' in the database an insert <CP 2> in the notebox.
- #_/
- #_/ ◆ Increase/Decrease MAX CP by equipping item:
- #_/ To create an equipable item that changes an actor's MAX CP, locate the
- #_/ desired item in the Weapons or Armors tab of the database, and enter:
- #_/
- #_/ <MAX CP Modifier Value> OR <max CP Modifier Value>
- #_/
- #_/ into that item's "Note" box.
- #_/ Where Modifier = + (Addition) or - (Subtraction)
- #_/ Where Value = the desired number of CP that is increased/decreased.
- #_/
- #_/ Example: You'd like Long Sword to add 1 CP when equipped. You'd locate
- #_/ 'Long Sword' in the database an insert <MAX CP + 1> in the notebox.
- #_/
- #_/ ◆ Increase/Decrease Max Battle Skill Slots by equipping item:
- #_/ To create an equipable item that changes an actor's max battle skill slots,
- #_/ locate the desired item in the Weapons or Armors tab of the database, enter:
- #_/
- #_/ <BATTLE_SKILL_MAX Modifier Value> OR <max_battle_skill Modifier Value>
- #_/
- #_/ into that item's "Note" box.
- #_/ Where Modifier = + (Addition) or - (Subtraction)
- #_/ Where Value = the desired number of slots that to increase/decrease.
- #_/
- #_/ Example: You'd like Leather Shield to reduce the actor's maximum battle
- #_/ skill slots by 2 when equipped. You'd locate 'Leather Shield' in the
- #_/ armor database an insert <BATTLE_SKILL_MAX - 2> in the notebox.
- #_/
- #_/
- #_/ ◆ Script Commands ◆
- #_/ These commands are used in "Script" function in the third page of event
- #_/ commands under "Advanced".
- #_/
- #_/ * set_own_cp(ActorID, Value)
- #_/ This allows you to set an individual actor's CP. This value cannot
- #_/ exceed the default settings for CP_MAX (See the Customization block.)
- #_/
- #_/ * set_battle_skill_max(ActorID, Value)
- #_/ This allows you to set the maximum amount of skill slots available to
- #_/ a individual actors in battle. When the value is omitted, the default
- #_/ value of MAX_SKILLS is returned. (See the Customization block.)
- #_/
- #_/ * set_battle_skill(ActorID, SkillSlot_index, SkillID)
- #_/ This function is still under testing.
- #_/
- #_/ * add_battle_skill(ActorID, SkillID)
- #_/ Adds a skill to the actor's available skill slots. If the slot is
- #_/ unavailable, nothing is added.
- #_/
- #_/ * gain_actor_cp(ActorID, Value)
- #_/ Allows you to change the amount of skill slots an actor has.
- #_/
- #_/ * clear_battle_skill(ActorID)
- #_/ All skills are removed from the actor's skill slots. (State: Amnesia!)
- #_/
- #_/ * call_set_battle_skill(ActorID)
- #_/ This calls the Set Skills screen for the selected actor.
- #_/
- #_/ [ Quick Key: ]
- #_/ [ ActorID = The ID number of the selected Actor in the database. ]
- #_/ [ ]
- #_/ [ SkillID = The ID number of the selected Skill in the database. ]
- #_/ [ ]
- #_/ [ Value = A set numerical value. ]
- #_/ [ ]
- #_/ [ SkillSlot_Index = The position of the actor's skill slots. ]
- #_/ [ ]
- #_/=============================================================================
- #_/ Install: Insert below KGC_EquipLearnSkill, if applicable.
- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
- #==============================================================================#
- # ★ Customization ★ #
- #==============================================================================#
- module KGC
- module SkillCPSystem
- # ◆ Skill CP Window Display Settings ◆
- # ◆ The maximum amount of skills a character is permitted to assign.
- MAX_SKILLS = 11
- # ◆ CP Display Text
- VOCAB_CP = "SP"
- # ◆ CP Display Text (Abbreviation)
- VOCAB_CP_A = "SP"
- # ◆ Display CP in status screen.
- SHOW_STATUS_CP = true
- # ◆ CP Values & Level Gain ◆
- # Default CP cost when not manually assigned to a skill using the <CP n> tag.
- DEFAULT_CP_COST = 1
- # This affects the maximum amount of CP that can be gained.
- CP_MAX = 40
- # This affects the amount of CP actors will begin with when initialized into
- # the party, including when the player starts the game.
- CP_MIN = 1
- # ◆ Revised CP Maximum
- # This affects the maximum amount of CP that can be gained when items that
- # increase CP are equipped.
- REVISED_CP_MAX = 50
- # ◆ Revised CP Minimum
- REVISED_CP_MIN = 0
- # ◆ CP Level Gain Calculation
- # Even if the result of this formula is a decimal, it's automatically
- # converted into an integer.
- # You may set this value to 0 if you plan on manually assigning each actor's
- # CP individually.
- CP_CALC_EXP = "level * 0.5 + 5.0"
- # ◆ Individual Actor CP Level Gain
- PERSONAL_CP_CALC_EXP = [] # <- Do not alter or remove!
- # Below here, you may specify formulas for individual actors that dictates
- # the amount of CP they recieve upon leveling up. Like CP_CALC_EXP, the
- # result is converted to an integer.
- # Format: PERSONAL_CP_CALC_EXP[ActorID] = "Formula"
- # The format is just like CP_CALC_EXP, except each actor is defined after
- # PERSONAL_CP_CALC_EXP in brackets [].
- # Any actor not specified uses the CP_CALC_EXP formula.
- # Example:
- # PERSONAL_CP_CALC_EXP[1] = "level * 0.8 + 2.0"
- # ◆ Insert Personal CP Calculations Below Here ◆
- ### PERSONAL_CP_CALC_EXP[1] = "level * 0.8 + 2.0"
- # ◆ Disable Skill CP System During Battle Test
- # true : Disables the Skill CP System during Battle Test
- # false : Enables the Skill CP System during Battle Test (may cause errors)
- DISABLE_IN_BATTLETEST = true
- # ◆ Misc CP Settings Toggles ◆
- # This toggle allows you to show skills in the Set Skills window when the
- # actor doesn't meet the requirements to use that skill, such as
- # insufficient MP.
- # true = Unusuable skills are shown (and able to be set/assigned).
- # false = Unusuable skill
- SHOW_UNUSABLE_SKILL = true #AHHHHHHHHHHHHHHHHHHH
- # ◆ This toggle allows the player to use CP skills even if the CP value is 0.
- USABLE_COST_ZERO_SKILL = true
- # This toggle allows you to change whether Passive Skills (KCG_PassiveSkill)
- # need to be set by the player in order for their effects to take place.
- # *Note: As of now, KCG_HiddenSkills takes no effect on this menu even if
- # PASSIVE_NEED_TO_SET = false
- # true = Passive Skills must be set by the player.
- # false = Passive Skills effects are automatically in effect.
- PASSIVE_NEED_TO_SET = false
- # ◆ Automatically Set New Skills
- # This toggle allows you to specify whether new skills are automatically
- # assigned to skill slots.
- # true : Automatically assign new skills to skill slots.
- # * Skills aquired from KGC_EquipLearnSkill are not automatically set.
- # false : Require new skills to be set manually.
- AUTO_SET_NEW_SKILL = true
- # ◆ Display 0 CP Cost
- # true : 0 CP Cost is displayed
- # false : Only 0 or higher CP cost is displayed
- SHOW_ZERO_COST = false
- # ◆ CP Gauge Colorization ◆
- # This allows you to change the color of the guages that appear under in the
- # CP bar. By default, the colors are determined by system colors (the same as
- # changing the color of text (\c[n]) in the 'Show Message...' event command).
- # The color can also be determined by red, green, and blue values:
- # Example: GAUGE_END_COLOR = Color.new(255, 0, 0) <- This is red.
- # This is the fill color for the early phase of the guage.
- GAUGE_START_COLOR = 13
- # This is the fill color for the late phase of the guage. (When Full)
- GAUGE_END_COLOR = 5
- # ◆ Command Menu ◆
- # This toggle adds the "Assign Skills" (Set Skills) selection to the main
- # command menu.
- USE_MENU_SET_SKILL_COMMAND = true
- # Text of the Set Skills selection on the main command window.
- VOCAB_MENU_SET_SKILL = "Set Skills"
- # ◆ Misc Vocab Settings ◆
- # This allows you to change the text displayed in empty skill slots.
- BLANK_TEXT = "- EMPTY -"
- # This allows you to change the text in the assigned skills header.
- RELEASE_TEXT = "(- NONE -)"
- end
- end
- #=============================================================================#
- # ★ End Customization ★ #
- #=============================================================================#
- #=================================================#
- # IMPORT #
- #=================================================#
- $imported = {} if $imported == nil
- $imported["SkillCPSystem"] = true
- #=================================================#
- #==============================================================================
- # □ KGC::SkillCPSystem::Regexp
- #==============================================================================
- # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
- # Note Field Tag Strings #
- # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
- # Whatever word(s) are after the separator ( | ) in the following lines are
- # what are used to determine what is searched for in the "Note" section of a
- # skill or equipment.
- module KGC::SkillCPSystem
- # Regular Expressions Module
- module Regexp
- # Base Item Module
- module BaseItem
- # Max CP Plus tag string
- MAXCP_PLUS = /<(?:MAX|max)CP\s*([\-\+]?\d+)>/
- # Max Battle Skill Plus tag string
- BATTLE_SKILL_MAX = /<(?:BATTLE_SKILL_MAX|max_battle_skill)\s*([\-\+]?\d+)>/i
- end
- # Skill Module
- module Skill
- # CP Cost tag string
- CP_COST = /<CP\s*(\d+)>/i
- end
- end
- end
- #=================================================#
- #==============================================================================
- # □ KGC::Commands
- #==============================================================================
- module KGC
- module Commands
- module_function
- #--------------------------------------------------------------------------
- # ○ MaxCP 補正値の取得
- # actor_id : アクター ID
- # variable_id : 取得した値を代入する変数の ID
- #--------------------------------------------------------------------------
- def get_actor_own_cp(actor_id, variable_id = 0)
- value = $game_actors[actor_id].maxcp_plus
- $game_variables[variable_id] = value if variable_id > 0
- return value
- end
- alias get_own_cp get_actor_own_cp unless $@
- #--------------------------------------------------------------------------
- # ○ MaxCP 補正値の変更
- # actor_id : アクター ID
- # value : MaxCP 補正値
- #--------------------------------------------------------------------------
- def set_actor_own_cp(actor_id, value)
- $game_actors[actor_id].maxcp_plus = value
- end
- alias set_own_cp set_actor_own_cp unless $@
- #--------------------------------------------------------------------------
- # ○ アクターの MaxCP 補正値の増加
- # actor_id : アクター ID
- # value : 増加量
- #--------------------------------------------------------------------------
- def gain_actor_cp(actor_id, value)
- $game_actors[actor_id].maxcp_plus += value
- end
- #--------------------------------------------------------------------------
- # ○ 登録スキル最大数の取得
- # actor_id : アクター ID
- # variable_id : 取得した値を代入する変数の ID
- #--------------------------------------------------------------------------
- def get_battle_skill_max(actor_id, variable_id = 0)
- value = $game_actors[actor_id].battle_skill_max
- $game_variables[variable_id] = value if variable_id > 0
- return value
- end
- #--------------------------------------------------------------------------
- # ○ 登録スキル最大数の変更
- # actor_id : アクター ID
- # value : 登録可能数
- #--------------------------------------------------------------------------
- def set_battle_skill_max(actor_id, value = -1)
- $game_actors[actor_id].battle_skill_max = value
- end
- #--------------------------------------------------------------------------
- # ○ スキルが登録されているか
- # actor_id : アクター ID
- # skill_id : 確認するスキル ID
- #--------------------------------------------------------------------------
- def battle_skill_set?(actor_id, skill_id)
- return $game_actors[actor_id].battle_skill_ids.include?(skill_id)
- end
- #--------------------------------------------------------------------------
- # ○ スキルの登録
- # actor_id : アクター ID
- # index : 登録箇所
- # skill_id : 登録するスキル ID (nil で解除)
- #--------------------------------------------------------------------------
- def set_battle_skill(actor_id, index, skill_id = nil)
- actor = $game_actors[actor_id]
- if skill_id.is_a?(Integer)
- # 登録
- skill = $data_skills[skill_id]
- return unless actor.battle_skill_settable?(index, skill) # セット不可
- actor.set_battle_skill(index, skill)
- actor.restore_battle_skill
- else
- # 解除
- actor.remove_battle_skill(index)
- end
- end
- #--------------------------------------------------------------------------
- # ○ スキルの追加登録
- # actor_id : アクター ID
- # skill_id : 登録するスキル ID
- #--------------------------------------------------------------------------
- def add_battle_skill(actor_id, skill_id)
- actor = $game_actors[actor_id]
- skill = $data_skills[skill_id]
- return if actor == nil || skill == nil
- actor.add_battle_skill(skill)
- end
- #--------------------------------------------------------------------------
- # ○ スキルの全解除
- # actor_id : アクター ID
- #--------------------------------------------------------------------------
- def clear_battle_skill(actor_id)
- $game_actors[actor_id].clear_battle_skill
- end
- #--------------------------------------------------------------------------
- # ○ スキル設定画面の呼び出し
- # actor_index : アクターインデックス
- #--------------------------------------------------------------------------
- def call_set_battle_skill(actor_index = 0)
- return if $game_temp.in_battle
- $game_temp.next_scene = :set_battle_skill
- $game_temp.next_scene_actor_index = actor_index
- end
- end
- end
- class Game_Interpreter
- include KGC::Commands
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Vocab
- #==============================================================================
- module Vocab
- # CP
- def self.cp
- return KGC::SkillCPSystem::VOCAB_CP
- end
- # CP (略)
- def self.cp_a
- return KGC::SkillCPSystem::VOCAB_CP_A
- end
- # スキル設定
- def self.set_battle_skill
- return KGC::SkillCPSystem::VOCAB_MENU_SET_SKILL
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ RPG::BaseItem
- #==============================================================================
- class RPG::BaseItem
- #--------------------------------------------------------------------------
- # ○ スキルCP制のキャッシュを生成
- #--------------------------------------------------------------------------
- def create_skill_cp_system_cache
- @__maxcp_plus = 0
- @__battle_skill_max_plus = 0
- self.note.each_line { |line|
- case line
- when KGC::SkillCPSystem::Regexp::BaseItem::MAXCP_PLUS
- # 最大 CP
- @__maxcp_plus += $1.to_i
- when KGC::SkillCPSystem::Regexp::BaseItem::BATTLE_SKILL_MAX
- # 登録スキル数
- @__battle_skill_max_plus += $1.to_i
- end
- }
- end
- #--------------------------------------------------------------------------
- # ○ 最大 CP 補正
- #--------------------------------------------------------------------------
- def maxcp_plus
- create_skill_cp_system_cache if @__maxcp_plus == nil
- return @__maxcp_plus
- end
- #--------------------------------------------------------------------------
- # ○ 登録スキル数補正
- #--------------------------------------------------------------------------
- def battle_skill_max_plus
- create_skill_cp_system_cache if @__battle_skill_max_plus == nil
- return @__battle_skill_max_plus
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ RPG::Skill
- #==============================================================================
- class RPG::Skill < RPG::UsableItem
- #--------------------------------------------------------------------------
- # ○ スキルCP制のキャッシュを生成
- #--------------------------------------------------------------------------
- def create_skill_cp_system_cache
- @__cp_cost = KGC::SkillCPSystem::DEFAULT_CP_COST
- self.note.each_line { |line|
- case line
- when KGC::SkillCPSystem::Regexp::Skill::CP_COST
- # 消費 CP
- @__cp_cost = $1.to_i
- end
- }
- end
- #--------------------------------------------------------------------------
- # ○ 消費 CP
- #--------------------------------------------------------------------------
- def cp_cost
- create_skill_cp_system_cache if @__cp_cost == nil
- return @__cp_cost
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Battler
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # ○ 戦闘用スキルセット済み判定
- # skill : スキル
- #--------------------------------------------------------------------------
- def battle_skill_set?(skill)
- return true
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_writer :maxcp_plus # MaxCP 補正値
- #--------------------------------------------------------------------------
- # ○ MaxCP 取得
- #--------------------------------------------------------------------------
- def maxcp
- calc_exp = KGC::SkillCPSystem::PERSONAL_CP_CALC_EXP[self.id]
- if calc_exp == nil
- calc_exp = KGC::SkillCPSystem::CP_CALC_EXP
- end
- n = Integer(eval(calc_exp))
- n = [[n, cp_limit].min, KGC::SkillCPSystem::CP_MIN].max
- n += maxcp_plus + maxcp_plus_equip
- return [[n, revised_cp_limit].min, KGC::SkillCPSystem::REVISED_CP_MIN].max
- end
- #--------------------------------------------------------------------------
- # ○ CP 取得
- #--------------------------------------------------------------------------
- def cp
- return [maxcp - consumed_cp, 0].max
- end
- #--------------------------------------------------------------------------
- # ○ CP 消費量取得
- #--------------------------------------------------------------------------
- def consumed_cp
- n = 0
- battle_skills.compact.each { |skill| n += skill.cp_cost }
- return n
- end
- #--------------------------------------------------------------------------
- # ○ CP 上限取得
- #--------------------------------------------------------------------------
- def cp_limit
- return KGC::SkillCPSystem::CP_MAX
- end
- #--------------------------------------------------------------------------
- # ○ 補正後の CP 上限取得
- #--------------------------------------------------------------------------
- def revised_cp_limit
- return KGC::SkillCPSystem::REVISED_CP_MAX
- end
- #--------------------------------------------------------------------------
- # ○ MaxCP 補正値取得
- #--------------------------------------------------------------------------
- def maxcp_plus
- if @maxcp_plus == nil
- if @own_cp != nil
- @maxcp_plus = @own_cp
- @own_cp = nil
- else
- @maxcp_plus = 0
- end
- end
- return @maxcp_plus
- end
- #--------------------------------------------------------------------------
- # ○ 装備品による MaxCP 補正値取得
- #--------------------------------------------------------------------------
- def maxcp_plus_equip
- n = 0
- equips.compact.each { |item| n += item.maxcp_plus }
- return n
- end
- #--------------------------------------------------------------------------
- # ● スキル取得
- #--------------------------------------------------------------------------
- alias skills_KGC_SkillCPSystem skills unless $@
- def skills
- return (skill_cp_restrict? ? restricted_skills : skills_KGC_SkillCPSystem)
- end
- #--------------------------------------------------------------------------
- # ○ スキルを制限するか
- #--------------------------------------------------------------------------
- def skill_cp_restrict?
- if $game_temp.in_battle
- # 戦闘テストでないか、戦闘テストでも制限する場合
- return true unless $BTEST && KGC::SkillCPSystem::DISABLE_IN_BATTLETEST
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ○ スキルを制限
- #--------------------------------------------------------------------------
- def restricted_skills
- result = all_skills
- result.each_with_index { |skill, i|
- # 消費 CP > 0 のスキルを除外
- if !KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL || skill.cp_cost > 0
- result[i] = nil
- end
- # パッシブスキルを除外
- if $imported["PassiveSkill"] && KGC::SkillCPSystem::PASSIVE_NEED_TO_SET
- if skill.passive &&
- (!KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL || skill.cp_cost > 0)
- result[i] = nil
- end
- end
- }
- result.compact!
- # 戦闘スキルを追加
- result |= battle_skills
- result.sort! { |a, b| a.id <=> b.id }
- return result
- end
- #--------------------------------------------------------------------------
- # ○ 全スキル取得
- #--------------------------------------------------------------------------
- def all_skills
- # 一時的に非戦闘中にする
- last_in_battle = $game_temp.in_battle
- $game_temp.in_battle = false
- result = skills_KGC_SkillCPSystem
- if $imported["EquipLearnSkill"]
- result |= (equipment_skills | full_ap_skills)
- result.sort! { |a, b| a.id <=> b.id }
- end
- # 戦闘中フラグを戻す
- $game_temp.in_battle = last_in_battle
- return result
- end
- #--------------------------------------------------------------------------
- # ○ 登録スキル最大数取得
- #--------------------------------------------------------------------------
- def battle_skill_max
- @battle_skill_max = -1 if @battle_skill_max == nil
- n = (@battle_skill_max < 0 ?
- KGC::SkillCPSystem::MAX_SKILLS : @battle_skill_max)
- n += equipment_battle_skill_max_plus
- return [n, 0].max
- end
- #--------------------------------------------------------------------------
- # ○ 装備品による登録スキル数補正
- #--------------------------------------------------------------------------
- def equipment_battle_skill_max_plus
- n = 0
- equips.compact.each { |item| n += item.battle_skill_max_plus }
- return n
- end
- #--------------------------------------------------------------------------
- # ○ 登録スキル最大数設定
- #--------------------------------------------------------------------------
- def battle_skill_max=(value)
- @battle_skill_max = value
- if @battle_skills == nil
- @battle_skills = []
- else
- @battle_skills = @battle_skills[0...value]
- end
- restore_passive_rev if $imported["PassiveSkill"]
- end
- #--------------------------------------------------------------------------
- # ○ 戦闘用スキル ID 取得
- #--------------------------------------------------------------------------
- def battle_skill_ids
- @battle_skills = [] if @battle_skills == nil
- return @battle_skills
- end
- #--------------------------------------------------------------------------
- # ○ 戦闘用スキル取得
- #--------------------------------------------------------------------------
- def battle_skills
- result = []
- battle_skill_ids.each { |i|
- next if i == nil # 無効なスキルは無視
- result << $data_skills[i]
- }
- return result
- end
- #--------------------------------------------------------------------------
- # ○ 戦闘用スキル登録
- # index : 位置
- # skill : スキル (nil で解除)
- #--------------------------------------------------------------------------
- def set_battle_skill(index, skill)
- if skill == nil
- @battle_skills[index] = nil
- else
- return unless skill.is_a?(RPG::Skill) # スキル以外
- return if cp < skill.cp_cost # CP 不足
- return if KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL && skill.cp_cost == 0
- @battle_skills[index] = skill.id
- end
- restore_passive_rev if $imported["PassiveSkill"]
- end
- #--------------------------------------------------------------------------
- # ○ 戦闘用スキル追加登録
- # skill : スキル
- #--------------------------------------------------------------------------
- def add_battle_skill(skill)
- return unless skill.is_a?(RPG::Skill) # スキル以外
- skills = battle_skill_ids
- return if skills.include?(skill.id) # 登録済み
- return if cp < skill.cp_cost # CP 不足
- return if KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL && skill.cp_cost == 0
- battle_skill_max.times { |i|
- # 空きがあれば登録
- if skills[i] == nil
- set_battle_skill(i, skill)
- break
- end
- }
- restore_battle_skill
- end
- #--------------------------------------------------------------------------
- # ○ 戦闘用スキル解除
- # index : 位置
- #--------------------------------------------------------------------------
- def remove_battle_skill(index)
- @battle_skills[index] = nil
- restore_passive_rev if $imported["PassiveSkill"]
- end
- #--------------------------------------------------------------------------
- # ○ 戦闘用スキル全解除
- #--------------------------------------------------------------------------
- def clear_battle_skill
- @battle_skills = []
- restore_passive_rev if $imported["PassiveSkill"]
- end
- #--------------------------------------------------------------------------
- # ○ 戦闘用スキルセット可否判定
- # index : 位置
- # skill : スキル
- #--------------------------------------------------------------------------
- def battle_skill_settable?(index, skill)
- return false if battle_skill_max <= index # 範囲外
- return true if skill == nil # nil は解除なので OK
- return false if battle_skill_ids.include?(skill.id) # セット済み
- skill_id = battle_skill_ids[index]
- curr_skill = (skill_id != nil ? $data_skills[skill_id] : nil)
- offset = (curr_skill != nil ? curr_skill.cp_cost : 0)
- return false if self.cp < (skill.cp_cost - offset) # CP 不足
- return true
- end
- #--------------------------------------------------------------------------
- # ○ 戦闘用スキルを修復
- #--------------------------------------------------------------------------
- def restore_battle_skill
- result = battle_skill_ids.clone
- usable_skills = all_skills
- result.each_with_index { |n, i|
- next if n == nil
- # 未修得の場合は解除
- if (usable_skills.find { |s| s.id == n }) == nil
- result[i] = nil
- end
- }
- @battle_skills = result[0...battle_skill_max]
- # CP 不足のスキルを下から順に外す
- (battle_skill_max - 1).downto(0) { |i|
- @battle_skills[i] = nil if maxcp - consumed_cp < 0
- }
- end
- #--------------------------------------------------------------------------
- # ● 装備の変更 (オブジェクトで指定)
- # equip_type : 装備部位 (0..4)
- # item : 武器 or 防具 (nil なら装備解除)
- # test : テストフラグ (戦闘テスト、または装備画面での一時装備)
- #--------------------------------------------------------------------------
- alias change_equip_KGC_SkillCPSystem change_equip unless $@
- def change_equip(equip_type, item, test = false)
- change_equip_KGC_SkillCPSystem(equip_type, item, test)
- unless test
- restore_battle_skill
- restore_passive_rev if $imported["PassiveSkill"]
- end
- end
- #--------------------------------------------------------------------------
- # ● 装備の破棄
- # item : 破棄する武器 or 防具
- # 武器/防具の増減で「装備品も含める」のとき使用する。
- #--------------------------------------------------------------------------
- alias discard_equip_KGC_SkillCPSystem discard_equip unless $@
- def discard_equip(item)
- discard_equip_KGC_SkillCPSystem(item)
- restore_battle_skill
- restore_passive_rev if $imported["PassiveSkill"]
- end
- #--------------------------------------------------------------------------
- # ● 経験値の変更
- # exp : 新しい経験値
- # show : レベルアップ表示フラグ
- #--------------------------------------------------------------------------
- alias change_exp_KGC_SkillCPSystem change_exp unless $@
- def change_exp(exp, show)
- # 習得したスキルを表示するため、戦闘中フラグを一時的に解除
- last_in_battle = $game_temp.in_battle
- $game_temp.in_battle = false
- change_exp_KGC_SkillCPSystem(exp, show)
- $game_temp.in_battle = last_in_battle
- end
- if KGC::SkillCPSystem::AUTO_SET_NEW_SKILL
- #--------------------------------------------------------------------------
- # ● スキルを覚える
- # skill_id : スキル ID
- #--------------------------------------------------------------------------
- alias learn_skill_KGC_SkillCPSystem learn_skill unless $@
- def learn_skill(skill_id)
- learn_skill_KGC_SkillCPSystem(skill_id)
- add_battle_skill($data_skills[skill_id])
- end
- end # <- if KGC::SkillCPSystem::AUTO_SET_NEW_SKILL
- #--------------------------------------------------------------------------
- # ● スキルを忘れる
- # skill_id : スキル ID
- #--------------------------------------------------------------------------
- alias forget_skill_KGC_SkillCPSystem forget_skill unless $@
- def forget_skill(skill_id)
- # 忘れるスキルを戦闘用スキルから削除
- battle_skill_ids.each_with_index { |s, i|
- remove_battle_skill(i) if s == skill_id
- }
- forget_skill_KGC_SkillCPSystem(skill_id)
- end
- #--------------------------------------------------------------------------
- # ○ 戦闘用スキルセット済み判定
- # skill : スキル
- #--------------------------------------------------------------------------
- def battle_skill_set?(skill)
- return false unless skill.is_a?(RPG::Skill) # スキル以外
- return battle_skill_ids.include?(skill.id)
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Window_Base
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ○ CP の文字色を取得
- # actor : アクター
- #--------------------------------------------------------------------------
- def cp_color(actor)
- return knockout_color if actor.maxcp > 0 && actor.cp == 0
- return normal_color
- end
- #--------------------------------------------------------------------------
- # ○ CP ゲージの色 1 の取得
- #--------------------------------------------------------------------------
- def cp_gauge_color1
- color = KGC::SkillCPSystem::GAUGE_START_COLOR
- return (color.is_a?(Integer) ? text_color(color) : color)
- end
- #--------------------------------------------------------------------------
- # ○ CP ゲージの色 2 の取得
- #--------------------------------------------------------------------------
- def cp_gauge_color2
- color = KGC::SkillCPSystem::GAUGE_END_COLOR
- return (color.is_a?(Integer) ? text_color(color) : color)
- end
- #--------------------------------------------------------------------------
- # ○ CP の描画
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # width : 幅
- #--------------------------------------------------------------------------
- def draw_actor_cp(actor, x, y, width = 120)
- draw_actor_cp_gauge(actor, x, y, width)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 30, WLH, Vocab::cp_a)
- self.contents.font.color = cp_color(actor)
- xr = x + width
- if width < 120
- self.contents.draw_text(xr - 40, y, 40, WLH, actor.cp, 2)
- else
- self.contents.draw_text(xr - 90, y, 40, WLH, actor.cp, 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.maxcp, 2)
- end
- self.contents.font.color = normal_color
- end
- #--------------------------------------------------------------------------
- # ○ CP ゲージの描画
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # width : 幅
- #--------------------------------------------------------------------------
- def draw_actor_cp_gauge(actor, x, y, width = 120)
- gw = width * actor.cp / [actor.maxcp, 1].max
- gc1 = cp_gauge_color1
- gc2 = cp_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
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ 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_Status
- #==============================================================================
- if KGC::SkillCPSystem::SHOW_STATUS_CP
- class Window_Status < Window_Base
- #--------------------------------------------------------------------------
- # ● 基本情報の描画
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- #--------------------------------------------------------------------------
- alias draw_basic_info_KGC_SkillCPSystem draw_basic_info unless $@
- def draw_basic_info(x, y)
- draw_basic_info_KGC_SkillCPSystem(x, y)
- draw_actor_cp(@actor, x, y + WLH * 4)
- end
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # □ Window_BattleSkillStatus
- #------------------------------------------------------------------------------
- # 戦闘スキル設定画面で、設定者のステータスを表示するウィンドウです。
- #==============================================================================
- class Window_BattleSkillStatus < 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_cp(@actor, 240, 0)
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # □ Window_BattleSkillSlot
- #------------------------------------------------------------------------------
- # 戦闘スキル選択画面で、設定したスキルの一覧を表示するウィンドウです。
- #==============================================================================
- class Window_BattleSkillSlot < Window_Selectable
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # x : ウィンドウの X 座標
- # y : ウィンドウの Y 座標
- # width : ウィンドウの幅
- # height : ウィンドウの高さ
- # actor : アクター
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height, actor)
- super(x, y, width, height)
- @actor = actor
- self.index = 0
- self.active = false
- refresh
- end
- #--------------------------------------------------------------------------
- # ○ スキルの取得
- #--------------------------------------------------------------------------
- def skill
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- @data = []
- skill_ids = @actor.battle_skill_ids
- @actor.battle_skill_max.times { |i|
- if skill_ids[i] != nil
- @data << $data_skills[skill_ids[i]]
- else
- @data << nil
- end
- }
- @item_max = @data.size
- create_contents
- @item_max.times { |i| draw_item(i) }
- end
- #--------------------------------------------------------------------------
- # ○ 消費 CP 描画判定
- #--------------------------------------------------------------------------
- def cp_cost_show?(skill)
- return true if KGC::SkillCPSystem::SHOW_ZERO_COST
- return (skill.cp_cost > 0)
- end
- #--------------------------------------------------------------------------
- # ○ 項目の描画
- # index : 項目番号
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- skill = @data[index]
- if skill != nil
- rect.width -= 4
- draw_item_name(skill, rect.x, rect.y)
- self.contents.draw_text(rect, skill.cp_cost, 2) if cp_cost_show?(skill)
- else
- self.contents.draw_text(rect, KGC::SkillCPSystem::BLANK_TEXT, 1)
- end
- 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 update
- super
- return unless self.active
- if Input.repeat?(Input::RIGHT)
- Sound.play_cursor
- cursor_pagedown
- elsif Input.repeat?(Input::LEFT)
- Sound.play_cursor
- cursor_pageup
- end
- end
- #--------------------------------------------------------------------------
- # ● ヘルプテキスト更新
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(skill == nil ? "" : skill.description)
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # □ Window_BattleSkillList
- #------------------------------------------------------------------------------
- # 戦闘スキル選択画面で、設定できるスキルの一覧を表示するウィンドウです。
- #==============================================================================
- class Window_BattleSkillList < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :slot_index # スロット番号
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- # x : ウィンドウの X 座標
- # y : ウィンドウの Y 座標
- # width : ウィンドウの幅
- # height : ウィンドウの高さ
- # actor : アクター
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height, actor)
- super(x, y, width, height)
- @actor = actor
- @slot_index = 0
- self.index = 0
- self.active = false
- refresh
- end
- #--------------------------------------------------------------------------
- # ○ スキルの取得
- #--------------------------------------------------------------------------
- def skill
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- @data = [nil]
- # 選択可能なスキルのみを取得
- @actor.all_skills.each { |skill|
- @data.push(skill) if selectable?(skill)
- }
- @item_max = @data.size
- create_contents
- @item_max.times { |i| draw_item(i) }
- end
- #--------------------------------------------------------------------------
- # ○ スキル選択可否判定
- # skill : スキル
- #--------------------------------------------------------------------------
- def selectable?(skill)
- return false if skill == nil
- # 消費 CP 0 なら常に使用可能な場合
- if KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL && skill.cp_cost == 0
- return false
- end
- # 戦闘時に使用可能ならOK
- return true if skill.battle_ok?
- # 使用不可でもセット可能な場合
- ### if KGC::SkillCPSystem::SHOW_UNUSABLE_SKILL && skill.occasion == 3
- ### return true
- ### end
- return false
- end
- #--------------------------------------------------------------------------
- # ○ 消費 CP 描画判定
- #--------------------------------------------------------------------------
- def cp_cost_show?(skill)
- return true if KGC::SkillCPSystem::SHOW_ZERO_COST
- return (skill.cp_cost > 0)
- end
- #--------------------------------------------------------------------------
- # ○ 項目の描画
- # index : 項目番号
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- skill = @data[index]
- if skill != nil
- rect.width -= 4
- enabled = @actor.battle_skill_settable?(@slot_index, skill)
- draw_item_name(skill, rect.x, rect.y, enabled)
- self.contents.draw_text(rect, skill.cp_cost, 2) if cp_cost_show?(skill)
- else
- self.contents.draw_text(rect, KGC::SkillCPSystem::RELEASE_TEXT, 1)
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- super
- return unless self.active
- if Input.repeat?(Input::RIGHT)
- cursor_pagedown
- elsif Input.repeat?(Input::LEFT)
- cursor_pageup
- end
- end
- #--------------------------------------------------------------------------
- # ● ヘルプテキスト更新
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(skill == nil ? "" : skill.description)
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Scene_Map
- #==============================================================================
- class Scene_Map < Scene_Base
- #--------------------------------------------------------------------------
- # ● 画面切り替えの実行
- #--------------------------------------------------------------------------
- alias update_scene_change_KGC_SkillCPSystem update_scene_change unless $@
- def update_scene_change
- return if $game_player.moving? # プレイヤーの移動中?
- if $game_temp.next_scene == :set_battle_skill
- call_set_battle_skill
- return
- end
- update_scene_change_KGC_SkillCPSystem
- end
- #--------------------------------------------------------------------------
- # ○ スキル設定画面への切り替え
- #--------------------------------------------------------------------------
- def call_set_battle_skill
- $game_temp.next_scene = nil
- $scene = Scene_SetBattleSkill.new(
- $game_temp.next_scene_actor_index,
- 0,
- Scene_SetBattleSkill::HOST_MAP)
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Scene_Menu
- #==============================================================================
- class Scene_Menu < Scene_Base
- if KGC::SkillCPSystem::USE_MENU_SET_SKILL_COMMAND
- #--------------------------------------------------------------------------
- # ● コマンドウィンドウの作成
- #--------------------------------------------------------------------------
- alias create_command_window_KGC_SkillCPSystem create_command_window unless $@
- def create_command_window
- create_command_window_KGC_SkillCPSystem
- return if $imported["CustomMenuCommand"]
- @__command_set_battle_skill_index =
- @command_window.add_command(Vocab.set_battle_skill)
- if @command_window.oy > 0
- @command_window.oy -= Window_Base::WLH
- end
- @command_window.index = @menu_index
- end
- end
- #--------------------------------------------------------------------------
- # ● コマンド選択の更新
- #--------------------------------------------------------------------------
- alias update_command_selection_KGC_SkillCPSystem update_command_selection unless $@
- def update_command_selection
- call_set_battle_skill_flag = false
- if Input.trigger?(Input::C)
- case @command_window.index
- when @__command_set_battle_skill_index # スキル設定
- call_set_battle_skill_flag = true
- end
- end
- # スキル設定画面に移行
- if call_set_battle_skill_flag
- if $game_party.members.size == 0
- Sound.play_buzzer
- return
- end
- Sound.play_decision
- start_actor_selection
- return
- end
- update_command_selection_KGC_SkillCPSystem
- end
- #--------------------------------------------------------------------------
- # ● アクター選択の更新
- #--------------------------------------------------------------------------
- alias update_actor_selection_KGC_SkillCPSystem update_actor_selection unless $@
- 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_set_battle_skill_index # スキル設定
- $scene = Scene_SetBattleSkill.new(
- @status_window.index,
- @__command_set_battle_skill_index,
- Scene_SetBattleSkill::HOST_MENU)
- return
- end
- end
- update_actor_selection_KGC_SkillCPSystem
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # □ Scene_SetBattleSkill
- #------------------------------------------------------------------------------
- # 戦闘スキル設定画面の処理を行うクラスです。
- #==============================================================================
- class Scene_SetBattleSkill < 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]
- create_windows
- end
- #--------------------------------------------------------------------------
- # ○ ウィンドウ作成
- #--------------------------------------------------------------------------
- def create_windows
- @help_window = Window_Help.new
- if $imported["HelpExtension"]
- @help_window.row_max = KGC::HelpExtension::ROW_MAX
- end
- dy = @help_window.height
- @status_window = Window_BattleSkillStatus.new(0, dy, @actor)
- dy += @status_window.height
- @slot_window = Window_BattleSkillSlot.new(
- 0,
- dy,
- Graphics.width / 2,
- Graphics.height - dy,
- @actor)
- @slot_window.help_window = @help_window
- @slot_window.active = true
- @list_window = Window_BattleSkillList.new(
- Graphics.width - @slot_window.width,
- dy,
- Graphics.width - @slot_window.width,
- Graphics.height - dy,
- @actor)
- @list_window.help_window = @help_window
- end
- #--------------------------------------------------------------------------
- # ● 終了処理
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- @help_window.dispose
- @status_window.dispose
- @slot_window.dispose
- @list_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 @slot_window.active
- update_slot
- elsif @list_window.active
- update_list
- end
- end
- #--------------------------------------------------------------------------
- # ○ ウィンドウ更新
- #--------------------------------------------------------------------------
- def update_window
- @help_window.update
- @status_window.update
- @slot_window.update
- @list_window.update
- end
- #--------------------------------------------------------------------------
- # ○ ウィンドウ再描画
- #--------------------------------------------------------------------------
- def refresh_window
- @status_window.refresh
- @slot_window.refresh
- @list_window.refresh
- end
- #--------------------------------------------------------------------------
- # ○ 次のアクターの画面に切り替え
- #--------------------------------------------------------------------------
- def next_actor
- @actor_index += 1
- @actor_index %= $game_party.members.size
- $scene = Scene_SetBattleSkill.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_SetBattleSkill.new(@actor_index, @menu_index, @host_scene)
- end
- #--------------------------------------------------------------------------
- # ○ フレーム更新 (スロットウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_slot
- # 選択項目が変化した場合
- if @last_slot_index != @slot_window.index
- @list_window.slot_index = @slot_window.index
- @list_window.refresh
- @last_slot_index = @slot_window.index
- end
- if Input.trigger?(Input::A)
- Sound.play_decision
- # 選択しているスキルを外す
- @actor.remove_battle_skill(@slot_window.index)
- refresh_window
- elsif Input.trigger?(Input::B)
- Sound.play_cancel
- return_scene
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- # リストウィンドウに切り替え
- @slot_window.active = false
- @list_window.active = true
- elsif Input.trigger?(Input::R)
- Sound.play_cursor
- next_actor
- elsif Input.trigger?(Input::L)
- Sound.play_cursor
- prev_actor
- end
- end
- #--------------------------------------------------------------------------
- # ○ フレーム更新 (リストウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_list
- if Input.trigger?(Input::B)
- Sound.play_cancel
- # スロットウィンドウに切り替え
- @slot_window.active = true
- @list_window.active = false
- elsif Input.trigger?(Input::C)
- skill = @list_window.skill
- # セットできない場合
- unless @actor.battle_skill_settable?(@slot_window.index, skill)
- Sound.play_buzzer
- return
- end
- Sound.play_decision
- set_skill(@slot_window.index, skill)
- # スロットウィンドウに切り替え
- @slot_window.active = true
- @list_window.active = false
- end
- end
- #--------------------------------------------------------------------------
- # ○ スキル設定
- # index : 設定する場所
- # skill : 設定するスキル
- #--------------------------------------------------------------------------
- def set_skill(index, skill)
- @actor.remove_battle_skill(index)
- if skill != nil
- @actor.set_battle_skill(index, skill)
- end
- refresh_window
- end
- end
Add Comment
Please, Sign In to add comment