#============================================================================== # ■アクター合成 for RGSS3 Ver0.90-α # □作成者 kure #=============================================================================== $kure_integrate_script = {} if $kure_integrate_script == nil $kure_integrate_script[:ActorConvert] = 100 p "アクター合成" #-------------------------------------------------------------------------- # ★ 設定項目(各設定の値を変更してください) #-------------------------------------------------------------------------- module KURE module ActorConvert #基本設定(変更しない事)------------------------------------------------------- #表示に関する項目------------------------------------------------------------- #ゲームに使用する歩行グラフィックの高さと横幅 #RTPのサイズ32で調節しています。 CHARACTER_HEIGHT = 32 CHARACTER_WIDTH = 32 #動作設定--------------------------------------------------------------------- #合成要求レベル(合成に必要な最低レベル) NEED_LEVEL = 10 #継承パラメータレート(割合指定) SUCCEED_RATE = 0.1 #合成候補基本ルール適用(0=OFF 1=ON) #特殊合成ルール判定が適用され場合基本ルールの判定を行うか設定します。 BASIC_RULE = 0 #スキル継承最大数 MAX_SKILL_SUCCEED = 8 end end module KURE #-------------------------------------------------------------------------- # ☆ 数値配列に畳む(追加定義) #-------------------------------------------------------------------------- def self.arr_num_slice(arr) result_arr = Array.new unless arr == [] and arr.empty? arr.flatten! arr.each{|value| value.scan(/\d+/).each { |num| result_arr.push(num.to_i)}} end return result_arr end end #============================================================================== # ■ RPG::Actor(追加定義) #============================================================================== class RPG::Actor < RPG::BaseItem #-------------------------------------------------------------------------- # ☆ 合成不可の定義(再定義) #-------------------------------------------------------------------------- def not_convert_unit? @note.include?("<合成不可>") end #-------------------------------------------------------------------------- # ☆ 系統IDの定義(再定義) #-------------------------------------------------------------------------- def category_id @note.match(/<系統\s?(\d+)\s?>/) return $1 ? $1.to_i : 0 end #-------------------------------------------------------------------------- # ☆ ランクIDの定義(再定義) #-------------------------------------------------------------------------- def rank_id @note.match(/<ランク\s?(\d+)\s?>/) return $1 ? $1.to_i : 0 end #-------------------------------------------------------------------------- # ☆ 継承対応の定義(追加定義) #-------------------------------------------------------------------------- def succeed_adopt_id result = KURE.arr_num_slice(@note.scan(/<継承対応\s?(\d+(?:\s?*,\s?*\d+)*)>/)) result += [0] return result end end #============================================================================== # ●■ RPG::UsableItem(追加定義集積) #============================================================================== class RPG::UsableItem < RPG::BaseItem #-------------------------------------------------------------------------- # ☆ 継承不可の定義(再定義) #-------------------------------------------------------------------------- def not_succeed_skill? @note.include?("<継承不可>") end #-------------------------------------------------------------------------- # ☆ 継承制限の定義(再定義) #-------------------------------------------------------------------------- def succeed_limit_id @note.match(/<継承制限\s?(\d+)\s?>/) return $1 ? $1.to_i : 0 end end #============================================================================== # ■ Window_Base #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ★ 系統の描画(追加定義) #-------------------------------------------------------------------------- def draw_category(actor, x, y) change_color(normal_color) draw_text(x, y, 100, line_height, Vocab.category_name(actor.actor.category_id)) end #-------------------------------------------------------------------------- # ★ ランクの描画(追加定義) #-------------------------------------------------------------------------- def draw_rank(actor, x, y) change_color(system_color) draw_text(x, y, 50, line_height, "Rank") change_color(normal_color) draw_text(x + 55 , y, 45, line_height, Vocab.rank_name(actor.actor.rank_id)) end end #============================================================================== # ■ Game_Actor #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ★ 習得しているスキルIDの配列を返す #-------------------------------------------------------------------------- def learned_skill_id @skills ? @skills : [] end end #============================================================================== # ■ Scene_ActorConvert #============================================================================== class Scene_ActorConvert < Scene_MenuBase #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super create_help_window create_ptm_window create_info_window create_select_window create_popup_window window_setting end #-------------------------------------------------------------------------- # ● ヘルプウィンドウの作成 #-------------------------------------------------------------------------- def create_help_window @help_window = Window_Help.new(1) @help_window.set_text("合成させるアクターを選択してください") end #-------------------------------------------------------------------------- # ● パーティーメンバーウィンドウの作成 #-------------------------------------------------------------------------- def create_ptm_window wx = 0 wy = @help_window.height wh = Graphics.height - @help_window.height @ptm_window = Window_AC_ALLPartyMember_List.new(wx, wy, wh) #ハンドラのセット @ptm_window.set_handler(:cancel, method(:ptm_cancel)) @ptm_window.set_handler(:ok, method(:ptm_ok)) end #-------------------------------------------------------------------------- # ● 合成情報ウィンドウの作成 #-------------------------------------------------------------------------- def create_info_window wx = @ptm_window.width wy = @help_window.height ww = Graphics.width - @ptm_window.width wh = 24 * 6 @info_window = Window_Actor_Convert_InfoWindow.new(wx, wy, ww, wh) end #-------------------------------------------------------------------------- # ● 合成結果ウィンドウの作成 #-------------------------------------------------------------------------- def create_select_window wx = @ptm_window.width wy = @help_window.height + @info_window.height ww = Graphics.width - @ptm_window.width wh = Graphics.height - wy @select_window = Window_AC_Result_Select.new(wx, wy, ww, wh) @select_window.deactivate @select_window.unselect #ハンドラのセット @select_window.set_handler(:cancel, method(:selet_cancel)) @select_window.set_handler(:ok, method(:select_ok)) end #-------------------------------------------------------------------------- # ● ポップアップウィンドウの作成 #-------------------------------------------------------------------------- def create_popup_window wx = 0 wy = 48 ww = Graphics.width - wx * 2 wh = Graphics.height - wy @popup_window = Window_Actor_Convert_PoPInfo_Window.new(wx, wy, ww, wh) @popup_window.z += 100 @popup_window.hide wx2 = @popup_window.x wy2 = @popup_window.y + 24 * 3 ww2 = @popup_window.width / 2 wh2 = @popup_window.height - 24 * 3 @pop_select = Window_Actor_Convert_PoPCommand_Window.new(wx2, wy2, ww2, wh2) @pop_select.z += 150 @pop_select.opacity = 0 @pop_select.deactivate @pop_select.hide @pop_select.set_handler(:cancel, method(:pop_sel_cancel)) @pop_select.set_handler(:ok, method(:pop_sel_ok)) end #-------------------------------------------------------------------------- # ● ウィンドウのセット #-------------------------------------------------------------------------- def window_setting @ptm_window.set_actor_list @ptm_window.select_window = @select_window @ptm_window.info_window = @info_window @info_window.actor1 = @ptm_window.current_ext end #-------------------------------------------------------------------------- # ● パーティーメンバーウィンドウ[決定] #-------------------------------------------------------------------------- def ptm_ok unless @select_window.actor1 set_actor(1, @ptm_window.current_ext) else set_actor(2, @ptm_window.current_ext) @help_window.set_text("合成後のアクターを選択してください") @select_window.select(0) @select_window.activate end end #-------------------------------------------------------------------------- # ● パーティーメンバーウィンドウ[キャンセル] #-------------------------------------------------------------------------- def ptm_cancel unless @select_window.actor1 return_scene else set_actor(2, nil) set_actor(1, nil) @select_window.refresh end end #-------------------------------------------------------------------------- # ● セレクトウィンドウ[決定] #-------------------------------------------------------------------------- def select_ok #継承のためのデータを取得 actor1 = @select_window.actor1 actor2 = @select_window.actor2 skill_data = actor1.learned_skill_id + actor2.learned_skill_id #ポップアップを開く @popup_window.actor = @select_window.current_ext @pop_select.actor = @select_window.current_ext @pop_select.skill_data = skill_data.uniq @help_window.set_text("継承させるスキルを選択してください") @select_window.deactivate @pop_select.select(0) @pop_select.activate change_window_view(1) end #-------------------------------------------------------------------------- # ● セレクトウィンドウ[キャンセル] #-------------------------------------------------------------------------- def selet_cancel set_actor(2, nil) @ptm_window.activate @select_window.deactivate @select_window.unselect @help_window.set_text("合成させるアクターを選択してください") end #-------------------------------------------------------------------------- # ● ポップセレクトウィンドウ[決定] #-------------------------------------------------------------------------- def pop_sel_ok #確定を選択した場合の処理 unless @pop_select.current_ext #データ継承 actor1 = @select_window.actor1 actor2 = @select_window.actor2 succeed_actor(actor1, actor2) change_window_view(0) @select_window.unselect set_actor(1, nil) set_actor(2, nil) @ptm_window.set_actor_list @ptm_window.select(0) @help_window.set_text("合成させるアクターを選択してください") @popup_window.skill_data = [] else @popup_window.add_skill_data(@pop_select.current_ext) @pop_select.incude_data = @popup_window.skill_data @pop_select.refresh @pop_select.activate end end #-------------------------------------------------------------------------- # ● ポップセレクトウィンドウ[決定] #-------------------------------------------------------------------------- def pop_sel_cancel if @popup_window.skill_data == [] change_window_view(0) @select_window.activate else @popup_window.delete_skill_data @pop_select.incude_data = @popup_window.skill_data @pop_select.refresh @pop_select.activate end end #-------------------------------------------------------------------------- # ● アクターのセット #-------------------------------------------------------------------------- def set_actor(window, actor) case window when 1 @info_window.actor1 = actor @ptm_window.actor1 = actor @select_window.actor1 = actor @ptm_window.activate when 2 @info_window.actor2 = actor @ptm_window.actor2 = actor @select_window.actor2 = actor end end #-------------------------------------------------------------------------- # ● 継承処理[キャンセル] #-------------------------------------------------------------------------- def succeed_actor(actor1, actor2) new_plus = [actor1.plus, actor2.plus].max + 1 new_succeed = [0,0,0,0,0,0,0,0] 8.times{|index| new_succeed[index] += actor1.succeed_param(index)} 8.times{|index| new_succeed[index] += actor2.succeed_param(index)} #アクターを削除 $game_party.delete_actor(actor1.id) $game_party.delete_actor(actor2.id) #継承処理の為新しい固有IDを記録 new_identify_id = $game_actors.empty_id $game_party.add_actor(@select_window.current_ext.id) parents_id = [actor1.database_id, actor2.database_id].sort! #新しいアクターへデータを継承 new_actor = $game_actors[$game_actors.actor_id(new_identify_id)] new_actor.plus = new_plus new_actor.parents = parents_id 8.times{|index| value = (new_succeed[index] * KURE::ActorConvert::SUCCEED_RATE).to_i new_actor.set_succeed_param(index, value)} @popup_window.skill_data.each{|skill|new_actor.learn_skill(skill.id)} end #-------------------------------------------------------------------------- # ● ウィンドウ表示の切り替え #-------------------------------------------------------------------------- def change_window_view(command) case command when 0 @popup_window.hide @pop_select.hide @pop_select.deactivate @ptm_window.show @info_window.show @select_window.show when 1 @popup_window.show @pop_select.show @ptm_window.hide @info_window.hide @select_window.hide @select_window.deactivate end end end #============================================================================== # ■ Window_AC_ALLPartyMember_List #============================================================================== class Window_AC_ALLPartyMember_List< Window_Command attr_accessor :select_window attr_accessor :info_window attr_accessor :actor1 attr_accessor :actor2 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, height) @window_height = height @max_page = 0 @page_index = 0 @last_index = 0 @actor_list = nil super(x,y) end #-------------------------------------------------------------------------- # ● アクターの設定 #-------------------------------------------------------------------------- def actor1=(actor) return if @actor1 == actor ; @actor1 = actor ; refresh end #-------------------------------------------------------------------------- # ● アクターの設定 #-------------------------------------------------------------------------- def actor2=(actor) return if @actor2 == actor ; @actor2 = actor ; refresh end #-------------------------------------------------------------------------- # ● アクターリストの設定 #-------------------------------------------------------------------------- def set_actor_list @actor_list = $game_actors.all_data {|actor| include?(actor)} ; refresh end #-------------------------------------------------------------------------- # ● ウィンドウ幅と高さ、項目の高さの取得 #-------------------------------------------------------------------------- def window_width ; 180 ; end def window_height ; @window_height ; end def item_height ; KURE::ActorConvert::CHARACTER_HEIGHT + 2 ; end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) change_color(normal_color, command_enabled?(index)) rect = item_rect(index) rect.x += KURE::ActorConvert::CHARACTER_WIDTH / 2 actor = @list[index][:ext] draw_character(actor.character_name, actor.character_index , rect.x, rect.y + rect.height) rect.x += (KURE::ActorConvert::CHARACTER_WIDTH / 2) + 2 draw_text(rect, command_name(index), alignment) end #-------------------------------------------------------------------------- # ● カーソルを 1 ページ後ろに移動 #-------------------------------------------------------------------------- def cursor_pagedown @page_index += 1 refresh cursor_fix end #-------------------------------------------------------------------------- # ● カーソルを 1 ページ前に移動 #-------------------------------------------------------------------------- def cursor_pageup @page_index -= 1 refresh cursor_fix end #-------------------------------------------------------------------------- # ● カーソル位置修正 #-------------------------------------------------------------------------- def cursor_fix @index = [@index,@last_index].min update_cursor call_update_help unless @actor1 @info_window.actor1 = current_ext if @select_window end if @actor1 && !@actor2 @select_window.actor2 = current_ext if @select_window @info_window.actor2 = current_ext if @info_window end end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list return unless @actor_list data = @actor_list @max_page = data.size.divmod(9)[0] - 1 @max_page += 1 if data.size.divmod(9)[1] != 0 @max_page += 1 if data.size == 0 @page_index = 0 if @page_index > @max_page @page_index = @max_page if @page_index < 0 first = @page_index * 9 last = [((@page_index + 1 ) * 9) - 1, data.size - 1].min @last_index = last - first data = data[first..last] data.each{|actor| add_command(actor.name, :ok, enable?(actor), actor) if include?(actor)} end #-------------------------------------------------------------------------- # ● コマンドの追加判定 #-------------------------------------------------------------------------- def include?(actor) if $kure_integrate_script[:Multi_Party] all_id = $game_party.call_sub_save_acor.flatten p all_id return false if all_id.include?(actor.id) end return false if actor.actor.not_convert_unit? return true end #-------------------------------------------------------------------------- # ● コマンドの有効判定 #-------------------------------------------------------------------------- def enable?(actor) #レベル判定 return false if actor.level < KURE::ActorConvert::NEED_LEVEL #アクター重複判定 return false if @actor1 && actor.id == @actor1.id return false if @actor2 && actor.id == @actor2.id return true end #-------------------------------------------------------------------------- # ● カーソル位置の設定 #-------------------------------------------------------------------------- def index=(index) @index = index update_cursor call_update_help unless @actor1 @info_window.actor1 = current_ext if @select_window end if @actor1 && !@actor2 @select_window.actor2 = current_ext if @select_window @info_window.actor2 = current_ext if @info_window end end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_guide last_size = contents.font.size contents.font.size = 20 change_color(normal_color) draw_text(0, contents.height - line_height, contents.width, line_height, "LR:切替 " + "(" + (@page_index + 1).to_s + "/" + (@max_page + 1).to_s + ")", 1) contents.font.size = last_size end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh super draw_guide end end #============================================================================== # ■ Window_Actor_Convert_InfoWindow #============================================================================== class Window_Actor_Convert_InfoWindow < Window_Base attr_accessor :actor1 attr_accessor :actor2 #-------------------------------------------------------------------------- # ● アクターの設定 #-------------------------------------------------------------------------- def actor1=(actor) return if @actor1 == actor ; @actor1 = actor ; refresh end #-------------------------------------------------------------------------- # ● アクターの設定 #-------------------------------------------------------------------------- def actor2=(actor) return if @actor2 == actor ; @actor2 = actor ; refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear item_x = KURE::ActorConvert::CHARACTER_WIDTH / 2 item_y = KURE::ActorConvert::CHARACTER_HEIGHT + 2 change_color(system_color) draw_text(0, line_height * 2 , contents.width, line_height, "+", 1) change_color(normal_color) return unless @actor1 draw_character(@actor1.character_name, @actor1.character_index , item_x, line_height * 2 - ((line_height * 2 - item_y) / 2) ) draw_actor_data(item_x * 2, 0, @actor1) return unless @actor2 draw_character(@actor2.character_name, @actor2.character_index , item_x, line_height * 5 - ((line_height * 2 - item_y) / 2)) draw_actor_data(item_x * 2, line_height * 3, @actor2) end #-------------------------------------------------------------------------- # ● アクターデータの描画 #-------------------------------------------------------------------------- def draw_actor_data(x, y, actor) return unless actor draw_text(x + 2, y, 120, line_height, actor.name) draw_text(x + 125, y, 100, line_height, Vocab.category_name(actor.actor.category_id)) draw_text(x + 230, y, 100, line_height, "Rank " + Vocab.rank_name(actor.actor.rank_id)) draw_text(x + 2, y + line_height, 120, line_height, actor.class.name) draw_text(x + 128, y + line_height, 100, line_height, "Lv " + actor.level.to_s) end end #============================================================================== # ■ Window_AC_Result_Select #============================================================================== class Window_AC_Result_Select< Window_Command attr_accessor :actor1 attr_accessor :actor2 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, width ,height) @window_height = height @window_width = width super(x,y) end #-------------------------------------------------------------------------- # ● アクターの設定 #-------------------------------------------------------------------------- def actor2=(actor) return if @actor2 == actor ; @actor2 = actor ; refresh end #-------------------------------------------------------------------------- # ● ウィンドウ幅と高さ、項目の高さの取得 #-------------------------------------------------------------------------- def window_width ; @window_width ; end def window_height ; @window_height ; end def item_height ; [line_height * 2, KURE::ActorConvert::CHARACTER_HEIGHT].max ; end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) return unless @actor1 pos_x = KURE::ActorConvert::CHARACTER_WIDTH / 2 pos_y = item_height * index ; actor = @list[index][:ext] item_x = pos_x + KURE::ActorConvert::CHARACTER_WIDTH / 2 item_y = pos_y + (item_height - ((item_height - KURE::ActorConvert::CHARACTER_HEIGHT) / 2)) draw_character(actor.character_name, actor.character_index , pos_x, item_y) draw_text(item_x + 2, pos_y, 150, line_height, actor.name) draw_text(item_x + 2, pos_y + line_height, 120, line_height, $data_classes[actor.class_id].name) draw_text(item_x + 128, pos_y + line_height, 100, line_height, "Lv " + actor.initial_level.to_s) end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list return if !@actor1 or !@actor2 data = [] db_id_1 = @actor1.database_id db_id_2 = @actor2.database_id cat_id_1 = @actor1.actor.category_id cat_id_2 = @actor2.actor.category_id min_id = [db_id_1, db_id_2].min max_id = [db_id_1, db_id_2].max new_plus = [@actor1.plus, @actor2.plus].max + 1 parents_list = @actor1.parents + @actor2.parents #特殊合成ルール判定 #特殊合成テーブル1(ID指定) data += KURE::ActorConvert.id_id_data(min_id, max_id, new_plus) #特殊合成テーブル2(ID、系統指定) data += KURE::ActorConvert.id_ct_data(db_id_1, cat_id_2, new_plus) data += KURE::ActorConvert.id_ct_data(db_id_2, cat_id_1, new_plus) #特殊合成テーブル3(4体配合) data += KURE::ActorConvert.id_fc_data(parents_list, new_plus) #通常合成ルール判定 if KURE::ActorConvert::BASIC_RULE == 1 or data == [] rank_tabale_id = [@actor1.actor.rank_id , @actor2.actor.rank_id].max rank_tabale_id += 1 if @actor1.actor.rank_id == @actor2.actor.rank_id data += KURE::ActorConvert::ACTOR_TABLE[rank_tabale_id][cat_id_1] data += KURE::ActorConvert::ACTOR_TABLE[rank_tabale_id][cat_id_2] end data.uniq! data.each{|id| add_command($data_actors[id].name, :ok, true, $data_actors[id])} end #-------------------------------------------------------------------------- # ● カーソル位置の設定 #-------------------------------------------------------------------------- def index=(index) @index = index update_cursor call_update_help end end #============================================================================== # ■ Window_Actor_Convert_PoPInfo_Window #============================================================================== class Window_Actor_Convert_PoPInfo_Window < Window_Base attr_accessor :actor attr_accessor :skill_data #-------------------------------------------------------------------------- # ● スキルデータの設定 #-------------------------------------------------------------------------- def skill_data @skill_data ? @skill_data : [] end #-------------------------------------------------------------------------- # ● アクターの設定 #-------------------------------------------------------------------------- def actor=(actor) return if @actor == actor ; @actor = actor ; refresh end #-------------------------------------------------------------------------- # ● スキルデータの設定 #-------------------------------------------------------------------------- def skill_data=(data) return if @skill_data == data ; @skill_data = data ; refresh end #-------------------------------------------------------------------------- # ● スキルデータの追加 #-------------------------------------------------------------------------- def add_skill_data(data) @skill_data ||= [] if @skill_data.include?(data) @skill_data.delete(data) else if @skill_data.size == KURE::ActorConvert::MAX_SKILL_SUCCEED @skill_data[KURE::ActorConvert::MAX_SKILL_SUCCEED - 1] = data else @skill_data.push(data) end end refresh end #-------------------------------------------------------------------------- # ● 末尾のスキルデータの削除 #-------------------------------------------------------------------------- def delete_skill_data @skill_data.delete_at(@skill_data.size - 1) refresh end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear draw_actor_data(@actor) end #-------------------------------------------------------------------------- # ● アクターデータの描画 #-------------------------------------------------------------------------- def draw_actor_data(actor) return unless actor x = KURE::ActorConvert::CHARACTER_WIDTH / 2 y = KURE::ActorConvert::CHARACTER_HEIGHT * 4 / 3 draw_character(actor.character_name, actor.character_index , x, y) draw_text(x * 2 + 2, 0, 150, line_height, actor.name) draw_text(x + 125, 0, 100, line_height, Vocab.category_name(actor.category_id)) draw_text(x + 230, 0, 100, line_height, "Rank " + Vocab.rank_name(actor.rank_id)) draw_text(x * 2 + 2, line_height, 120, line_height, $data_classes[actor.class_id].name) draw_text(x * 2 + 128, line_height, 100, line_height, "Lv " + actor.initial_level.to_s) KURE::ActorConvert::MAX_SKILL_SUCCEED.times{|index| draw_text(contents.width / 2 , line_height * (3 + index), 20 , line_height, (index + 1).to_s)} skill_data.each_with_index{|skill, index| draw_icon(skill.icon_index, (contents.width / 2) + 20, line_height * (3 + index)) draw_text((contents.width / 2) + 50 , line_height * (3 + index), (contents.width / 2) - 50, line_height, skill.name)} end end #============================================================================== # ■ Window_Actor_Convert_PoPCommand_Window #============================================================================== class Window_Actor_Convert_PoPCommand_Window< Window_Command attr_accessor :pop_window attr_accessor :info_window attr_accessor :actor #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, width, height) @window_width = width @window_height = height @max_page = 0 @page_index = 0 @last_index = 0 @skill_data = [] @include_data = [] @actor = nil super(x,y) end #-------------------------------------------------------------------------- # ● スキルデータの設定 #-------------------------------------------------------------------------- def skill_data=(data) return if @skill_data == data ; @skill_data = data ; refresh end #-------------------------------------------------------------------------- # ● 継承スキルデータの設定 #-------------------------------------------------------------------------- def incude_data=(data) return if @include_data == data ; @include_data = data end #-------------------------------------------------------------------------- # ● ウィンドウ幅と高さ、項目の高さの取得 #-------------------------------------------------------------------------- def window_width ; @window_width ; end def window_height ; @window_height ; end #-------------------------------------------------------------------------- # ● カーソルを 1 ページ後ろに移動 #-------------------------------------------------------------------------- def cursor_pagedown @page_index += 1 refresh cursor_fix end #-------------------------------------------------------------------------- # ● カーソルを 1 ページ前に移動 #-------------------------------------------------------------------------- def cursor_pageup @page_index -= 1 refresh cursor_fix end #-------------------------------------------------------------------------- # ● カーソル位置修正 #-------------------------------------------------------------------------- def cursor_fix @index = [@index,@last_index].min update_cursor call_update_help end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list return unless @skill_data data = @skill_data.collect{|skill_id| $data_skills[skill_id]} @max_page = data.size.divmod(9)[0] - 1 @max_page += 1 if data.size.divmod(9)[1] != 0 @max_page += 1 if data.size == 0 @page_index = 0 if @page_index > @max_page @page_index = @max_page if @page_index < 0 first = @page_index * 9 last = [((@page_index + 1 ) * 9) - 1, data.size - 1].min @last_index = last - first + 1 data = data[first..last] data.each{|skill| add_command(skill.name, :ok, true, skill) if include?(skill)} add_command("確定", :ok, true, nil) end #-------------------------------------------------------------------------- # ● コマンドの追加判定 #-------------------------------------------------------------------------- def include?(skill) return false if skill.not_succeed_skill? return true unless @actor return true if @actor.succeed_adopt_id.include?(skill.succeed_limit_id) return false end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) change_color(normal_color) change_color(power_up_color) if @include_data.include?(@list[index][:ext]) rect = item_rect_for_text(index) draw_icon(@list[index][:ext].icon_index, rect.x, rect.y) if @list[index][:ext] rect.x += 26 draw_text(rect , command_name(index), alignment) end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_guide last_size = contents.font.size contents.font.size = 20 change_color(normal_color) draw_text(0, contents.height - line_height, contents.width, line_height, "LR:切替 " + "(" + (@page_index + 1).to_s + "/" + (@max_page + 1).to_s + ")", 1) contents.font.size = last_size end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh super draw_guide end end