#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>># # # # V's Promotion System 2: # # Job Tree System # # Version 0.3 # # # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Written By: V # # Last Edited: November 13, 2013 # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # # #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>># #==============================================================================# #------------------------------------------------------------------------------# # ** Disclaimer # #------------------------------------------------------------------------------# # # # This script was commissioned by Saber995 it is intended for Non-commercial # # use only, if you wish to use this script in a commercial game please PM me # # at which ever site you found this script. Either way please give me credit # # in your game script as the writer of this script, and send me a PM about # # the release of the game/demo. # # # #------------------------------------------------------------------------------# # ** How To Use # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # # # * All class must have at least one of each of the following tags: # # # # # # (For Multiple Class Requirements Repeat The Tag) # # # # # # # # # # # # * An optional tag used to change the actors face image. # # # # # # # # * All class must also have a disription below. # # # # * All enemies must have the following tag: # # # # # # # # # # * To add/remove JP use one the following script calls: # # # # $game_party.gain_jp(ammount) # # (All party members will recieve the same ammount.) # # # # $game_party.lose_jp(ammount) # # (All party members will lose the same ammount.) # # # # $game_party.members[index].add_jp(ammount) # # (Only the individual will recieve the same ammount.) # # # # $game_party.members[index].remove_jp(ammount) # # (Only the individual will lose the same ammount.) # # # # $game_party.members[index].current_jp # # (Returns the individuals current jp.) # # # # * An Actor notetag used to prevent the graphics from changing: # # # #
# # # #------------------------------------------------------------------------------# # ** Description # #------------------------------------------------------------------------------# # # # v0.1 # # ~=~=~=~ # # # # This system is loosely based on FFT job system. Once your class reaches a set# # level you can buy a new class with JP or Job Points. JP can be given or # # won in combat. # # # # v0.2 # # ~=~=~=~ # # # # I added a few optional tags for the faces and main party members, I've also # # added an option to dislplay numbers instead of stars for the level. # # # # v0.3 # # ~=~=~=~ # # # # I added an optional to show all of the party member's classes in the current # # class listing and highlight only the class that are known # # # #------------------------------------------------------------------------------# #==============================================================================# #============================================================================== # ** V's Promotion System 2 #------------------------------------------------------------------------------ # This module manages customizable features and methods. #============================================================================== module V_PS2 module Specs #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>># # # # Start Customizable Area. # # # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # # # ONLY EDIT AFTER THE EQUALS SYMBOL. # # # #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>># #============================================================================= # * Show The Parties Unlocked Classes #============================================================================= Show_Party_Unlocked = true #============================================================================= # * Level Display #============================================================================= Use_Numbers = true Level_Icon = 125 #============================================================================= # * JP Info #============================================================================= Max_JP = 100 JP_Vocab = "JP" #============================================================================= # * Class Descriptions #============================================================================= Class_Descriptions = { #<---- Do Not Remove. 1 => [ #<---- Class ID. "Just for the cause... The militant backbone.", "The soldier can hit just as hard as he can take", "a hit. " ], #<---- End of Discription. 2 => [ #<---- Class ID. "Gential and Calm... The monk finds his center in", "order to achive nervana. " ], #<---- End of Discription. 3 => [ #<---- Class ID. "At peace with God... The paladin is blessed in", "combat while fight for his beliefs. The undead", "flee in fear of his wrath." ], #<---- End of Discription. 4 => [ #<---- Class ID. "Cursed and Demented... The spellblade can", "enchant his blade with mystic powers and", "surround itself in a dark mist." ], #<---- End of Discription. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>># # # # End Customizable Area. # # # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # # # DO NOT EDIT PAST THIS POINT UNLESS YOU KNOW WHAT YOUR DOING. # # # #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>># } end end #<--- End Module=========================================================== #============================================================================== # ** Window_Base #------------------------------------------------------------------------------ # This is a super class of all windows within the game. #============================================================================== class Window_Promotion_Status < Window_Base #-------------------------------------------------------------------------- # * Includes Module's Variables With Class #-------------------------------------------------------------------------- include V_PS2::Specs #-------------------------------------------------------------------------- # * Initialize Proccessing #-------------------------------------------------------------------------- def initialize(x, y, w, h) super(x, y, w, h) @height = h @width = w @actor = $game_party.menu_actor refresh(0, 1) unless @actor.current_classes.size > 0 refresh(0, 0) if @actor.current_classes.size > 0 end #-------------------------------------------------------------------------- # * Refresh Proccessing #-------------------------------------------------------------------------- def refresh(class_id = 0, catagory = 0) contents.clear case catagory when 0 if @actor.current_classes.size > 0 id = @actor.current_classes[class_id] draw_current_contents(id) end when 1 if @actor.available_classes.size > 0 id = @actor.available_classes[class_id] draw_available_contents(id) end end end #-------------------------------------------------------------------------- # * Draw Current Class Contents #-------------------------------------------------------------------------- def draw_current_contents(class_id) draw_class_level(class_id) draw_class_sprite(class_id) draw_params(class_id) draw_description(class_id) end #-------------------------------------------------------------------------- # * Draw Available Class Contents #-------------------------------------------------------------------------- def draw_available_contents(class_id) draw_class_cost(class_id) draw_class_sprite(class_id) draw_params(class_id) draw_description(class_id) end #-------------------------------------------------------------------------- # * Draw Class Cost #-------------------------------------------------------------------------- def draw_class_cost(class_id) cost = @actor.class_cost(class_id) draw_sizeable_text(3, -150, @width, @height, JP_Vocab + " Cost:", 0, 14) draw_sizeable_text(25, -135, @width, @height, cost, 0, 30) end #-------------------------------------------------------------------------- # * Draw Class Sprite #-------------------------------------------------------------------------- def draw_class_sprite(class_id) sprite = @actor.class_sprite(class_id) draw_zoomed_character(sprite[0], sprite[1].to_i, 40, 75, 2) end #-------------------------------------------------------------------------- # * Draw Class Level #-------------------------------------------------------------------------- def draw_class_level(class_id) level = @actor.class_level(class_id) if Use_Numbers == false draw_sizeable_text(3, -150, @width, @height, Vocab.level + ":", 0, 14) level.times { |i| draw_icon(Level_Icon, (10 + (i * 20)), 20) } else draw_sizeable_text(3, -150, @width, @height, "Level: ", 0, 14) draw_sizeable_text(25, -135, @width, @height, level, 0, 30) end end #-------------------------------------------------------------------------- # * Draw Class Parameters #-------------------------------------------------------------------------- def draw_params(class_id) param_names = [" HP", " MP", "STR", "DEF", "MAT", "MDF", "AGI", "LUK"] param_names.size.times { |i| draw_sizeable_text(165, (-110 + (i * 17)), @width, @height, param_names[i] + ":", 0, 16) } cur_params = class_params(@actor.class_id) cur_params.size.times { |i| draw_sizeable_text(205, (-110 + (i * 17)), @width, @height, cur_params[i], 0, 16) } spacer = " -> " 8.times { |i| draw_sizeable_text(240, (-110 + (i * 17)), @width, @height, spacer, 0, 16) } new_params = class_params(class_id) new_params.size.times { |i| draw_sizeable_text(285, (-110 + (i * 17)), @width, @height, new_params[i], 0, 16) } end #-------------------------------------------------------------------------- # * Draw Description #-------------------------------------------------------------------------- def draw_description(class_id) description = class_des(class_id) draw_sizeable_text(3, 40, @width, @height, "Description:", 0, 14) description.size.times { |i| draw_sizeable_text(5, 55 + (i * 20), @width, @height, description[i], 0, 16) } end #-------------------------------------------------------------------------- # * Draw Sizeable Text #-------------------------------------------------------------------------- def draw_sizeable_text(x, y, w, h, text, alignment, size) reset_font_settings contents.font.size = size contents.draw_text(x, y, w, h, text, alignment) reset_font_settings end #-------------------------------------------------------------------------- # * Returns Class Description #-------------------------------------------------------------------------- def class_des(class_id) return Class_Descriptions[class_id] end #-------------------------------------------------------------------------- # * Returns Class Parameters #-------------------------------------------------------------------------- def class_params(class_id) params = [] case when @actor.current_classes.include?(class_id) level = @actor.class_level(class_id) when @actor.current_classes.include?(class_id) == false level = 1 end 8.times { |i| params.push $data_classes[class_id].params[i, level] } return params end #-------------------------------------------------------------------------- # * Draw Zoomed Character #-------------------------------------------------------------------------- def draw_zoomed_character(character_name, character_index, x, y, zoom) return unless character_name bitmap = Cache.character(character_name) sign = character_name[/^[\!\$]./] if sign && sign.include?('$') cw = bitmap.width / 3 ch = bitmap.height / 4 else cw = bitmap.width / 12 ch = bitmap.height / 8 end n = character_index src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch) actor = Rect.new(x, y, cw * zoom, ch * zoom) contents.stretch_blt(actor, bitmap, src_rect) end end #<--- End Class============================================================ #============================================================================== # ** Window_Base #------------------------------------------------------------------------------ # This is a super class of all windows within the game. #============================================================================== class Window_Promotion_Info < Window_Base #-------------------------------------------------------------------------- # * Includes Module's Variables With Class #-------------------------------------------------------------------------- include V_PS2::Specs #-------------------------------------------------------------------------- # * Initialize Processing #-------------------------------------------------------------------------- def initialize(x, y, w, h) @width = w @height = h @actor = $game_party.menu_actor super(x, y, @width, @height) refresh end #-------------------------------------------------------------------------- # * Refresh Proccessing #-------------------------------------------------------------------------- def refresh contents.clear draw_current_info end #-------------------------------------------------------------------------- # * Draw Current Info #-------------------------------------------------------------------------- def draw_current_info draw_zoomed_character(@actor.character_name, @actor.character_index, @width / 2 - 15, 5, 1) draw_sizeable_text(2, 10, @width, @height, @actor.name, 1, 20) draw_current_class_name(@actor.class_id) draw_class_level(@actor.class_id) draw_current_jp end #-------------------------------------------------------------------------- # * Draw Current JP #-------------------------------------------------------------------------- def draw_current_jp draw_sizeable_text(-35, 15, @width, @height, ("Current " + JP_Vocab + ": " + @actor.current_jp.to_s), 2, 20) end #-------------------------------------------------------------------------- # * Draw Current Class Name #-------------------------------------------------------------------------- def draw_current_class_name(class_id) draw_sizeable_text(3, -40, @width, @height, "Current Class:", 0, 14) draw_sizeable_text(10, -25, @width, @height, $data_classes[@actor.class_id].name, 0, 20) end #-------------------------------------------------------------------------- # * Draw Class Level #-------------------------------------------------------------------------- def draw_class_level(class_id) level = @actor.class_level(class_id) if Use_Numbers == false draw_sizeable_text(3, -6, @width, @height, Vocab.level + ":", 0, 18) level.times { |i| draw_icon(Level_Icon, (10 + (i * 20)), 44) } else change_color(system_color) draw_sizeable_text(3, -6, @width, @height, Vocab::level_a, 0, 18) change_color(normal_color) draw_sizeable_text(35, -6, @width, @height, level, 0, 25) end end #-------------------------------------------------------------------------- # * Draw Sizeable Text #-------------------------------------------------------------------------- def draw_sizeable_text(x, y, w, h, text, alignment, size) reset_font_settings contents.font.size = size contents.draw_text(x, y, w, h, text, alignment) reset_font_settings end #-------------------------------------------------------------------------- # * Draw Zoomed Character #-------------------------------------------------------------------------- def draw_zoomed_character(character_name, character_index, x, y, zoom) return unless character_name bitmap = Cache.character(character_name) sign = character_name[/^[\!\$]./] if sign && sign.include?('$') cw = bitmap.width / 3 ch = bitmap.height / 4 else cw = bitmap.width / 12 ch = bitmap.height / 8 end n = character_index src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch) actor = Rect.new(x, y, cw * zoom, ch * zoom) contents.stretch_blt(actor, bitmap, src_rect) end end #<--- End Class============================================================ #============================================================================== # ** Window_Command #------------------------------------------------------------------------------ # This window deals with general command choices. #============================================================================== class Window_Current_Classes < Window_Command #-------------------------------------------------------------------------- # * Initialize Processing #-------------------------------------------------------------------------- def initialize(x, y) @catagory = 0 @active = false @y = y @actor = $game_party.menu_actor @actor.current_classes.size > 0 ? @catagory = 0 : @catagory = 1 super(x, y) end #-------------------------------------------------------------------------- # * Get Window Height #-------------------------------------------------------------------------- def window_height Graphics.height - @y end #-------------------------------------------------------------------------- # * Change Active Status #-------------------------------------------------------------------------- def win_active(status) @active = status end #-------------------------------------------------------------------------- # * Checks Active Status #-------------------------------------------------------------------------- def win_active? return @active end #-------------------------------------------------------------------------- # * Change Catagory #-------------------------------------------------------------------------- def change_catagory(index) @catagory = index refresh end #-------------------------------------------------------------------------- # * Returns Catagory #-------------------------------------------------------------------------- def catagory return @catagory end #-------------------------------------------------------------------------- # * Make Command List #-------------------------------------------------------------------------- def make_command_list if Show_Party_Unlocked == true case @catagory when 0 $game_party.party_classes.each_index { |i| p $game_party.party_classes[i] add_command($data_classes[$game_party.party_classes[i]].name, $data_classes[$game_party.party_classes[i]].name.to_sym, class_useable?($game_party.party_classes[i])) } when 1 @actor.available_classes.each_index { |i| add_command($data_classes[@actor.available_classes[i]].name, $data_classes[@actor.available_classes[i]].name.to_sym, afford?(@actor.available_classes[i])) } end else case @catagory when 0 @actor.current_classes.each_index { |i| add_command($data_classes[@actor.current_classes[i]].name, $data_classes[@actor.current_classes[i]].name.to_sym) } when 1 @actor.available_classes.each_index { |i| add_command($data_classes[@actor.available_classes[i]].name, $data_classes[@actor.available_classes[i]].name.to_sym, afford?(@actor.available_classes[i])) } end end end #-------------------------------------------------------------------------- # * Checks If You Can Afford Class #-------------------------------------------------------------------------- def afford?(class_id) check = false check = true if @actor.current_jp >= @actor.class_cost(class_id) return check end #-------------------------------------------------------------------------- # * Checks If You Can Use That Class #-------------------------------------------------------------------------- def class_useable?(class_id) @actor.current_classes.include?(class_id) end end #<--- End Class============================================================ #============================================================================== # ** Window_Command #------------------------------------------------------------------------------ # This window deals with general command choices. #============================================================================== class Window_Select_Classes < Window_Command #-------------------------------------------------------------------------- # * Get Window Height #-------------------------------------------------------------------------- def window_width return 160 end #-------------------------------------------------------------------------- # * Get Window Height #-------------------------------------------------------------------------- def window_height return 60 end #-------------------------------------------------------------------------- # * Get Col Max #-------------------------------------------------------------------------- def col_max item_max end #-------------------------------------------------------------------------- # * Get Item Width #-------------------------------------------------------------------------- def item_width return 35 end #-------------------------------------------------------------------------- # * Get Item Height #-------------------------------------------------------------------------- def item_height return 35 end #-------------------------------------------------------------------------- # * Get Spacing for Items Arranged Side by Side #-------------------------------------------------------------------------- def spacing return 25 end #-------------------------------------------------------------------------- # * Get Rectangle for Drawing Items #-------------------------------------------------------------------------- def item_rect(index) rect = Rect.new rect.width = item_width rect.height = item_height rect.x = index % col_max * (item_width + spacing) + 20 rect.y = index / col_max * item_height rect end #-------------------------------------------------------------------------- # * Make Command List #-------------------------------------------------------------------------- def make_command_list add_command("Current", :current, current?) add_command("Available", :available, available?) end #-------------------------------------------------------------------------- # * Checks Current Class Size #-------------------------------------------------------------------------- def current? actor = $game_party.menu_actor return actor.current_classes.size > 0 end #-------------------------------------------------------------------------- # * Checks Available Class Size #-------------------------------------------------------------------------- def available? actor = $game_party.menu_actor return actor.available_classes.size > 0 end #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(index) draw_icon(230, 25, 5, current?) draw_icon(14, 86, 5, available?) end end #<--- End Class============================================================ #============================================================================== # ** Window_Command #------------------------------------------------------------------------------ # This window deals with general command choices. #============================================================================== class Window_Confirm_Classes < Window_Command #-------------------------------------------------------------------------- # * Initialize Processing #-------------------------------------------------------------------------- def initialize(x, y) super(x, y) @actor = $game_party.menu_actor refresh end #-------------------------------------------------------------------------- # * Refresh Processing #-------------------------------------------------------------------------- def refresh super text = "Are You Sure" draw_sizeable_text(-10, -20, window_width, window_height, text, 1, 20) end #-------------------------------------------------------------------------- # * Draw Sizeable Text #-------------------------------------------------------------------------- def draw_sizeable_text(x, y, w, h, text, alignment, size) reset_font_settings contents.font.size = size contents.draw_text(x, y, w, h, text, alignment) reset_font_settings end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 200 end #-------------------------------------------------------------------------- # * Get Window Height #-------------------------------------------------------------------------- def window_height return 125 end #-------------------------------------------------------------------------- # * Get Col Max #-------------------------------------------------------------------------- def col_max item_max end #-------------------------------------------------------------------------- # * Get Visable Number Of Lines #-------------------------------------------------------------------------- def visable_lines return 4 end #-------------------------------------------------------------------------- # * Get Rectangle for Drawing Items #-------------------------------------------------------------------------- def item_rect(index) rect = Rect.new rect.width = item_width rect.height = item_height rect.x = index % col_max * (item_width + spacing) rect.y = index / col_max * item_height + 70 rect end #-------------------------------------------------------------------------- # * Make Command Lisl #-------------------------------------------------------------------------- def make_command_list add_command("Confirm", :confirm_ok) add_command("Cancel", :confirm_cancel) end end #<--- End Class============================================================ #============================================================================== # ** Scene_Base #------------------------------------------------------------------------------ # This is a super class of all scenes within the game. #============================================================================== class Scene_Promotion < Scene_Base #-------------------------------------------------------------------------- # * Initialize Processing #-------------------------------------------------------------------------- def initialize @actor = $game_party.menu_actor create_windows end #-------------------------------------------------------------------------- # * Create Windows #-------------------------------------------------------------------------- def create_windows draw_info_window draw_cat_window draw_command_window draw_status_window draw_confirm_window end #-------------------------------------------------------------------------- # * Draw Info Window #-------------------------------------------------------------------------- def draw_info_window @iw = Window_Promotion_Info.new(0, 0, Graphics.width, 90) end #-------------------------------------------------------------------------- # * Draw Confirm Window #-------------------------------------------------------------------------- def draw_confirm_window @conw = Window_Confirm_Classes.new(175, 155) @conw.set_handler(:confirm_ok, method(:command_confirm)) @conw.set_handler(:confirm_cancel, method(:command_cancel_confirm)) @conw.openness = 0 @conw.z = 255 @conw.deactivate end #-------------------------------------------------------------------------- # * Draw Select Catagory Window #-------------------------------------------------------------------------- def draw_cat_window @cw = Window_Select_Classes.new(0, @iw.height) @cw.set_handler(:current, method(:command_current)) @cw.set_handler(:available, method(:command_available)) if @actor.current_classes.size > 0 @cw.select(0) else @cw.select(1) end @cw.refresh end #-------------------------------------------------------------------------- # * Draw Command Window #-------------------------------------------------------------------------- def draw_command_window @ccw = Window_Current_Classes.new(0, @cw.height + @iw.height) @actor.current_classes.each_index { |i| @ccw.set_handler($data_classes[@actor.current_classes[i]].name.to_sym, method(:class_ok)) } @actor.available_classes.each_index { |i| @ccw.set_handler($data_classes[@actor.available_classes[i]].name.to_sym, method(:class_ok)) } @ccw.select(0) @ccw.deactivate end #-------------------------------------------------------------------------- # * Draw Status Window #-------------------------------------------------------------------------- def draw_status_window @sw = Window_Promotion_Status.new(@ccw.width, @iw.height, Graphics.width - @ccw.width, Graphics.height - @iw.height) end #-------------------------------------------------------------------------- # * Command Confirm #-------------------------------------------------------------------------- def command_confirm confirm_buy_class(@ccw.index) if @ccw.catagory == 1 confirm_change_class(@ccw.index) unless @ccw.catagory == 1 @conw.deactivate @conw.close $game_player.refresh @iw.refresh return_scene end #-------------------------------------------------------------------------- # * Confirm Buy Class #-------------------------------------------------------------------------- def confirm_buy_class(index) classes = @actor.available_classes cost = @actor.class_cost(classes[index]) sprite = @actor.class_sprite(classes[index]) face = @actor.class_face(classes[index]) if @actor.change_image? @actor.change_graphic(sprite[0], sprite[1].to_i) @actor.change_face(face[0], face[1].to_i) if face && face != [] end @actor.remove_jp(cost) if classes.include?(classes[index]) @actor.change_class(classes[index]) end #-------------------------------------------------------------------------- # * Confirm Change Class #-------------------------------------------------------------------------- def confirm_change_class(index) classes = @actor.current_classes class_id = classes[index] cost = @actor.class_cost(class_id) sprite = @actor.class_sprite(class_id) face = @actor.class_face(classes[index]) if @actor.change_image? @actor.change_face(face[0], face[1].to_i) if face && face != [] @actor.change_graphic(sprite[0], sprite[1].to_i) end @actor.change_class(class_id) end #-------------------------------------------------------------------------- # * Command Cancel Confirm #-------------------------------------------------------------------------- def command_cancel_confirm @conw.deactivate @conw.close @ccw.win_active(true) @ccw.activate end #-------------------------------------------------------------------------- # * Command Return Menu #-------------------------------------------------------------------------- def return_menu if @actor.current_classes.size > 0 @ccw.change_catagory(0) @ccw.win_active(false) @ccw.select(0) @ccw.deactivate @cw.select(0) @sw.refresh(@ccw.index, 0) @ccw.refresh @cw.refresh @cw.activate else @ccw.change_catagory(1) @ccw.win_active(false) @ccw.select(0) @ccw.deactivate @cw.select(1) @sw.refresh(@ccw.index, 1) @ccw.refresh @cw.refresh @cw.activate end end #-------------------------------------------------------------------------- # * Command Catagory Current #-------------------------------------------------------------------------- def command_current @cw.deactivate @ccw.win_active(true) @ccw.select(0) @ccw.activate @sw.refresh(@ccw.index, @ccw.catagory) end #-------------------------------------------------------------------------- # * Command Catagory Available #-------------------------------------------------------------------------- def command_available @cw.deactivate @ccw.win_active(true) @ccw.select(0) @ccw.activate @sw.refresh(@ccw.index, @ccw.catagory) end #-------------------------------------------------------------------------- # * Command Class Ok #-------------------------------------------------------------------------- def class_ok @ccw.deactivate @conw.select(1) @conw.open @conw.activate end #-------------------------------------------------------------------------- # * Update Proccessing #-------------------------------------------------------------------------- def update super update_trigs end #-------------------------------------------------------------------------- # * Update Trigger Proccessing #-------------------------------------------------------------------------- def update_trigs case when Input.trigger?(:UP) @sw.refresh(@ccw.index, @ccw.catagory) @ccw.refresh when Input.trigger?(:DOWN) @sw.refresh(@ccw.index, @ccw.catagory) @ccw.refresh when Input.trigger?(:LEFT) if @ccw.win_active? == false @ccw.catagory == 0 ? @ccw.change_catagory(1) : @ccw.change_catagory(0) end @cw.refresh @sw.refresh(@ccw.index, @ccw.catagory) @ccw.refresh when Input.trigger?(:RIGHT) if @ccw.win_active? == false @ccw.catagory == 0 ? @ccw.change_catagory(1) : @ccw.change_catagory(0) end @cw.refresh @sw.refresh(@ccw.index, @ccw.catagory) @ccw.refresh end return_scene if Input.trigger?(:B) && @ccw.win_active? == false return_menu if Input.trigger?(:B) && @ccw.win_active? end end #<--- End Class============================================================ #============================================================================== # ** BattleManager #------------------------------------------------------------------------------ # This module manages battle progress. #============================================================================== module BattleManager #-------------------------------------------------------------------------- # * Includes Module's Variables With Class #-------------------------------------------------------------------------- include V_PS2::Specs #-------------------------------------------------------------------------- # * Victory Processing #-------------------------------------------------------------------------- def self.process_victory play_battle_end_me replay_bgm_and_bgs $game_message.add(sprintf(Vocab::Victory, $game_party.name)) display_exp gain_jp gain_gold gain_drop_items gain_exp SceneManager.return battle_end(0) return true end #-------------------------------------------------------------------------- # * JP Acquisition and Display #-------------------------------------------------------------------------- def self.gain_jp if $game_troop.jp_total > 0 text = sprintf(("%s " + JP_Vocab + " Earned"), $game_troop.jp_total) $game_message.add('\.' + text) $game_party.gain_jp($game_troop.jp_total) end wait_for_message end end #<--- End Module=========================================================== #============================================================================== # ** Game_Actor #------------------------------------------------------------------------------ # This class handles actors. It is used within the Game_Actors class # ($game_actors) and is also referenced from the Game_Party class ($game_party). #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Includes Module's Variables With Class #-------------------------------------------------------------------------- include V_PS2::Specs #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :jp # Job Points #-------------------------------------------------------------------------- # * Aliasing Method: Setup #-------------------------------------------------------------------------- alias :gas510 :setup #-------------------------------------------------------------------------- # * Setup #-------------------------------------------------------------------------- def setup(actor_id) @jp = 0 gas510(actor_id) end #-------------------------------------------------------------------------- # * Returns Job Points #-------------------------------------------------------------------------- def current_jp return @jp end #-------------------------------------------------------------------------- # * Add Job Points #-------------------------------------------------------------------------- def add_jp(amount) (@jp + amount) > Max_JP ? @jp = Max_JP : @jp += amount end #-------------------------------------------------------------------------- # * Remove Job Points #-------------------------------------------------------------------------- def remove_jp(amount) (@jp - amount) < 0 ? @jp = 0 : @jp -= amount end #-------------------------------------------------------------------------- # * Change Graphics #-------------------------------------------------------------------------- def change_graphic(character_name, character_index) @character_name = character_name @character_index = character_index end #-------------------------------------------------------------------------- # * Change Graphics #-------------------------------------------------------------------------- def change_face(face_name, face_index) @face_name = face_name @face_index = face_index end #-------------------------------------------------------------------------- # * Returns all of the actor's class ids #-------------------------------------------------------------------------- def current_classes current_classes = [] @exp.each_key { |i| current_classes.push i unless i == @class_id} return current_classes end #-------------------------------------------------------------------------- # * Returns all of the actor's class ids #-------------------------------------------------------------------------- def requirement_met?(class_id, level) met = false if @exp.has_key?(class_id) met = true if class_level(class_id) >= level end return met end #-------------------------------------------------------------------------- # * Returns all of the actor's available class ids #-------------------------------------------------------------------------- def available_classes available_classes = [] $data_classes.size.times { |i| if i > 0 r = class_reqs(i) r.size.times { |req| check = true if requirement_met?(r[req][0], r[req][1]) == false check = false end if check == true available_classes.push i if @exp.has_key?(i) == false end } end } return available_classes end #-------------------------------------------------------------------------- # * Returns Class Level #-------------------------------------------------------------------------- def class_level(class_id) lv = 1 if @exp.has_key?(class_id) xp = @exp[class_id] lv += 1 while !max_level? && xp >= $data_classes[class_id].exp_for_level(lv + 1) lv -= 1 while xp < $data_classes[class_id].exp_for_level(lv) end return lv end #-------------------------------------------------------------------------- # * Returns If The Actor Graphics Are Changeable Or Not #-------------------------------------------------------------------------- def change_image? note = /
/ check = true changeable = $data_actors[@actor_id].note.scan(note) check = false if changeable[0] == "
" return check end #-------------------------------------------------------------------------- # * Returns Class JP Cost #-------------------------------------------------------------------------- def class_cost(class_id) note = //i cost = $data_classes[class_id].note.scan(note) return cost[0][0].to_i end #-------------------------------------------------------------------------- # * Returns Class Sprite #-------------------------------------------------------------------------- def class_sprite(class_id) note = //i sprite = $data_classes[class_id].note.scan(note) return sprite[0] end #-------------------------------------------------------------------------- # * Returns Class Sprite #-------------------------------------------------------------------------- def class_face(class_id) note = //i face = $data_classes[class_id].note.scan(note) return face[0] end #-------------------------------------------------------------------------- # * Returns Class Requirements #-------------------------------------------------------------------------- def class_reqs(class_id) requirements =[] note = //im class_requirements = $data_classes[class_id].note.scan(note) class_requirements.each_index { |i| requirements.push [class_requirements[i][0].to_i, class_requirements[i][1].to_i] } return requirements end end #<--- End Class============================================================ #============================================================================== # ** Game_Party #------------------------------------------------------------------------------ # This class handles parties. Information such as gold and items is included. # Instances of this class are referenced by $game_party. #============================================================================== class Game_Party < Game_Unit #-------------------------------------------------------------------------- # * Returns all of the actor's class ids #-------------------------------------------------------------------------- def party_classes party_classes = [] members.size.times { |i| members[i].current_classes.size.times { |c| if party_classes.include?(members[i].current_classes[c]) == false party_classes.push members[i].current_classes[c] end } } return party_classes end #-------------------------------------------------------------------------- # * Gain JP #-------------------------------------------------------------------------- def gain_jp(amount) members.size.times { |i| members[i].add_jp(amount) } end #-------------------------------------------------------------------------- # * Lose JP #-------------------------------------------------------------------------- def lose_jp(amount) members.size.times { |i| members[i].remove_jp(amount) } end end #<--- End Class============================================================ #============================================================================== # ** Game_Enemy #------------------------------------------------------------------------------ # This class handles enemies. It used within the Game_Troop class # ($game_troop). #============================================================================== class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # * Returns Enemy JP #-------------------------------------------------------------------------- def jp note = //i jp = $data_enemies[@enemy_id].note.scan(note) return jp[0][0].to_i end end #<--- End Class============================================================ #============================================================================== # ** Game_Troop #------------------------------------------------------------------------------ # This class handles enemy groups and battle-related data. Also performs # battle events. The instance of this class is referenced by $game_troop. #============================================================================== class Game_Troop < Game_Unit #-------------------------------------------------------------------------- # * Calculate Total Experience #-------------------------------------------------------------------------- def jp_total dead_members.inject(0) {|r, enemy| r += enemy.jp } end end #<--- End Class============================================================ #============================================================================== # ** Window_Base #------------------------------------------------------------------------------ # This is a super class of all windows within the game. #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # * Includes Module's Variables With Class #-------------------------------------------------------------------------- include V_PS2::Specs #-------------------------------------------------------------------------- # * Checks for Displaying Numbers For Level #-------------------------------------------------------------------------- if Use_Numbers == false #-------------------------------------------------------------------------- # * Draw Level #-------------------------------------------------------------------------- def draw_actor_level(actor, x, y) level = actor.class_level(actor.class_id) draw_sizeable_text(x, y - 5, 32, line_height, Vocab::level + ":", 0, 16) level.times { |i| draw_icon(Level_Icon, (x + (i * 20)), y + 10) } end end #-------------------------------------------------------------------------- # * Draw Sizeable Text #-------------------------------------------------------------------------- def draw_sizeable_text(x, y, w, h, text, alignment, size) reset_font_settings contents.font.size = size contents.draw_text(x, y, w, h, text, alignment) reset_font_settings end end #<--- End Class============================================================ #============================================================================== # ** Window_MenuCommand #------------------------------------------------------------------------------ # This command window appears on the menu screen. #============================================================================== class Window_MenuCommand < Window_Command #-------------------------------------------------------------------------- # * Aliasing Method: Add Original Commands #-------------------------------------------------------------------------- alias :aoc510 :add_original_commands #-------------------------------------------------------------------------- # * For Adding Original Commands #-------------------------------------------------------------------------- def add_original_commands aoc510() add_command("Promotions", :promotion, available?) end #-------------------------------------------------------------------------- # * Checks Current and Available Class Size #-------------------------------------------------------------------------- def available? check = false $game_party.members.size.times { |i| check = true if $game_party.members[i].current_classes.size > 0 || $game_party.members[0].available_classes.size > 0 return check if check == true } return check end end #<--- End Class============================================================ #============================================================================== # ** Window_MenuStatus #------------------------------------------------------------------------------ # This window displays party member status on the menu screen. #============================================================================== class Window_MenuStatus < Window_Selectable #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(index) actor = $game_party.members[index] enabled = $game_party.battle_members.include?(actor) rect = item_rect(index) draw_item_background(index) draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled) draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2) actor = $game_party.members[index] Use_Numbers == true ? level_y = -10 : level_y = 0 draw_sizeable_text(rect.x - 35, (rect.y + 30) + level_y, rect.width, rect.height, "Promotable", 1, 18) if promotable?(actor) end #-------------------------------------------------------------------------- # * Aliasing Method: Create Command Window #-------------------------------------------------------------------------- alias :wmspo510 :process_ok #-------------------------------------------------------------------------- # * Processing When OK Button Is Pressed #-------------------------------------------------------------------------- def process_ok actor = $game_party.members[index] has_classes?(actor) ? wmspo510() : Sound.play_buzzer end #-------------------------------------------------------------------------- # * Draw Sizeable Text #-------------------------------------------------------------------------- def draw_sizeable_text(x, y, w, h, text, alignment, size) reset_font_settings contents.font.size = size contents.draw_text(x, y, w, h, text, alignment) reset_font_settings end #-------------------------------------------------------------------------- # * Checks Available Class Size #-------------------------------------------------------------------------- def promotable?(actor) check = false check = true if actor.available_classes.size > 0 return check end #-------------------------------------------------------------------------- # * Checks Current and Available Class Size #-------------------------------------------------------------------------- def has_classes?(actor) check = false check = true if actor.current_classes.size > 0 || actor.available_classes.size > 0 return check end end #<--- End Class============================================================ #============================================================================== # ** Scene_Menu #------------------------------------------------------------------------------ # This class performs the menu screen processing. #============================================================================== class Scene_Menu < Scene_MenuBase #-------------------------------------------------------------------------- # * Aliasing Method: Create Command Window #-------------------------------------------------------------------------- alias :ccw510 :create_command_window #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window ccw510() @command_window.set_handler(:promotion, method(:command_personal)) end #-------------------------------------------------------------------------- # * Aliasing Method: [OK] Personal Command #-------------------------------------------------------------------------- alias :opo510 :on_personal_ok #-------------------------------------------------------------------------- # * [OK] Personal Command #-------------------------------------------------------------------------- def on_personal_ok $game_party.menu_actor = $game_party.members[@status_window.index] case @command_window.current_symbol when :promotion SceneManager.call(Scene_Promotion) end opo510() end end #<--- End Class============================================================