#◆◇◆◇◆ ☆ スキル習得装備・アビリティシステム ver 1.51 ◇◆◇◆◇ # ☆ マスタースクリプト ver 2.00 以降専用 # 配布元(みんとのお部屋) http://oiuytrewq.hp.infoseek.co.jp/minto.html # サポート掲示板 http://www2.ezbbs.net/21/minto-aaa/ # by みんと # メニュー改造スクリプト Ver 1.03 # 配布元・サポートURL(歯車の城) # http://members.jcom.home.ne.jp/cogwheel/ # by ショウ =begin 更新履歴 Ver 1.51 装飾品に未対応だったミスを修正。 Ver 1.50 装備スキルの完全習得まで 使用を禁止に出来るように改良。 Ver 1.40 歯車の城さんとの併用ミスを修正。 Ver 1.30 歯車の城さんの 「メニュー改造スクリプト」との 併用が可能になるように改良。 Ver 1.20 細かい部分を修正。 Ver 1.10 他サイトとの併用性が上昇するように改良。 使用方法 歯車の城さんの 「メニュー改造スクリプト」より下の位置に導入してください。 また、その際はGear_Crossを true にしてご使用ください。 使用にはスキル習得装備の導入が必須です。 また、スキル習得装備本体より下に導入してください。 スキルにAPを設定し、その武具を装備している間は使えますが、 外すとスキルごとの設定APを満たさない限り使用できません。 設定APを満たした場合、以後通常通り使用できます。 APを設定するには スキル名 (半角のスペース)ap値となっています。 例 ヒール ap255 ↑の例だと、APを255ポイント溜めるとヒールを完全習得します。 なお、この記述を省いた場合の習得APは100ポイントです。 敵にAPを設定する場合、 エネミー名 (半角のスペース)ap値となっています。 例 ゴースト ap10 ↑の例だと、ゴーストを倒すと、10APを獲得します。 =end #============================================================================== # ☆ MINTO #------------------------------------------------------------------------------ # 様々なフラグを扱うメインモジュールです。 #============================================================================== module MINTO # スキル習得装備・アビリティシステムを有効化( true で有効 / false で無効 ) RGSS["equip_skill_ability_system"] = true # 歯車の城さんとの併用化フラグ( true / false ) Gear_Cross = false # 完全習得まで装備スキルの使用を禁止にするか( true / false ) Master_Check = false end if MINTO::RGSS["equip_skill_ability_system"] #============================================================================== # ■ RPG::Enemy #============================================================================== module RPG class Enemy def name return @name.split(/ /)[0].to_s end def ap ap = @name.split(/ap/)[1].to_i return ap != 0 ? ap : 0 end end end #============================================================================== # ■ RPG::Skill #============================================================================== module RPG class Skill def name return @name.split(/ /)[0].to_s end def master_ap ap = @name.split(/ap/)[1].to_i return ap != 0 ? ap : 100 end end end #============================================================================== # ■ Game_Battler (分割定義 1) #------------------------------------------------------------------------------ #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ # スのスーパークラスとして使用されます。 #============================================================================== class Game_Battler #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :skills_id # 習得スキルのID attr_accessor :skills_ap # 習得スキルのAP attr_accessor :master_skills # 習得したスキルのID配列 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias initialize_MINTO_Master_Skills initialize def initialize # 元の処理を実行 initialize_MINTO_Master_Skills @skills_id = [] @skills_ap = [] @master_skills = [] end end #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors) # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。 #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● セットアップ # actor_id : アクター ID #-------------------------------------------------------------------------- alias setup_MINTO_Master_Skills setup def setup(actor_id) # 元の処理を実行 setup_MINTO_Master_Skills(actor_id) @skills_id = set_skills @skills_ap = set_skills_ap @master_skills = [] sharing_ap(0) end #-------------------------------------------------------------------------- # ● スキルの取得(再定義) #-------------------------------------------------------------------------- def skills skill = [] if @weapon_id != 0 and not MINTO::Master_Check skill += [Data_Weapons.data[@weapon_id].w_skill] skill += [Data_Weapons.data[@weapon_id].w_skill1] skill += [Data_Weapons.data[@weapon_id].w_skill2] skill += [Data_Weapons.data[@weapon_id].w_skill3] skill += [Data_Weapons.data[@weapon_id].w_skill4] end if @armor1_id != 0 and not MINTO::Master_Check skill += [Data_Armors.data[@armor1_id].a_skill] skill += [Data_Armors.data[@armor1_id].a_skill1] skill += [Data_Armors.data[@armor1_id].a_skill2] skill += [Data_Armors.data[@armor1_id].a_skill3] skill += [Data_Armors.data[@armor1_id].a_skill4] end if @armor2_id != 0 and not MINTO::Master_Check skill += [Data_Armors.data[@armor2_id].a_skill] skill += [Data_Armors.data[@armor2_id].a_skill1] skill += [Data_Armors.data[@armor2_id].a_skill2] skill += [Data_Armors.data[@armor2_id].a_skill3] skill += [Data_Armors.data[@armor2_id].a_skill4] end if @armor3_id != 0 and not MINTO::Master_Check skill += [Data_Armors.data[@armor3_id].a_skill] skill += [Data_Armors.data[@armor3_id].a_skill1] skill += [Data_Armors.data[@armor3_id].a_skill2] skill += [Data_Armors.data[@armor3_id].a_skill3] skill += [Data_Armors.data[@armor3_id].a_skill4] end if @armor4_id != 0 and not MINTO::Master_Check skill += [Data_Armors.data[@armor4_id].a_skill] skill += [Data_Armors.data[@armor4_id].a_skill1] skill += [Data_Armors.data[@armor4_id].a_skill2] skill += [Data_Armors.data[@armor4_id].a_skill3] skill += [Data_Armors.data[@armor4_id].a_skill4] end skill += @master_skills - [nil] skill.sort! @skills_id = skill & skill - [0] skills = @skills.dup master_skill = skill + skills if MINTO::Equip_Skills_Sort == 1 master_skill = skills + skill if MINTO::Equip_Skills_Sort == 2 || MINTO::Equip_Skills_Sort == 3 master_skill = master_skill.sort! if MINTO::Equip_Skills_Sort == 3 master_skill = master_skill & master_skill - [0] return master_skill end #-------------------------------------------------------------------------- # ● 装備スキルの習得 #-------------------------------------------------------------------------- def set_skills skill = [] if @weapon_id != 0 skill += [Data_Weapons.data[@weapon_id].w_skill] skill += [Data_Weapons.data[@weapon_id].w_skill1] skill += [Data_Weapons.data[@weapon_id].w_skill2] skill += [Data_Weapons.data[@weapon_id].w_skill3] skill += [Data_Weapons.data[@weapon_id].w_skill4] end if @armor1_id != 0 skill += [Data_Armors.data[@armor1_id].a_skill] skill += [Data_Armors.data[@armor1_id].a_skill1] skill += [Data_Armors.data[@armor1_id].a_skill2] skill += [Data_Armors.data[@armor1_id].a_skill3] skill += [Data_Armors.data[@armor1_id].a_skill4] end if @armor2_id != 0 skill += [Data_Armors.data[@armor2_id].a_skill] skill += [Data_Armors.data[@armor2_id].a_skill1] skill += [Data_Armors.data[@armor2_id].a_skill2] skill += [Data_Armors.data[@armor2_id].a_skill3] skill += [Data_Armors.data[@armor2_id].a_skill4] end if @armor3_id != 0 skill += [Data_Armors.data[@armor3_id].a_skill] skill += [Data_Armors.data[@armor3_id].a_skill1] skill += [Data_Armors.data[@armor3_id].a_skill2] skill += [Data_Armors.data[@armor3_id].a_skill3] skill += [Data_Armors.data[@armor3_id].a_skill4] end if @armor4_id != 0 skill += [Data_Armors.data[@armor4_id].a_skill] skill += [Data_Armors.data[@armor4_id].a_skill1] skill += [Data_Armors.data[@armor4_id].a_skill2] skill += [Data_Armors.data[@armor4_id].a_skill3] skill += [Data_Armors.data[@armor4_id].a_skill4] end skill = skill.sort! skill = skill & skill - [0] return skill end #-------------------------------------------------------------------------- # ● 装備スキルのAPの習得 #-------------------------------------------------------------------------- def set_skills_ap ap = [] for id in 0...Data_Skills_Base.data.size ap += [0] end return ap end #-------------------------------------------------------------------------- # ● 装備スキルのAP分配 #-------------------------------------------------------------------------- def sharing_ap(ap = 0) @skills_id = set_skills ap = ap skills_ap = 0 (0...@skills_id.size).each do |id| skill = Data_Skills_Base.data[@skills_id[id]] skills_ap = @skills_ap[@skills_id[id]] + ap @skills_ap[@skills_id[id]] = skills_ap if @skills_ap[@skills_id[id]] >= skill.master_ap @skills_ap[@skills_id[id]] = skill.master_ap end end (1...@skills_ap.size).each do |id| if @skills_ap[id] == Data_Skills_Base.data[id].master_ap @master_skills[id] = id end end @master_skills = @master_skills & @master_skills - [0] return @skills_ap end end #============================================================================== # ■ Game_Enemy #------------------------------------------------------------------------------ #  エネミーを扱うクラスです。このクラスは Game_Troop クラス ($game_troop) の # 内部で使用されます。 #============================================================================== class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # ● APの取得 #-------------------------------------------------------------------------- def ap return Data_Enemies.data[@enemy_id].ap end end #============================================================================== # ■ Window_Skill #------------------------------------------------------------------------------ #  スキル画面、バトル画面で、使用できるスキルの一覧を表示するウィンドウです。 #============================================================================== class Window_Skill < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias initialize_MINTO_Master_Skills initialize def initialize(actor) if !$game_temp.in_battle @help = Sprite.new @help.bitmap = Bitmap.new(640, 480) @help.bitmap.font.size = 22 @help.z = 6110 @help.bitmap.font.color = Color.new(5, 5, 5) text = "Y : APウィンドウ切り替え" @help.bitmap.draw_text(1-1, 447-1, 640, 32, text, 1) @help.bitmap.draw_text(1-1, 447+1, 640, 32, text, 1) @help.bitmap.draw_text(1+1, 447-1, 640, 32, text, 1) @help.bitmap.draw_text(1+1, 447+1, 640, 32, text, 1) @help.bitmap.font.color = Color.new(255, 255, 255) @help.bitmap.draw_text(1, 447, 640, 32, text, 1) end # 元の処理を実行 initialize_MINTO_Master_Skills(actor) # 併用化フラグが有効な場合 if MINTO::Gear_Cross else if !$game_temp.in_battle self.height -= 32 self.contents = Bitmap.new(width - 32, self.height - 32) refresh end end end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose # スプライトを解放 if @help.is_a?(Sprite) @help.bitmap.dispose @help = nil end super end end #============================================================================== # ■ Window_BattleResult #------------------------------------------------------------------------------ #  バトル終了時に、獲得した EXP やゴールドなどを表示するウィンドウです。 #============================================================================== class Window_BattleResult < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(exp, gold, treasures, ap = $scene.ap) @exp = exp @gold = gold @treasures = treasures @ap = ap n = @treasures.size n = 200 if n > 0 super(0, 0, 640, 280 + n) self.contents = Bitmap.new(width - 32, height - 32) self.opacity = 160 self.visible = false refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear x = 0 # 演出 self.contents.font.bold = true self.contents.font.italic = true self.contents.font.size = 25 self.contents.font.name = "MS 明朝" self.contents.draw_text(0, 0, 640, 32, "戦闘終了 - YOU VICTORY -") self.contents.fill_rect(3, 38, 400, 1, normal_color) self.contents.fill_rect(2, 39, 400, 1, normal_color) self.contents.fill_rect(1, 40, 400, 1, normal_color) self.contents.draw_text(x, 50, 640, 32, "経験値 - EXPERIENCE -") self.contents.draw_text(180, 80, 640, 32, @exp.to_s) self.contents.draw_text(180, 110, 640, 32, @ap.to_s) self.contents.font.color = system_color self.contents.draw_text(310, 80, 640, 32, "EXP") self.contents.draw_text(310, 110, 640, 32, "AP") self.contents.font.color = normal_color self.contents.fill_rect(3, 148, 400, 1, normal_color) self.contents.fill_rect(2, 149, 400, 1, normal_color) self.contents.fill_rect(1, 150, 400, 1, normal_color) self.contents.draw_text(x, 160, 640, 32, "入手金額 - GET MONEY -") self.contents.draw_text(180, 190, 640, 32, @gold.to_s) self.contents.font.color = system_color self.contents.draw_text(310, 190, 640, 32, Data_System.data.words.gold) self.contents.fill_rect(3, 228, 400, 1, normal_color) self.contents.fill_rect(2, 229, 400, 1, normal_color) self.contents.fill_rect(1, 230, 400, 1, normal_color) self.contents.font.color = normal_color self.contents.draw_text(x, 250, 640, 32, "入手アイテム - GET ITEM -") self.contents.fill_rect(3, 428, 400, 1, normal_color) self.contents.fill_rect(2, 429, 400, 1, normal_color) self.contents.fill_rect(1, 430, 400, 1, normal_color) self.contents.font.size = 25 x = 0; y = 290 for item in @treasures draw_item_name(item, x, y) y += 32 if y == 128 x += 224; y = 32 end end end end #============================================================================== # ■ Window_Skills_AP #============================================================================== class Window_Skill_AP < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(actor, gear = false) if gear == true super(20, 170, 600, 256) else super(0, 128, 640, 320) end @actor = actor @column_max = 2 refresh self.index = 0 # 戦闘中の場合はウィンドウを画面中央へ移動し、半透明にする if $game_temp.in_battle self.y = 64 self.height = 256 self.back_opacity = 160 end end #-------------------------------------------------------------------------- # ● スキルの取得 #-------------------------------------------------------------------------- def skill return @data[self.index] end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] for i in 0...Data_Skills_Base.data.size ap = @actor.skills_ap[i] if ap > 0 @data.push(Data_Skills_Base.data[i]) end end # 項目数が 0 でなければビットマップを作成し、全項目を描画 @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max draw_item(i) end end end #-------------------------------------------------------------------------- # ● 項目の描画 # index : 項目番号 #-------------------------------------------------------------------------- def draw_item(index) skill = @data[index] ap = "AP " + @actor.skills_ap[skill.id].to_s + " / " + skill.master_ap.to_s if @actor.skills_ap[skill.id] == skill.master_ap self.contents.font.color = normal_color ap = "Master !" else self.contents.font.color = disabled_color end x = 4 + index % 2 * (288 + 32) y = index / 2 * 32 rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(skill.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0) self.contents.draw_text(x + 180, y, 100, 32, ap, 2) end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.set_text(self.skill == nil ? "" : self.skill.description) end end #============================================================================== # ■ Scene_Skill #------------------------------------------------------------------------------ #  スキル画面の処理を行うクラスです。 #============================================================================== class Scene_Skill #-------------------------------------------------------------------------- # ● メイン処理 #-------------------------------------------------------------------------- def main # アクターを取得 @actor = $game_party.actors[@actor_index] # スプライトセットを作成 @spriteset = Spriteset_Map.new # ヘルプウィンドウ、ステータスウィンドウ、スキルウィンドウを作成 @help_window = Window_Help.new @status_window = Window_SkillStatus.new(@actor) @skill_window = Window_Skill.new(@actor) @ap_window = Window_Skill_AP.new(@actor) @ap_window.visible = false @ap_window.active = false # ヘルプウィンドウを関連付け @skill_window.help_window = @help_window @ap_window.help_window = @help_window # ターゲットウィンドウを作成 (不可視・非アクティブに設定) @target_window = Window_Target.new @target_window.visible = false @target_window.active = false # トランジション実行 Graphics.transition # メインループ loop do # ゲーム画面を更新 Graphics.update # 入力情報を更新 Input.update # フレーム更新 update # 画面が切り替わったらループを中断 if $scene != self break end end # トランジション準備 Graphics.freeze # スプライトセットを解放 @spriteset.dispose # ウィンドウを解放 @help_window.dispose @status_window.dispose @skill_window.dispose @target_window.dispose @ap_window.dispose end #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor_index : アクターインデックス #-------------------------------------------------------------------------- # 併用化フラグが有効な場合 if MINTO::Gear_Cross alias initialize_MINTO_Master_Skills initialize def initialize(actor_index) # 元の処理を実行 initialize_MINTO_Master_Skills(actor_index) # 併用フラグをオン @grar_cross = true # APウィンドウを作成 @ap_window = Window_Skill_AP.new(@actor, true) @ap_window.visible = false @ap_window.active = false @ap_window.z = 6110 @ap_window.back_opacity = 160 # ヘルプウィンドウを関連付け @ap_window.help_window = @help_window end end #-------------------------------------------------------------------------- # ● ウィンドウの解放 #-------------------------------------------------------------------------- def dispose # APウィンドウを解放 @ap_window.dispose # ウィンドウを解放 @help_window.dispose @status_window.dispose @skill_window.dispose $scene.menu = nil $scene.status_window.index = -1 $scene.command_window.active = true end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias update_MINTO_Master_Skills update def update # APウィンドウがアクティブでない場合 if @ap_window.active == false # Y ボタンが押された場合 if Input.trigger?(Input::Y) # 決定 SE を演奏 $game_system.se_play(Data_System.data.decision_se) @skill_window.active = false @skill_window.visible = false @ap_window.active = true @ap_window.visible = true @help_window.set_text("") # 歯車の城さんのメニュー改造がない場合 if !@grar_cross @target_window.visible = false @target_window.active = false end return end else # Y ボタンかBボタンが押された場合 if Input.trigger?(Input::Y) or Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play(Data_System.data.cancel_se) @skill_window.active = true @skill_window.visible = true @ap_window.active = false @ap_window.visible = false # 歯車の城さんのメニュー改造がない場合 if !@grar_cross @target_window.visible = false @target_window.active = false end return end end # APウィンドウを更新 if @ap_window.active @ap_window.update end # 元の処理を実行 update_MINTO_Master_Skills end end #============================================================================== # ■ Scene_Battle (分割定義 2) #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :ap # AP #-------------------------------------------------------------------------- # ● アフターバトルフェーズ開始 #-------------------------------------------------------------------------- alias start_phase5_MINTO_Master_Skills start_phase5 def start_phase5 # APを初期化 @ap = 0 # ループ for enemy in $game_troop.enemies # エネミーが隠れ状態でない場合 unless enemy.hidden # 獲得APを追加 @ap += enemy.ap end end # AP 獲得 $game_party.actors.each do |actor| actor.sharing_ap(@ap) end # 元の処理を実行 start_phase5_MINTO_Master_Skills end end end