#============================================================================== # ■ スキルポイント振り分けシステム ver 1.05 #------------------------------------------------------------------------------ #  配布元: # 白の魔 http://izumiwhite.web.fc2.com/ # #  利用規約: # RPGツクールVXの正規の登録者のみご利用になれます。 # 利用報告・著作権表示とかは必要ありません。 # 改造もご自由にどうぞ。 # 何か問題が発生しても責任は持ちません。 #============================================================================== #-------------------------------------------------------------------------- # ★ 初期設定。 # 親スキルとスキルポイントを振り分けることで修得可能なスキルの設定。 # 他いろいろ。 # # 親スキル:スキルポイントを振り分けるターゲットのことです。 # この親スキルにスキルポイントを振り分けることで # 実際に使用可能なスキルを修得します。 #-------------------------------------------------------------------------- module WD_skilldivide_ini #親スキルの設定 Skilllearn = [] #この行は消さないこと。 #一列目は親スキルの名前、二列目以降に修得するスキルと必要なスキルポイントを #記述します。 #"9;10"と記述すると9番のスキルを修得するには10ポイントのスキルポイントが #必要であることを意味します。 Skilllearn[1] = ["剣技","9;10","10;20","23;30","11;40","12;50","13;60"] Skilllearn[2] = ["槍技","59;10","60;20","61;35","62;50"] Skilllearn[3] = ["博愛","33;10","39;20","34;30","40;40","35;50","36;60","37;70","41;85","42;100"] #スキルポイントの振り分け可能最大値 Max_charge_each = [] #この行は消さないこと。 Max_charge = 100 #振り分け可能最大値のデフォルト値。 #振り分け可能最大値をアクターごとに指定。 #指定しない場合はデフォルト値Max_chargeの値となる。 Max_charge_each[1] = 50 #1番の親スキルの振り分け可能最大値。 Max_charge_each[2] = 50 #レベルアップ時に入手するスキルポイントの指定 Sp_exp_each = [] #この行は消さないこと。 Sp_exp = 5 #レベルアップ時に入手するスキルポイントのデフォルト値。 #レベルアップ時に入手するスキルポイントをアクターごとに指定。 #指定しない場合はデフォルト値Sp_expの値となる。 Sp_exp_each[1] = 10 #レベルアップ時に1番のアクターが入手するスキルポイント。 Sp_exp_each[2] = 10 #各名称の設定 Sp_name = "スキルポイント" #スキルポイントの名前 Sp_dimention = "p" #スキルポイントの単位 Sp_command = "SP 振り分け" #メニューコマンドの名前 Result_text = "スキルの修得" #スキル修得ウィンドウのテキスト Master_sign = "MASTER" #修得済みのスキルに対する表記 #確認用メッセージ Confirm_mess = "スキルポイントを分配してよろしいですか?" Confirm_yes = " はい" Confirm_no = " いいえ" #一ページに表示可能な親スキルの数。 #この値を小さくすると、スキルポイント振り分けウィンドウが小さくなり、 #その分、修得可能スキルを表示するウィンドウが大きくなります。 Skill_row = 6 #スキル修得結果ウィンドウの設定 Result_width = 272 #ウィンドウの幅 Result_height = 208 #ウィンドウの高さ #ゲージの設定 #ゲージ画像を利用する場合はPicturesフォルダに画像をインポートして下さい。 Gauge_image_use = true #ゲージに画像を使用するか Gauge_image1 = "gauge_1" #ゲージのファイル名(120×12ピクセル推奨) Gauge_image2 = "gauge_2" #ゲージのファイル名(120×12ピクセル推奨) Gauge_color1 = [255,0,255,255] #ゲージに画像を使用しない場合のゲージの色 Gauge_color2 = [255,255,0,255] #ゲージに画像を使用しない場合のゲージの色 #ゲージ枠の設定 #ゲージ枠画像を利用する場合はPicturesフォルダに画像をインポートして下さい。 Gauge_waku_image_use = false #ゲージ枠に画像を使用するか Gauge_waku_image = "gauge_waku"#ゲージ枠のファイル名 Gauge_waku_image_x = 0 #ゲージ枠表示位置の補正x座標(- or +) Gauge_waku_image_y = 0 #ゲージ枠表示位置の補正y座標(- or +) #レベルによるスキルポイントの振り分け制限。 #親スキル1個当たりの振り分け上限を一次関数で設定します。 # y=a(x-1)+b ; y=振り分け上限,x=アクターのレベル,a=設定値,b=設定値 Level_limit = false #レベルによるスキルポイント振り分け上限を設定はる場合はtrue Limit_a = 5 # "y=a(x-1)+b" の"a" Limit_b = 10 # "y=a(x-1)+b" の"b" #未修得のスキルの表示設定 Nolearn_display = false #未修得のスキル名を表示しない場合はtrue Nolearn_text = "???" #代わりに表示するテキスト end #-------------------------------------------------------------------------- # ★ 初期設定おわり #-------------------------------------------------------------------------- module WD_skillpoint #アクターにスキルポイントを加える def get_skillpoint(actorid, value) $game_system.sp = [] if $game_system.sp == nil $game_system.sp[actorid] = 0 if $game_system.sp[actorid] == nil $game_system.sp[actorid] += value end #アクターのスキルポイントを減らす def lose_skillpoint(actorid, value) $game_system.sp = [] if $game_system.sp == nil $game_system.sp[actorid] = 0 if $game_system.sp[actorid] == nil $game_system.sp[actorid] -= value $game_system.sp[actorid] = 0 if $game_system.sp[actorid] < 0 end #アクターの親スキルを増やす def add_skilluseable(actorid, skillid) $game_system.skill_useable = [] if $game_system.skill_useable == nil $game_system.skill_useable[actorid] = [] if $game_system.skill_useable[actorid]== nil $game_system.skill_useable[actorid][skillid] = true end #アクターの親スキルを減らす def reduce_skilluseable(actorid, skillid) $game_system.skill_useable = [] if $game_system.skill_useable == nil $game_system.skill_useable[actorid] = [] if $game_system.skill_useable[actorid]== nil $game_system.skill_useable[actorid][skillid] = false end #アクターの親スキルのSPを増やす def get_skillcharge(actorid, skillid, value) $game_system.skill_charge = [] if $game_system.skill_charge == nil $game_system.skill_charge[actorid] = [] if $game_system.skill_charge[actorid]== nil $game_system.skill_charge[actorid][skillid] = 0 if $game_system.skill_charge[actorid][skillid] == nil $game_system.skill_charge[actorid][skillid] += value end #アクターの親スキルのSPを減らす def lose_skillcharge(actorid, skillid, value) $game_system.skill_charge = [] if $game_system.skill_charge == nil $game_system.skill_charge[actorid] = [] if $game_system.skill_charge[actorid]== nil $game_system.skill_charge[actorid][skillid] = 0 if $game_system.skill_charge[actorid][skillid] == nil $game_system.skill_charge[actorid][skillid] -= value $game_system.skill_charge[actorid][skillid] = 0 if $game_system.skill_charge[actorid][skillid] < 0 end end #============================================================================== # ■ Scene_SkillPoint #------------------------------------------------------------------------------ #  スキルポイント分配画面の処理を行うクラスです。 #============================================================================== class Scene_SkillPoint < Scene_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor_index : アクターインデックス #-------------------------------------------------------------------------- def initialize(actor_index = 0) @actor_index = actor_index initialize_variables end #-------------------------------------------------------------------------- # ● グローバル変数の初期化 #-------------------------------------------------------------------------- def initialize_variables @actor_index actor = $game_party.members[@actor_index] $game_system.sp = [] if $game_system.sp == nil $game_system.sp[actor.id] = 0 if $game_system.sp[actor.id] == nil $game_system.sp_kari = [] if $game_system.sp_kari == nil $game_system.sp_kari[actor.id] = 0 if $game_system.sp_kari[actor.id] == nil $game_system.skill_useable = [] if $game_system.skill_useable == nil $game_system.skill_charge = [] if $game_system.skill_charge == nil $game_system.skill_charge_kari = [] if $game_system.skill_charge_kari == nil $game_system.skill_useable[actor.id] = [] if $game_system.skill_useable[actor.id] == nil $game_system.skill_charge[actor.id] = [] if $game_system.skill_charge[actor.id] == nil $game_system.skill_charge_kari[actor.id] = [] if $game_system.skill_charge_kari[actor.id] == nil for i in 0...WD_skilldivide_ini::Skilllearn.size $game_system.skill_useable[actor.id][i] = false if $game_system.skill_useable[actor.id][i] == nil $game_system.skill_charge[actor.id][i] = 0 if $game_system.skill_charge[actor.id][i] == nil $game_system.skill_charge_kari[actor.id][i] = 0 end $game_system.sp_kari[actor.id] = $game_system.sp[actor.id] #ディープ? end #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super create_menu_background height = 32 + 24 * WD_skilldivide_ini::Skill_row y = 416 - height @actor = $game_party.members[@actor_index] @viewport = Viewport.new(0, 0, 544, 416) @status_window = Window_SkillPointStatus.new(0, 416-height-56, @actor) @status_window.viewport = @viewport @view_window = Window_SkillPointView.new(0, 0, 544, 416-height-56, @actor) @view_window.viewport = @viewport @skill_window = Window_SkillPoint.new(0, y, 544, height, @actor) @skill_window.viewport = @viewport @confirm_window = Window_ConfirmDevide.new(0, y-160, 544, 104, @actor) @confirm_window.viewport = @viewport @confirm_window.active = false @confirm_window.visible = false @result_window = Window_SkillResult.new(@actor) @result_window.viewport = @viewport @result_window.active = false @result_window.visible = false end #-------------------------------------------------------------------------- # ● 終了処理 #-------------------------------------------------------------------------- def terminate super dispose_menu_background @status_window.dispose @view_window.dispose @skill_window.dispose @confirm_window.dispose @result_window.dispose end #-------------------------------------------------------------------------- # ● 元の画面へ戻る #-------------------------------------------------------------------------- def return_scene $scene = Scene_Menu.new(4) end #-------------------------------------------------------------------------- # ● 次のアクターの画面に切り替え #-------------------------------------------------------------------------- def next_actor @actor_index += 1 @actor_index %= $game_party.members.size $scene = Scene_SkillPoint.new(@actor_index) end #-------------------------------------------------------------------------- # ● 前のアクターの画面に切り替え #-------------------------------------------------------------------------- def prev_actor @actor_index += $game_party.members.size - 1 @actor_index %= $game_party.members.size $scene = Scene_SkillPoint.new(@actor_index) end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super update_menu_background @status_window.update @view_window.update @skill_window.update @confirm_window.update @result_window.update @view_window.set(@skill_window.index) if @skill_window.active update_skill_selection elsif @confirm_window.active update_confirm_selection elsif @result_window.active update_result_wait end end #-------------------------------------------------------------------------- # ● スキル選択の更新 #-------------------------------------------------------------------------- def update_skill_selection if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::R) Sound.play_cursor next_actor elsif Input.trigger?(Input::L) Sound.play_cursor prev_actor elsif Input.trigger?(Input::C) actor = $game_party.members[@actor_index] if $game_system.sp_kari[actor.id] != $game_system.sp[actor.id] Sound.play_decision @skill_window.active = false @confirm_window.active = true @confirm_window.visible = true else Sound.play_buzzer end elsif Input.repeat?(Input::RIGHT) @skill_window.update_hantei = true @skill_window.uppoint(@skill_window.index) elsif Input.repeat?(Input::LEFT) @skill_window.update_hantei = true @skill_window.downpoint(@skill_window.index) end end #-------------------------------------------------------------------------- # ● スキル選択の更新 #-------------------------------------------------------------------------- def update_confirm_selection if Input.trigger?(Input::B) Sound.play_cancel @confirm_window.active = false @confirm_window.visible = false @skill_window.active = true elsif Input.trigger?(Input::C) if @confirm_window.index == 0 Sound.play_decision @confirm_window.active = false @confirm_window.visible = false determine_devide else Sound.play_cancel @confirm_window.active = false @confirm_window.visible = false @skill_window.active = true end end end #-------------------------------------------------------------------------- # ● スキルの決定 #-------------------------------------------------------------------------- def determine_devide actor = $game_party.members[@actor_index] @newlearn_list = [] for i in 0...WD_skilldivide_ini::Skilllearn.size if $game_system.skill_charge_kari[actor.id][i] > 0 j = -1 next if WD_skilldivide_ini::Skilllearn[i] == nil for skill_id_sp in WD_skilldivide_ini::Skilllearn[i] j += 1 next if j == 0 skill_id = skill_id_sp.split(/;/)[0].to_i skill_sp = skill_id_sp.split(/;/)[1].to_i if skill_sp > $game_system.skill_charge[actor.id][i] and skill_sp <= ($game_system.skill_charge[actor.id][i] + $game_system.skill_charge_kari[actor.id][i]) if (actor.skill_learn?($data_skills[skill_id])) != true actor.learn_skill(skill_id) @newlearn_list.push(skill_id) end end end end $game_system.skill_charge[actor.id][i] += $game_system.skill_charge_kari[actor.id][i] $game_system.skill_charge_kari[actor.id][i] = 0 end $game_system.sp[actor.id] = $game_system.sp_kari[actor.id] @skill_window.update_hantei = true @skill_window.update #ゲージのアップデート if @newlearn_list.size > 0 @result_window.active = true @result_window.visible = true @result_page_max = @result_window.page_number_max(@newlearn_list) @result_page_num = 1 @result_window.refresh(@newlearn_list,@result_page_num) else return_scene end end #-------------------------------------------------------------------------- # ● スキル選択の更新 #-------------------------------------------------------------------------- def update_result_wait if Input.trigger?(Input::B) Sound.play_decision return_scene elsif Input.trigger?(Input::C) Sound.play_decision if @result_page_num == @result_page_max @view_window.refresh return_scene else @result_page_num += 1 @result_window.refresh(@newlearn_list,@result_page_num) end end end end #============================================================================== # ■ Window_SkillPoint #------------------------------------------------------------------------------ #  振り分ける親スキルの名前とゲージを表示するウィンドウです。 #============================================================================== class Window_SkillPoint < Window_Selectable attr_accessor :update_hantei #アップデート判定変数 #-------------------------------------------------------------------------- # ● オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # width : ウィンドウの幅 # height : ウィンドウの高さ # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y, width, height, actor) super(x, y, width, height) @update_hantei = true @actor = actor @column_max = 1 self.index = 0 @data1 = [] #アクターのスキルIDを順番に格納 @data2 = [] #アクタースキルを順番に格納 for skillid in 0...WD_skilldivide_ini::Skilllearn.size if $game_system.skill_useable[@actor.id][skillid] == true @data1.push(skillid) @data2.push(WD_skilldivide_ini::Skilllearn[skillid]) end end @item_max = @data1.size refresh end #-------------------------------------------------------------------------- # ● スキルの取得 #-------------------------------------------------------------------------- def skill return @data[self.index] end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear create_contents for i in 0...@item_max draw_item(i) end end def update super refresh if @update_hantei @update_hantei = false end #-------------------------------------------------------------------------- # ● 項目の描画 # index : 項目番号 #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) skillid = @data1[index] skillob = @data2[index] if skillid != nil rect.x += 4 rect.width -= 8 self.contents.draw_text(rect, skillob[0], 0) gauge_now = $game_system.skill_charge[@actor.id][skillid] gauge_add = $game_system.skill_charge_kari[@actor.id][skillid] draw_skill_charge_gauge(gauge_now, gauge_add, rect.x + 240, rect.y, skillid, 120) if WD_skilldivide_ini::Max_charge_each[skillid] != nil self.contents.draw_text(rect, "#{gauge_now + gauge_add}/#{WD_skilldivide_ini::Max_charge_each[skillid]}#{WD_skilldivide_ini::Sp_dimention}" ,2) else self.contents.draw_text(rect, "#{gauge_now + gauge_add}/#{WD_skilldivide_ini::Max_charge}#{WD_skilldivide_ini::Sp_dimention}" ,2) end end end #-------------------------------------------------------------------------- # ● ゲージの描画 #-------------------------------------------------------------------------- def draw_skill_charge_gauge(value1, value2, x, y, skillid, width = 120) if WD_skilldivide_ini::Max_charge_each[skillid] != nil gaugemax = WD_skilldivide_ini::Max_charge_each[skillid] else gaugemax = WD_skilldivide_ini::Max_charge end gw_1 = width * value1 / gaugemax gw_2 = width * value2 / gaugemax self.contents.fill_rect(x, y + WLH - 18, width, 12, gauge_back_color) if WD_skilldivide_ini::Gauge_image_use == true bitmap2 = Cache.picture(WD_skilldivide_ini::Gauge_image2) rect2 = Rect.new(0, 0, gw_1 + gw_2, 12) self.contents.blt(x, y + WLH - 18, bitmap2, rect2) bitmap1 = Cache.picture(WD_skilldivide_ini::Gauge_image1) rect1 = Rect.new(0, 0, gw_1, 12) self.contents.blt(x,y + WLH - 18, bitmap1, rect1) else gc_1s = WD_skilldivide_ini::Gauge_color1 gc_2n = WD_skilldivide_ini::Gauge_color2 gc1_1 = Color.new(gc_1s[0],gc_1s[1],gc_1s[2],gc_1s[3]) gc2_1 = Color.new(gc_1s[0],gc_1s[1],gc_1s[2],gc_1s[3]) gc1_2 = Color.new(gc_2n[0],gc_2n[1],gc_2n[2],gc_2n[3]) gc2_2 = Color.new(gc_2n[0],gc_2n[1],gc_2n[2],gc_2n[3]) self.contents.gradient_fill_rect(x + gw_1, y + WLH - 18, gw_2, 12, gc1_2, gc2_2) self.contents.gradient_fill_rect(x, y + WLH - 18, gw_1, 12, gc1_1, gc2_1) end if WD_skilldivide_ini::Gauge_waku_image_use == true bitmap3 = Cache.picture(WD_skilldivide_ini::Gauge_waku_image) rect3 = Rect.new(0, 0, bitmap3.width, bitmap3.height) dx = WD_skilldivide_ini::Gauge_waku_image_x dy = WD_skilldivide_ini::Gauge_waku_image_y self.contents.blt(x - 6 + dx, y + WLH - 23 + dy, bitmap3, rect3) end end #-------------------------------------------------------------------------- # ● ゲージの上昇 #-------------------------------------------------------------------------- def uppoint(index) skillid = @data1[index] if skillid != nil if WD_skilldivide_ini::Max_charge_each[skillid] != nil gaugemax = WD_skilldivide_ini::Max_charge_each[skillid] else gaugemax = WD_skilldivide_ini::Max_charge end if ($game_system.skill_charge[@actor.id][skillid] + $game_system.skill_charge_kari[@actor.id][skillid]) < gaugemax and $game_system.sp_kari[@actor.id] > 0 if WD_skilldivide_ini::Level_limit if ($game_system.skill_charge[@actor.id][skillid] + $game_system.skill_charge_kari[@actor.id][skillid]) == WD_skilldivide_ini::Limit_a * (@actor.level - 1) + WD_skilldivide_ini::Limit_b hantei = false else hantei = true end else hantei = true end if hantei $game_system.skill_charge_kari[@actor.id][skillid] += 1 $game_system.sp_kari[@actor.id] -= 1 Sound.play_cursor draw_item(index) end end end end #-------------------------------------------------------------------------- # ● ゲージの下降 #-------------------------------------------------------------------------- def downpoint(index) skillid = @data1[index] if skillid != nil if $game_system.skill_charge_kari[@actor.id][skillid] > 0 $game_system.skill_charge_kari[@actor.id][skillid] -= 1 $game_system.sp_kari[@actor.id] += 1 Sound.play_cursor draw_item(index) end end end end #============================================================================== # ■ Window_SkillPointStatus #------------------------------------------------------------------------------ #  残りスキルポイントを表示するウィンドウです。 #============================================================================== class Window_SkillPointStatus < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y, actor) super(x, y, 544, WLH + 32) @actor = actor refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear draw_actor_name(@actor, 4, 0) self.contents.draw_text(0, 0, 544-32, WLH, "残り#{WD_skilldivide_ini::Sp_name}   ", 2) self.contents.draw_text(0, 0, 544-32, WLH, "#{$game_system.sp_kari[@actor.id]}#{WD_skilldivide_ini::Sp_dimention}", 2) end def update super refresh end end #============================================================================== # ■ Window_ConfirmDevide #------------------------------------------------------------------------------ #  確認用メッセージを表示するウィンドウです。 #============================================================================== class Window_ConfirmDevide < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # width : ウィンドウの幅 # height : ウィンドウの高さ # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y, width, height, actor) super(x, y, width, height) @index = 0 @data = [WD_skilldivide_ini::Confirm_yes, WD_skilldivide_ini::Confirm_no] @item_max = @data.size refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear create_contents rect = item_rect(0) self.contents.clear_rect(rect) self.contents.draw_text(rect, WD_skilldivide_ini::Confirm_mess, 0) for i in 0...@item_max draw_item(i) end end def update super y = WLH * (1 + @index) self.cursor_rect.set(0, y, 544-36, WLH) end #-------------------------------------------------------------------------- # ● 項目の描画 # index : 項目番号 #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index+1) self.contents.clear_rect(rect) self.contents.draw_text(rect, @data[index], 0) end end #============================================================================== # ■ Window_SkillResult #------------------------------------------------------------------------------ #  修得したスキルの一覧を表示するウィンドウです。 #============================================================================== class Window_SkillResult < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # width : ウィンドウの幅 # height : ウィンドウの高さ # actor : アクター #-------------------------------------------------------------------------- def initialize(actor) x = (544-WD_skilldivide_ini::Result_width)/2 y = (416-WD_skilldivide_ini::Result_height)/2 width = WD_skilldivide_ini::Result_width height = WD_skilldivide_ini::Result_height super(x, y, width, height) @actor = actor end #-------------------------------------------------------------------------- # ● ページ数の取得 #-------------------------------------------------------------------------- def page_number_max(list) @listmax = (WD_skilldivide_ini::Result_height-32)/WLH - 1 if list.size % @listmax > 0 return list.size / @listmax + 1 else return list.size / @listmax end end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh(list,page_num) self.contents.clear self.contents.font.color = system_color self.contents.draw_text(0, 0, WD_skilldivide_ini::Result_width-32, WLH, WD_skilldivide_ini::Result_text) self.contents.font.color = normal_color st = (page_num-1) * @listmax ed = st + @listmax j = 0 for i in st...ed j += 1 if i < list.size draw_item_name($data_skills[list[i]], 0, WLH*j, enabled = true) end end end end #============================================================================== # ■ Window_SkillPointView #------------------------------------------------------------------------------ #  修得できる各スキルを表示するウィンドウです。 #============================================================================== class Window_SkillPointView < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # width : ウィンドウの幅 # height : ウィンドウの高さ # actor : アクター #-------------------------------------------------------------------------- def initialize(x, y, width, height, actor) super(x, y, width, height) @actor = actor @data1 = [] #アクターのスキルIDを順番に格納 @data2 = [] #アクタースキルを順番に格納 for skillid in 0...WD_skilldivide_ini::Skilllearn.size if $game_system.skill_useable[@actor.id][skillid] == true @data1.push(skillid) @data2.push(WD_skilldivide_ini::Skilllearn[skillid]) end end @last_index = 0 end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh @last_index = @skill_index #ラストカーソルの位置を記憶し、処理を軽減 self.contents.clear linemax = (416-32-24*WD_skilldivide_ini::Skill_row-56-32)/24 linemax -= 2 i = -1 if @skill_index != nil and @data2.size > 0 basic_skill_name = @data2[@skill_index][0] self.contents.draw_text(0, 0, 544-32, WLH, basic_skill_name, 0) for skill_id_sp in @data2[@skill_index] i = i + 1 next if i == 0 skill_id = skill_id_sp.split(/;/)[0].to_i skill_sp = skill_id_sp.split(/;/)[1].to_i x = 0 if i <= linemax x = 256 if i > linemax y = WLH*(i+1) if i <= linemax y = WLH*(i-linemax+1) if i > linemax if i <= 2*linemax if WD_skilldivide_ini::Nolearn_display == false draw_item_name($data_skills[skill_id], x + 12, y, enabled = true) else if (@actor.skill_learn?($data_skills[skill_id])) != true self.contents.draw_text(x + 36, y, 172, WLH, WD_skilldivide_ini::Nolearn_text, 0) else draw_item_name($data_skills[skill_id], x + 12, y, enabled = true) end end if (@actor.skill_learn?($data_skills[skill_id])) != true self.contents.draw_text(x, y, 256, WLH, "#{skill_sp}#{WD_skilldivide_ini::Sp_dimention}", 2) else self.contents.draw_text(x, y, 256, WLH, "MASTER", 2) end end end end end def update super refresh if @last_index != @skill_index end def set(skill_index) @skill_index = skill_index end end class Game_System #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :sp attr_accessor :sp_kari attr_accessor :skill_useable attr_accessor :skill_charge attr_accessor :skill_charge_kari #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias wd_orig_initialize10 initialize def initialize wd_orig_initialize10 @sp = [] @sp_kari = [] @skill_useable = [] @skill_charge = [] @skill_charge_kari = [] end end class Game_Interpreter include WD_skillpoint end class Game_Actor < Game_Battler include WD_skillpoint #-------------------------------------------------------------------------- # ● 経験値の変更 #-------------------------------------------------------------------------- alias wd_orig_change_exp10 change_exp def change_exp(exp, show) @getskillpoint = 0 wd_orig_change_exp10(exp, show) end #-------------------------------------------------------------------------- # ● レベルアップ #-------------------------------------------------------------------------- alias wd_orig_level_up10 level_up def level_up if WD_skilldivide_ini::Sp_exp_each[@actor_id] == nil @getskillpoint += WD_skilldivide_ini::Sp_exp get_skillpoint(@actor_id, WD_skilldivide_ini::Sp_exp) else @getskillpoint += WD_skilldivide_ini::Sp_exp_each[@actor_id] get_skillpoint(@actor_id, WD_skilldivide_ini::Sp_exp_each[@actor_id]) end wd_orig_level_up10 end #-------------------------------------------------------------------------- # ● レベルアップメッセージの表示 #-------------------------------------------------------------------------- alias wd_orig_display_level_up10 display_level_up def display_level_up(new_skills) wd_orig_display_level_up10(new_skills) text = "#{WD_skilldivide_ini::Sp_name}を#{@getskillpoint}#{WD_skilldivide_ini::Sp_dimention}手に入れた!" $game_message.texts.push(text) end end class Game_Battler include WD_skillpoint #-------------------------------------------------------------------------- # ● アイテムの適用テスト # user : アイテムの使用者 # item : アイテム # 使用対象が全快しているときの回復禁止などを判定する。 #-------------------------------------------------------------------------- alias wd_orig_item_test10 item_test def item_test(user, item) if // =~ item.note value = $1.to_i get_skillpoint(self.id, value) return true end if /<親スキル追加:(.+)>/ =~ item.note skillid = $1.to_i $game_system.skill_useable = [] if $game_system.skill_useable == nil $game_system.skill_useable[self.id] = [] if $game_system.skill_useable[self.id]== nil if $game_system.skill_useable[self.id][skillid] != true add_skilluseable(self.id, skillid) return true end end return wd_orig_item_test10(user, item) end end class Scene_Menu < Scene_Base #-------------------------------------------------------------------------- # ● コマンドウィンドウの作成(再定義) #-------------------------------------------------------------------------- def create_command_window s1 = Vocab::item s2 = Vocab::skill s3 = Vocab::equip s4 = Vocab::status s5 = Vocab::save s6 = Vocab::game_end s7 = WD_skilldivide_ini::Sp_command #スキルポイント振り分け @command_window = Window_Command.new(160, [s1, s2, s3, s4, s7, s5, s6]) @command_window.index = @menu_index if $game_party.members.size == 0 # パーティ人数が 0 人の場合 @command_window.draw_item(0, false) # アイテムを無効化 @command_window.draw_item(1, false) # スキルを無効化 @command_window.draw_item(2, false) # 装備を無効化 @command_window.draw_item(3, false) # ステータスを無効化 @command_window.draw_item(4, false) # スキルポイント振り分け end if $game_system.save_disabled # セーブ禁止の場合 @command_window.draw_item(5, false) # セーブを無効化 end end #-------------------------------------------------------------------------- # ● コマンド選択の更新(再定義) #-------------------------------------------------------------------------- def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) if $game_party.members.size == 0 and @command_window.index < 5 Sound.play_buzzer return elsif $game_system.save_disabled and @command_window.index == 5 Sound.play_buzzer return end Sound.play_decision case @command_window.index when 0 # アイテム $scene = Scene_Item.new when 1,2,3,4 # スキル、装備、ステータス、スキルポイント振り分け start_actor_selection when 5 # セーブ $scene = Scene_File.new(true, false, false) when 6 # ゲーム終了 $scene = Scene_End.new end end end #-------------------------------------------------------------------------- # ● アクター選択の更新(再定義) #-------------------------------------------------------------------------- def update_actor_selection if Input.trigger?(Input::B) Sound.play_cancel end_actor_selection elsif Input.trigger?(Input::C) $game_party.last_actor_index = @status_window.index Sound.play_decision case @command_window.index when 1 # スキル $scene = Scene_Skill.new(@status_window.index) when 2 # 装備 $scene = Scene_Equip.new(@status_window.index) when 3 # ステータス $scene = Scene_Status.new(@status_window.index) when 4 # スキルポイント振り分け $scene = Scene_SkillPoint.new(@status_window.index) end end end end class Scene_File < Scene_Base #-------------------------------------------------------------------------- # ● 元の画面へ戻る(再定義) #-------------------------------------------------------------------------- def return_scene if @from_title $scene = Scene_Title.new elsif @from_event $scene = Scene_Map.new else $scene = Scene_Menu.new(5) end end end class Scene_End < Scene_Base #-------------------------------------------------------------------------- # ● 元の画面へ戻る(再定義) #-------------------------------------------------------------------------- def return_scene $scene = Scene_Menu.new(6) end end