#============================================================================== # ■転職画面セカンド for RGSS3 Ver1.02-β # □作成者 kure # # 呼び出し方法  SceneManager.call(Scene_ChangeClass) #============================================================================== $kure_integrate_script = {} if $kure_integrate_script == nil $kure_integrate_script[:ChangeClass] = 1 p "転職画面セカンド" module KURE module ChangeClass #初期設定(変更しない事)----------------------------------------------------- CLASS_LIST = [] ; MULTI_CLASS = [] ; STATUS_VALUATION = [] #動作に関する設定項目------------------------------------------------------- #対象外名称(指定の名前のアクターは転職画面に登録しません) NO_REGIST_NAME = "" #転職時のレベル維持(0=OFF 1=ON) KEEP_LEVEL = 1 #転職時のスキル維持 # 0 = 転職時に職業のスキルを忘れる # 1 = スキルを維持する KEEP_SKILL = 0 #表示に関する設定----------------------------------------------------------- #マルチクラスの設定 #MULTI_CLASS[マルチクラスID] = ["表示名", 表示スイッチID] #常時表示する場合はスイッチIDは0を設定 MULTI_CLASS[0] = ["サブクラス", 0] #未開放職業名 UN_KNOWN_CLASS_NAME = "?????" #転職させる職業設定--------------------------------------------------------- #グレードの1画面表示数 GRADE_NUM = 4 #CLASS_LIST[グレード] = ["表示名",選択開放スイッチ,ID配列] #常時許可を行う場合は選択開放スイッチは0を設定 CLASS_LIST[0] = ["基本職", 0, [1,2,3,4,5]] CLASS_LIST[1] = ["上級職", 0, [6,7,8,9,10]] #職業説明画面に関する設定項目---------------------------------------------- #■がついた項目は項目数を同じにしてください #評価設定するレベル(指定Lvの時のステータスで以下を評価する) VALUATION_LEVEL = 1 #評価方法([評価1,評価2,評価3,評価4,評価5,評価外]) VALUATION = ["S","A","B","C","D","E"] #■MAXHP([評価1,評価2,評価3,評価4,評価5]) STATUS_VALUATION[0] = [600,500,400,300,200] #■MAXMP([評価1,評価2,評価3,評価4,評価5]) STATUS_VALUATION[1] = [150,125,100,75,50] #■攻撃力([評価1,評価2,評価3,評価4,評価5]) STATUS_VALUATION[2] = [23,20,17,14,11] #■防御力([評価1,評価2,評価3,評価4,評価5]) STATUS_VALUATION[3] = [23,20,17,14,11] #■魔法力([評価1,評価2,評価3,評価4,評価5]) STATUS_VALUATION[4] = [23,20,17,14,11] #■魔法防御([評価1,評価2,評価3,評価4,評価5]) STATUS_VALUATION[5] = [23,20,17,14,11] #■敏捷性([評価1,評価2,評価3,評価4,評価5]) STATUS_VALUATION[6] = [35,30,25,20,15] #■運([評価1,評価2,評価3,評価4,評価5]) STATUS_VALUATION[7] = [35,30,25,20,15] 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 #-------------------------------------------------------------------------- # ★ メモ欄取得操作の定義(11式ID配列出力を返す)(追加定義) #-------------------------------------------------------------------------- def self.memo_11_21_id_command(cheak_note, word) result = Array.new while cheak_note do cheak_note.match(/<#{word}\s?(\d+)\s?,\s?([-]?\d+)\s?>/) result.push([$1.to_i, $2.to_i]) if $1 && $2 cheak_note = $' end return result end end #============================================================================== # ●■ RPG::BaseItem(追加定義集積) #============================================================================== class RPG::BaseItem #-------------------------------------------------------------------------- # ● 転職画面表示の定義(追加定義) 第1項目:表示 第2項目:許可 #-------------------------------------------------------------------------- def regist_setting @note.match(/<転職画面登録\s?(\d+)\s?,\s?(\d+)\s?>/) return ($1 && $2) ? [$1.to_i, $2.to_i] : nil end #-------------------------------------------------------------------------- # ● 要求レベル(追加定義) #-------------------------------------------------------------------------- def need_level KURE.memo_11_21_id_command(@note, "要求レベル") end #-------------------------------------------------------------------------- # ● 選択経験レベル(追加定義) #-------------------------------------------------------------------------- def need_select_level KURE.memo_11_21_id_command(@note, "選択要求レベル") end #-------------------------------------------------------------------------- # ● 要求未経験(追加定義) #-------------------------------------------------------------------------- def not_same_exp_class KURE.arr_num_slice(@note.scan(/<要求未経験\s?(\d+(?:\s?*,\s?*\d+)*)>/)) end #-------------------------------------------------------------------------- # ● 両立不可(追加定義) #-------------------------------------------------------------------------- def not_same_class KURE.arr_num_slice(@note.scan(/<両立不可\s?(\d+(?:\s?*,\s?*\d+)*)>/)) end #-------------------------------------------------------------------------- # ● 転職スイッチ(追加定義) #-------------------------------------------------------------------------- def key_switch KURE.arr_num_slice(@note.scan(/<転職スイッチ\s?(\d+(?:\s?*,\s?*\d+)*)>/)) end #-------------------------------------------------------------------------- # ● 転職スキル(追加定義) #-------------------------------------------------------------------------- def key_skill KURE.arr_num_slice(@note.scan(/<転職スキル\s?(\d+(?:\s?*,\s?*\d+)*)>/)) end #-------------------------------------------------------------------------- # ● 転職アイテム(追加定義) #-------------------------------------------------------------------------- def need_item KURE.memo_11_21_id_command(@note, "転職アイテム") end #-------------------------------------------------------------------------- # ● 転職不可時の表示(追加定義) #-------------------------------------------------------------------------- def change_false_mode @note.match(/<転職不可表示\s?(\d+)\s?>/) return $1 ? $1.to_i : 0 end #-------------------------------------------------------------------------- # ● マルチクラス封印(追加定義) #-------------------------------------------------------------------------- def seal_multi_class KURE.arr_num_slice(@note.scan(/<マルチクラス封印\s?(\d+(?:\s?*,\s?*\d+)*)>/)) end end #============================================================================== # ■ Game_Actor #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ★ 経験値リストの呼び出し(追加定義) #-------------------------------------------------------------------------- def exp_list @exp.to_a end #-------------------------------------------------------------------------- # ★ 指定IDの職業の経験値の取得 #-------------------------------------------------------------------------- def adv_exp(id) @exp[id] end #-------------------------------------------------------------------------- # ◎ 職業の変更(エイリアス再定義) #-------------------------------------------------------------------------- alias k_before_change_class2_change_class change_class unless $! def change_class(class_id, keep_exp = false) forget_class_skill(@class_id) if KURE::ChangeClass::KEEP_SKILL == 0 k_before_change_class2_change_class(class_id, keep_exp) learn_class_skill(@class_id) if KURE::ChangeClass::KEEP_SKILL == 0 end #-------------------------------------------------------------------------- # ★ 指定IDの職業のスキルを忘れる #-------------------------------------------------------------------------- def forget_class_skill(id) $data_classes[id].learnings.each{|learning| forget_skill(learning.skill_id)} end #-------------------------------------------------------------------------- # ★ 指定IDの職業のスキルを覚える #-------------------------------------------------------------------------- def learn_class_skill(id) $data_classes[id].learnings.each{|learning| learn_skill(learning.skill_id) if learning.level <= @level } end end #============================================================================== # ■ Scene_ChangeClass #============================================================================== class Scene_ChangeClass < Scene_MenuBase #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super create_help_window create_command_window create_main_window create_popup_window create_grade_window set_window_task end #-------------------------------------------------------------------------- # ● ヘルプウィンドウの作成 #-------------------------------------------------------------------------- def create_help_window @help_window = Window_Help.new(1) @help_window.set_text("転職させるアクターを選択してください。") end #-------------------------------------------------------------------------- # ● コマンドウィンドウの作成 #-------------------------------------------------------------------------- def create_command_window y = @help_window.height wh = Graphics.height - y @main_command = Window_k_ChangeClass_Main_Command.new(0, y, wh) #呼び出しのハンドラをセット @main_command.set_handler(:ok,method(:main_ok)) @main_command.set_handler(:cancel,method(:main_cancel)) @main_command.activate end #-------------------------------------------------------------------------- # ● メインウィンドウの作成 #-------------------------------------------------------------------------- def create_main_window x = @main_command.width y = @help_window.height ww = Graphics.width - x wh = Graphics.height - y @main_window = Window_k_ChangeClass_Main_Window.new(x, y, ww, wh) end #-------------------------------------------------------------------------- # ● ポップアップウィンドウの作成 #-------------------------------------------------------------------------- def create_popup_window x = 180 ; y = 100 @pop_up_window = Window_k_ChangeClass_Popup_Command.new(x, y) @pop_up_window.back_opacity = 255 @pop_up_window.z += 100 #呼び出しのハンドラをセット @pop_up_window.set_handler(:ok,method(:pop_ok)) @pop_up_window.set_handler(:cancel,method(:pop_cancel)) @pop_up_window.unselect @pop_up_window.hide end #-------------------------------------------------------------------------- # ● グレードウィンドウの作成 #-------------------------------------------------------------------------- def create_grade_window x = 0 ; y = @help_window.height @grade_window = Window_k_ChangeClass_Grade_Command.new(x, y) #呼び出しのハンドラをセット @grade_window.set_handler(:ok,method(:grade_ok)) @grade_window.set_handler(:cancel,method(:grade_cancel)) @grade_window.deactivate @grade_window.unselect @grade_window.hide end #-------------------------------------------------------------------------- # ● ウィンドウのセッティング処理 #-------------------------------------------------------------------------- def set_window_task @main_command.main_window = @main_window @main_command.pop_up_window = @pop_up_window @main_window.main_command = @main_command @grade_window.main_window = @main_window @grade_window.main_command = @main_command set_process(0) @main_command.select(0) end #-------------------------------------------------------------------------- # ● メインコマンド[OK] #-------------------------------------------------------------------------- def main_ok if @process == 0 @keep_index = @main_command.index pop_open end if @process != 0 change_class grade_cancel @main_command.select(@keep_index) end end #-------------------------------------------------------------------------- # ● メインコマンド[キャンセル] #-------------------------------------------------------------------------- def main_cancel return_scene if @process == 0 if @process != 0 @main_command.unselect @grade_window.activate @main_window.class_data = nil end end #-------------------------------------------------------------------------- # ● ポップアップ[OK] #-------------------------------------------------------------------------- def pop_ok id = @pop_up_window.current_ext pop_cancel if id == 0 if id != 0 resize(0) set_process(id) pop_close @main_command.unselect @grade_window.activate @grade_window.select(0) @main_window.refresh #ヘルプのテキストを更新 actor_name = @main_command.actor.name + "の " if id == 1 @help_window.set_text(actor_name + "新しい職業を選択してください。") else name = KURE::ChangeClass::MULTI_CLASS[id - 2][0] @help_window.set_text(actor_name + "新しい" + name + "を選択してください。") end end end #-------------------------------------------------------------------------- # ● ポップアップ[キャンセル] #-------------------------------------------------------------------------- def pop_cancel set_process(0) pop_close @main_command.activate #ヘルプのテキストを更新 @help_window.set_text("転職させるアクターを選択してください。") end #-------------------------------------------------------------------------- # ● グレード[OK] #-------------------------------------------------------------------------- def grade_ok @grade_window.deactivate @main_command.select(0) @main_command.activate end #-------------------------------------------------------------------------- # ● グレード[キャンセル] #-------------------------------------------------------------------------- def grade_cancel resize(1) set_process(0) @main_command.select(0) @main_command.activate #ヘルプのテキストを更新 @help_window.set_text("転職させるアクターを選択してください。") end #-------------------------------------------------------------------------- # ● プロセスのセット #-------------------------------------------------------------------------- def set_process(value) @process = value @main_command.process = value @main_window.process = value @main_window.class_data = nil if value == 0 end #-------------------------------------------------------------------------- # ● ポップアップの表示 #-------------------------------------------------------------------------- def pop_open @pop_up_window.show @pop_up_window.activate @pop_up_window.select(0) @main_command.deactivate end #-------------------------------------------------------------------------- # ● ポップアップのクローズ #-------------------------------------------------------------------------- def pop_close @pop_up_window.hide @pop_up_window.deactivate end #-------------------------------------------------------------------------- # ● リサイズ(0=グレードを表示 1=グレードを非表示) #-------------------------------------------------------------------------- def resize(mode) case mode when 0 plus_y = @grade_window.height @main_command.y += plus_y ; @main_command.height -= plus_y @main_window.y += plus_y ; @main_window.height -= plus_y @main_window.create_contents @grade_window.show ; @grade_window.select(0) when 1 plus_y = @grade_window.height @main_command.y -= plus_y ; @main_command.height += plus_y @main_window.y -= plus_y ; @main_window.height += plus_y @main_window.create_contents @grade_window.hide ; @grade_window.unselect end end #-------------------------------------------------------------------------- # ● 転職処理 #-------------------------------------------------------------------------- def change_class actor = @main_command.actor new_class_id = @main_command.current_ext ? @main_command.current_ext.id : 0 #転職アイテムの消費 unless actor.adv_exp(new_class_id) $data_classes[new_class_id].need_item.each{|block| $game_party.lose_item($data_items[block[0]], block[1])} end #転職処理(基本処理) if @process == 1 case KURE::ChangeClass::KEEP_LEVEL when 0 ; actor.change_class(new_class_id,false) when 1 ; actor.change_class(new_class_id,true) end end #転職処理(マルチクラスへの対応) if @process != 1 && $kure_integrate_script[:multiclass] id = @process - 2 case KURE::ChangeClass::KEEP_LEVEL when 0 ; actor.change_adv_class(id, new_class_id, false) when 1 ; actor.change_adv_class(id, new_class_id, true) end end end end #============================================================================== # ■ Window_k_ChangeClass_Main_Command #============================================================================== class Window_k_ChangeClass_Main_Command < Window_Command attr_accessor :main_window attr_accessor :pop_up_window attr_accessor :actor #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, height) @height = height @process = 0 @grade_index = 0 @actor = nil super(x,y) end #-------------------------------------------------------------------------- # ◎ プロセスの設定 #-------------------------------------------------------------------------- def process=(value) return if @process == value @process = value ; refresh end #-------------------------------------------------------------------------- # ◎ グレードの設定 #-------------------------------------------------------------------------- def grade_index=(value) return if @grade_index == value @grade_index = value ; refresh end #-------------------------------------------------------------------------- # ● カーソル位置の設定 #-------------------------------------------------------------------------- def index=(index) @index = index update_cursor call_update_help return if index < 0 if @process == 0 @main_window.actor = current_ext if @main_window @pop_up_window = current_ext if @pop_up_window @actor = current_ext else @main_window.class_data = current_ext if @main_window end end #-------------------------------------------------------------------------- # ● ウィンドウ幅と高さの取得 #-------------------------------------------------------------------------- def window_width ;return 160 ;end def window_height ;return @height ;end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list if @process == 0 $data_actors.each{|actor| add_actor = add_actor?(actor) next unless add_actor add_command(add_actor.name, :ok, edit_actor?(actor) ,add_actor) } end if @process != 0 KURE::ChangeClass::CLASS_LIST[@grade_index][2].each{|id| add_class = $data_classes[id] if edit_class?(add_class) add_command(add_class.name, :ok, true ,add_class) else case add_class.change_false_mode when 0 ; add_command(add_class.name, :ok, false ,add_class) when 2 ; add_command(KURE::ChangeClass::UN_KNOWN_CLASS_NAME, :ok, false ,nil) end end } add_command("職業をやめる", :ok, true , nil) if @process != 1 end end #-------------------------------------------------------------------------- # ◎ 画面に登録するアクターか判定 #-------------------------------------------------------------------------- def add_actor?(actor) return nil unless actor return unless actor.regist_setting return if actor.regist_setting[0] != 0 && !$game_switches[actor.regist_setting[0]] cheak_actor = $game_actors[actor.id] return nil if KURE::ChangeClass::NO_REGIST_NAME == cheak_actor.name return cheak_actor end #-------------------------------------------------------------------------- # ◎ 転職可能な職業か判定 #-------------------------------------------------------------------------- def edit_actor?(actor) return false if actor.regist_setting[1] != 0 && !$game_switches[actor.regist_setting[0]] return true end #-------------------------------------------------------------------------- # ◎ 転職可能な職業か判定 #-------------------------------------------------------------------------- def edit_class?(add_class) #要求レベル判定 add_class.need_level.each{|block| next if block[0] == 0 && @actor.level >= block[1] return false if block[0] == 0 && @actor.level < block[1] return false unless @actor.adv_exp(block[0]) return false if @actor.adv_exp(block[0]) < $data_classes[block[0]].exp_for_level(block[1]) } #選択要求レベル flag = add_class.need_select_level == [] ? true : nil add_class.need_select_level.each{|block| next unless @actor.adv_exp(block[0]) next if @actor.adv_exp(block[0]) < $data_classes[block[0]].exp_for_level(block[1]) flag = true } return false unless flag #要求未経験 add_class.not_same_exp_class.each{|id| next unless @actor.adv_exp(id) return false if @actor.adv_exp(id) > 0 } #両立不可 if @process != 1 && $kure_integrate_script[:multiclass] cheak_arr = @actor.adv_class_id.compact.collect{|obj| obj[0]} add_class.not_same_class.each{|id| return false if cheak_arr.include?(id)} end #転職要求スイッチ add_class.key_switch.each{|id| return false unless $game_switches[id]} #転職要求スキル add_class.key_skill.each{|id| return false unless @actor.skill_learn?($data_skills[id])} #転職アイテム add_class.need_item.each{|block| return false if $game_party.item_number($data_items[block[0]]) < block[1] } return true end end #============================================================================== # ■ Window_k_ChangeClass_Grade_Command #============================================================================== class Window_k_ChangeClass_Grade_Command < Window_HorzCommand attr_accessor :main_window attr_accessor :main_command #-------------------------------------------------------------------------- # ● ウィンドウ幅と桁数の取得 #-------------------------------------------------------------------------- def window_width ; Graphics.width ; end def col_max ; return KURE::ChangeClass::GRADE_NUM ;end #-------------------------------------------------------------------------- # ● カーソルを下に移動 #-------------------------------------------------------------------------- def cursor_down(wrap = false) @main_window.draw_index += 1 if @main_window end #-------------------------------------------------------------------------- # ● カーソルを上に移動 #-------------------------------------------------------------------------- def cursor_up(wrap = false) @main_window.draw_index -= 1 if @main_window end #-------------------------------------------------------------------------- # ● カーソル位置の設定 #-------------------------------------------------------------------------- def index=(index) @index = index update_cursor call_update_help return if index < 0 @main_window.grade_index = current_ext if @main_window @main_command.grade_index = current_ext if @main_command end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list KURE::ChangeClass::CLASS_LIST.each_with_index{|block, index| add_command(block[0], :ok , add_grade?(index), index)} end #-------------------------------------------------------------------------- # ● 条件開放チェック #-------------------------------------------------------------------------- def add_grade?(index) id = KURE::ChangeClass::CLASS_LIST[index][1] return false if id != 0 && !$game_switches[id] return true end end #============================================================================== # ■ Window_k_ChangeClass_Popup_Command #============================================================================== class Window_k_ChangeClass_Popup_Command < Window_Command attr_accessor :actor #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y) @actor = nil super(x,y) end #-------------------------------------------------------------------------- # ◎ アクターの設定 #-------------------------------------------------------------------------- def actor=(actor) return if @actor == actor @actor = actor ; refresh end #-------------------------------------------------------------------------- # ● ウィンドウ幅と高さの取得 #-------------------------------------------------------------------------- def window_width ;return 160 ;end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list add_command("職業を変更する", :ok, true , 1) #マルチクラス用設定 if $kure_integrate_script[:multiclass] KURE::ChangeClass::MULTI_CLASS.each_with_index{|block, index| #マルチクラスの設定が存在しなければ追加しない next unless KURE::MultiClass::CLASS_SETTING[index] next if block[1] != 0 && !$game_switches[block[1]] add_command(block[0], :ok, true , index + 2) } end add_command("キャンセル", :ok, true , 0) end end #============================================================================== # ■ Window_k_ChangeClass_Main_Window #============================================================================== class Window_k_ChangeClass_Main_Window < Window_Selectable attr_accessor :draw_index attr_accessor :main_command #-------------------------------------------------------------------------- # ◎ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, width, height) @process = 0 @grade_index = 0 @actor = nil @class_data = nil @draw_index = 0 @max_page = 0 super(x, y, width ,height) end #-------------------------------------------------------------------------- # ◎ プロセスの設定 #-------------------------------------------------------------------------- def process=(value) return if @process == value @process = value ; refresh end #-------------------------------------------------------------------------- # ◎ アクターの設定 #-------------------------------------------------------------------------- def actor=(value) return if @actor == value @actor = value ; refresh end #-------------------------------------------------------------------------- # ◎ クラスデータの設定 #-------------------------------------------------------------------------- def class_data=(value) return if @class_data == value @class_data = value ; refresh end #-------------------------------------------------------------------------- # ◎ グレードの設定 #-------------------------------------------------------------------------- def grade_index=(value) return if @grade_index == value @grade_index = value ; refresh end #-------------------------------------------------------------------------- # ◎ グレードの描画INDEX設定 #-------------------------------------------------------------------------- def draw_index=(value) return if @draw_index == value @draw_index = value @draw_index = 0 if @draw_index > @max_page @draw_index = @max_page if @draw_index < 0 refresh end #-------------------------------------------------------------------------- # ◎ リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear return unless @actor draw_process_zero(0, 0) if @process == 0 draw_process_actor(0, 0) if @process != 0 && !@class_data && @main_command && main_command.index < 0 draw_process_class(0, 0) if @process != 0 && @class_data end #-------------------------------------------------------------------------- # ◎ プロセス0の時の描画 #-------------------------------------------------------------------------- def draw_process_zero(x, y) #基本情報描画 draw_base_status(x, y) draw_gauge(x, y + line_height * 4, contents.width, 1, mp_gauge_color2,crisis_color) draw_text(x, y + line_height * 4, 300, line_height,"現在の職業") #職業情報描画 draw_job_info(x , y + line_height * 5) end #-------------------------------------------------------------------------- # ◎ 基本情報の描画(共通描画) #-------------------------------------------------------------------------- def draw_base_status(x, y) draw_actor_face(@actor, x, y + 0) draw_actor_name(@actor, x + 99, y + 0) draw_actor_nickname(@actor, x + 231, y + 0) draw_actor_class(@actor, x + 99, y + line_height * 1) draw_actor_hp(@actor, x + 231, y + line_height * 1) draw_actor_level(@actor, x + 99, y + line_height * 2) draw_actor_mp(@actor, x + 231, y + line_height * 2) draw_actor_icons(@actor, x + 99, line_height * 3) end #-------------------------------------------------------------------------- # ■ 職業情報の描画 #-------------------------------------------------------------------------- def draw_job_info(x,y) class_list = [] if $kure_integrate_script[:multiclass] && KURE::MultiClass::VIEW_BASE_CLASS_NAME == 1 class_list = [@actor.class_id] end if $kure_integrate_script[:multiclass] list = @actor.adv_class_id.collect{|block| block[0] if block} class_list += (list - KURE::MultiClass::NO_VIEW_ADVCLASS) end class_list.compact! class_list.each_with_index{|id, index| pos_y = y + (line_height * 2) * index class_name = $data_classes[id].name class_level = 1 while $data_classes[id].exp_for_level(class_level) <= @actor.adv_exp(id) do class_level += 1 break if class_level > 99 end class_level -= 1 draw_text(x, pos_y, 300, contents.font.size, class_name + " Lv " + class_level.to_s) need = $data_classes[id].exp_for_level(class_level + 1) - $data_classes[id].exp_for_level(class_level) now = @actor.adv_exp(id) - $data_classes[id].exp_for_level(class_level) rate = need != 0 ? now.to_f / need : 0 pos_y += line_height draw_gauge(x + 20, pos_y, 170, rate, tp_gauge_color1, tp_gauge_color2) change_color(system_color) draw_text(x + 20, pos_y, 30, line_height, "EXP") draw_current_and_max_values(x + 20, pos_y, 170, now, need, mp_color(@actor), normal_color) draw_text(x + 230, pos_y, 40, line_height, "Next") change_color(normal_color) draw_text(x + 240, pos_y, contents.width - (x + 250), line_height, (need - now).to_s, 2) } end #-------------------------------------------------------------------------- # ◎ アクターの職業履歴描画 #-------------------------------------------------------------------------- def draw_process_actor(x, y) name = KURE::ChangeClass::CLASS_LIST[@grade_index][0] draw_gauge(x, y, contents.width, 1, mp_gauge_color2,crisis_color) draw_text(x, y, 300, line_height, name + "の職業履歴") list = KURE::ChangeClass::CLASS_LIST[@grade_index][2] @max_page = list.size.div(20) @max_page -= 1 if list != [] && list.size.modulo(20) == 0 first = 0 + 20 * @draw_index last = [19 + 20 * @draw_index, list.size].min list[first..last].each_with_index{|id, index| pos_x = x + (contents.width / 2) * index.modulo(2) pos_y = y + contents.font.size * (1 + index.div(2)) class_name = $data_classes[id].name class_level = 1 if @actor.adv_exp(id) while $data_classes[id].exp_for_level(class_level) <= @actor.adv_exp(id) do class_level += 1 break if class_level > 99 end class_level -= 1 else class_level = "-" end if $kure_integrate_script[:multiclass] list2 = @actor.adv_class_id.collect{|block| block[0] if block} change_color(power_up_color) if id == @actor.class_id or list2.include?(id) else change_color(power_up_color) if id == @actor.class_id end draw_text(pos_x, pos_y, contents.width / 2 - 15, contents.font.size, class_name) draw_text(pos_x, pos_y, contents.width / 2 - 15, contents.font.size, "Lv " + class_level.to_s, 2) change_color(normal_color) } draw_text(0, contents.height - line_height, contents.width, line_height, "↑ ↓:表示切り替え( " + (@draw_index + 1).to_s + " / " + (@max_page + 1).to_s + ")",1) end #-------------------------------------------------------------------------- # ◎ 職業描画プロセスの時の描画 #-------------------------------------------------------------------------- def draw_process_class(x, y) draw_gauge(x, y, contents.width, 1, mp_gauge_color2,crisis_color) draw_text(x, y, 300, line_height, "能力値情報") #能力値の評価を描画 8.times{|i| pos_x = x + (contents.width / 2) * i.modulo(2) pos_y = y + line_height * (1 + i.div(2)) change_color(system_color) draw_text(pos_x, pos_y, 120, line_height, Vocab::param(i)) change_color(normal_color) text = KURE::ChangeClass::VALUATION[5] KURE::ChangeClass::STATUS_VALUATION[i].each_with_index{|value, index| if @class_data.params[i, KURE::ChangeClass::VALUATION_LEVEL] > value text = KURE::ChangeClass::VALUATION[index] break end } draw_text(pos_x, pos_y, (contents.width / 2) - 10, line_height, text, 2) } draw_gauge(x, y + line_height * 5, contents.width, 1, mp_gauge_color2,crisis_color) draw_text(x, y + line_height * 5, 300, line_height, "転職条件") draw_class_change_info(x, y + line_height * 6, @class_data) draw_gauge(x, y + line_height * 9, contents.width, 1, mp_gauge_color2,crisis_color) draw_text(x, y + line_height * 9, 300, line_height, "職業説明") draw_clase_explan(x, y + line_height * 10, @class_data) end #-------------------------------------------------------------------------- # ■ 職業情報の描画 #-------------------------------------------------------------------------- def draw_class_change_info(x, y, class_data) result = [] #要求レベル class_data.need_level.each{|block| class_name = block[0] == 0 ? "要" : "要" + $data_classes[block[0]].name result.push(class_name + " Lv" + block[1].to_s + "以上")} #選択要求レベル class_data.need_select_level.each{|block| class_name = block[0] == 0 ? "選" : "選" + $data_classes[block[0]].name result.push(class_name + " Lv" + block[1].to_s + "以上")} #要求未経験 class_data.not_same_exp_class.each{|id| result.push($data_classes[id].name + " 未経験")} #両立不可 class_data.not_same_class.each{|id| result.push($data_classes[id].name + " 両立不可")} #要求スキル class_data.key_skill.each{|id| result.push($data_skills[id].name + "習得")} #転職アイテム class_data.need_item.each{|block| result.push($data_items[block[0]].name + " " + block[1].to_s + "個" ) } result.each_with_index{|text, index| pos_x = x + (contents.width / 2) * index.modulo(2) pos_y = y + line_height * index.div(2) draw_text(pos_x, pos_y, (contents.width / 2), line_height, text) } draw_text(x + 20, y, contents.width, line_height, "特に無し") if result == [] end #-------------------------------------------------------------------------- # ★ 職業説明の描画 #-------------------------------------------------------------------------- def draw_clase_explan(x, y, class_data) #職業のメモ欄を取得 note = class_data.note str_s = note.index("<職業説明>") ; str_e = note.index("") return if str_s == nil or str_e == nil explan = note.slice(str_s + 6..str_e - 1) explan = explan.gsub(/(\r\n|\r|\n|\f)/,"").split(",") explan.each_with_index{|text, index| draw_text_ex_no_reset(x, y + contents.font.size * index, text)} end #-------------------------------------------------------------------------- # ▲ 拡張テキスト(3ページ目、INDEX1) #-------------------------------------------------------------------------- def draw_text_ex_no_reset(x, y, text) text = convert_escape_characters(text) pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)} process_character(text.slice!(0, 1), text, pos) until text.empty? end end