Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if true # << Make true to use this script, false to disable.
- #===============================================================================
- #
- # ☆ $D13x - Skill Upgrade
- # -- Author : Dekita
- # -- Version : 1.2
- # -- Level : Insane
- # -- Requires : $D13x Core
- # -- Engine : RPG Maker VX Ace
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:SUG]=true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # o2/o3/2o14 - Updated efficiency,
- # o1/o3/2o14 - Updated for additional customization,
- # 28/o2/2o14 - Finished,
- # ??/??/2o13 - Started,
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This script creates a highly dymanic and customizable Skill Upgrade scene.
- # You can use either Exp, SP or Gold to obtain skills this way.
- #
- # Using this script you will be able to make a huge assortment of skill tree's
- # each different from the last. You can also enable each actor to utilize a
- # different skill tree, very useful for different classes.
- #
- # In order to function correctly, this script requires the scripts listed below;
- # $D13x - Core v2.2
- # $D13x - Skill Levels v1.7
- # $D13x - Learn Skill Requirements v2.0
- #
- #===============================================================================
- # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
- #===============================================================================
- # 1. You MUST give credit to "Dekita" !!
- # 2. You are NOT allowed to repost this script.(or modified versions)
- # 3. You are NOT allowed to convert this script.
- # 4. You are NOT allowed to use this script for Commercial games.
- # 5. ENJOY!
- #
- # "FINE PRINT"
- # By using this script you hereby agree to the above terms and conditions,
- # if any violation of the above terms occurs "legal action" may be taken.
- # Not understanding the above terms and conditions does NOT mean that
- # they do not apply to you.
- # If you wish to discuss the terms and conditions in further detail you can
- # contact me at http://dekitarpg.wordpress.com/
- #
- #===============================================================================
- # ☆ Instructions
- #-------------------------------------------------------------------------------
- # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
- #
- #===============================================================================
- # ☆ Script Calls
- #-------------------------------------------------------------------------------
- # $game_actors[ID].gain_general_sp(eval)
- # eval = a string of code to eval(within Game_Actor), examples;
- # "atk + mhp + (def*2)"
- # "5 + @level"
- # "10"
- #
- # $game_actors[ID].skill_points
- # returns the value of actor ID's skill points.
- #
- #===============================================================================
- # ☆ Notetags ( default )
- #-------------------------------------------------------------------------------
- # <sp gain: VAL>
- # VAL = the amount of SP gain when an item or skill with this tag is used.
- #
- #-------------------------------------------------------------------------------
- # <sug cost: VAL>
- # VAL = the skill upgrade Cost_Setup id. To be used for skills only
- #
- #-------------------------------------------------------------------------------
- # <sug id: ID>
- # ID = skill Tree[ id ] for this actor / class.
- # NOTE: Actors have priority over Classes
- #
- #===============================================================================
- # ☆ HELP
- #-------------------------------------------------------------------------------
- # If you require additional assistancce, please leave a message on my blog @
- # http://dekitarpg.wordpress.com/
- #
- #===============================================================================
- module Skill_Upgrade
- #===============================================================================
- Tree=[] # << KEEP
- Cost_Setup=[] # << KEEP
- #-----------------------------------------------------------------------------
- # // Learning Requirements, use this to turn reqs off for testing.
- # // eg. no exp req for skill to be learned if :exp => false
- #-----------------------------------------------------------------------------
- Reqs={
- :exp => false,
- :gold => true,
- :sp => true,
- }
- #-----------------------------------------------------------------------------
- # // Settings for drawn requirements.
- #-----------------------------------------------------------------------------
- Draw_Exp_Req = true
- Draw_SP_Req = true
- Draw_Gold_Req = true
- #-----------------------------------------------------------------------------
- # // Graphics Folder
- #-----------------------------------------------------------------------------
- Folder = "$D13x/Skill Upgrade/"
- #-----------------------------------------------------------------------------
- # // Arrow Graphics, Must be in the folder defined above.
- #-----------------------------------------------------------------------------
- Arrows={
- :L => ['Arrow_L', 0], # ['image_name', hue]
- :R => ['Arrow_R', 0],
- :U => ['Arrow_U', 0],
- :D => ['Arrow_D', 0],
- }# << END Arrows
- #-----------------------------------------------------------------------------
- # // Skill Box Graphic. Must be in the folder defined above.
- #-----------------------------------------------------------------------------
- Skill_Bx = ["Skill_Box", 0]
- #-----------------------------------------------------------------------------
- # // Selected skill graphic. Must be in the folder defined above.
- #-----------------------------------------------------------------------------
- Selected = ["Selected_Box", 0]
- #-----------------------------------------------------------------------------
- # // Iconset Graphics.
- # // Must be in Graphics/System folder.
- #-----------------------------------------------------------------------------
- Iconset = "Iconset"
- #--------------------------------------------------------------------------
- # // This option only works if using my $D13x Scene Backgrounds Script.
- # // The background folder is set in the Scene BackGrounds script.
- #--------------------------------------------------------------------------
- BGs=[
- # ['NAME' , x, y, x scroll, y scroll, z, hue, init opac, max opac],
- ['Sunbeam_Overlay_by ShinGamix',0,0, 0, 0, 1, 0, 105, 255],
- ['ShinGamox_by ShinGamix',0,0, 0, 0, 1, 0, 105, 245],
- ['Fog_By_hyde' , 100, 100, 2, -2, 1, 0, 74, 125],
- ['$Dekita_II' , 0, 0, 1, 1, 2, 0, 0, 255],
- ]# << end
- #-----------------------------------------------------------------------------
- # // Noise when move left/right.
- #-----------------------------------------------------------------------------
- Cursor_Move_Sound = "Cursor1"
- #-----------------------------------------------------------------------------
- # // Vocab for Skill Points.
- #-----------------------------------------------------------------------------
- SP_Vocab = ["Skill Pts:" , "SP Cost:", "SP:"]
- #-----------------------------------------------------------------------------
- # // Vocab to confirm purchase
- #-----------------------------------------------------------------------------
- def self.confirm(skill)
- return "Confirm purchase of #{skill.name}?"
- end
- #-----------------------------------------------------------------------------
- # // vocab for a skill that has been maxed already
- #-----------------------------------------------------------------------------
- def self.maxxed(skill)
- return "#{skill.name}'s level is already maxxed"
- end
- #-----------------------------------------------------------------------------
- # // Vocab for failing to purchase a skill due to requirements.
- #-----------------------------------------------------------------------------
- def self.fail_buy(skill,lv_name)
- return "Requirements to purchase #{skill.name} #{lv_name} have not been met."
- end
- #-----------------------------------------------------------------------------
- # // Vocab for upgraded skills
- #-----------------------------------------------------------------------------
- def self.upgrade(skill,lv_name)
- return "#{skill.name} was upgraded to #{lv_name}."
- end
- #-----------------------------------------------------------------------------
- # // Vocab for learning skills
- #-----------------------------------------------------------------------------
- def self.learn(skill,lv_name)
- return "#{skill.name} has been learned."
- end
- #-----------------------------------------------------------------------------
- # // SP Gain Settings
- #-----------------------------------------------------------------------------
- SP_Settings={
- :each_lvl_up => '@level * 5',
- # Default SP gained Per Battle
- :each_battle => '@level * 5',
- # Default SP Gained Each Attack
- :each_attack => '@level * 1.5',
- # Default SP Gained Each Guard
- :each_guard => '@level * 1.5',
- # Default SP Gained Each Skill
- :each_skill => '@level * 1.8',
- # Default SP Gained Each Item
- :each_item => '@level * 2.0',
- # Default SP when Skill / Items are Used
- :each__use => '@level * 1.2',
- } #<< Keep
- #-----------------------------------------------------------------------------
- # // Notetag for additional SP gained when a skill / item is used.
- #-----------------------------------------------------------------------------
- SP_Use_Note = /<sp gain:(.*)>/i
- #-----------------------------------------------------------------------------
- # // Skill Cost Setups, Use the Cost_Note notetag to change a skills
- # // Cost_Setup ID
- #-----------------------------------------------------------------------------
- Cost_Note = /<sug cost:(.*)>/i
- #-----------------------------------------------------------------------------
- # // Skill Tree [id] notetag. Used for actors && classes.
- # // NOTE: Actors have priority over Classes
- #-----------------------------------------------------------------------------
- SUG_Note = /<sug id:(.*)>/i
- #-----------------------------------------------------------------------------
- # // Default Skill Cost ID
- #-----------------------------------------------------------------------------
- Default_Cost_Setup = 1
- #-----------------------------------------------------------------------------
- # // Default Skill Tree ID
- #-----------------------------------------------------------------------------
- Default_Skill_Tree = 0
- #-----------------------------------------------------------------------------
- # // Skill Points when each actor is added to party.
- #-----------------------------------------------------------------------------
- Starting_SP ={0=>0,# << KEEP
- 1 => 10, # Actor 1
- 2 => 20, # Actor 2
- 3 => 30, # Actor 3
- 4 => 40, # Actor 4
- 5 => 50, # ...
- 6 => 60,
- 7 => 70,
- 8 => 80,
- 9 => 90,
- 10 => 100,
- }# << END Starting_SP
- #-----------------------------------------------------------------------------
- # // Cost_Setup[ 0 ]
- #-----------------------------------------------------------------------------
- Cost_Setup[0]={
- 1 => {:sp => 0, :gold => nil },
- 2 => {:sp => 0, :gold => nil },
- 3 => {:sp => 0, :gold => nil },
- 4 => {:sp => 0, :gold => nil },
- 5 => {:sp => 100, :gold => nil },
- 6 => {:sp => 200, :gold => nil },
- 7 => {:sp => 400, :gold => nil },
- 8 => {:sp => 800, :gold => nil },
- 9 => {:sp => 2000, :gold => 100_000 },
- } # << Cost_Setup[0]
- #-----------------------------------------------------------------------------
- # // Cost_Setup[ 1 ]
- #-----------------------------------------------------------------------------
- Cost_Setup[1]={
- 1 => {:sp => 10, :gold => 1000 },
- 2 => {:sp => 50, :gold => 2500 },
- 3 => {:sp => 100, :gold => 5000 },
- 4 => {:sp => 500, :gold => 8000 },
- 5 => {:sp => 1000, :gold => 14_000 },
- 6 => {:sp => 5000, :gold => 20_000 },
- 7 => {:sp => 10_000, :gold => 30_000 },
- 8 => {:sp => 50_000, :gold => 50_000 },
- 9 => {:sp => 100_000, :gold => 100_000 },
- } # << Cost_Setup[1]
- #-----------------------------------------------------------------------------
- # // Cost_Setup[ 2 ]
- #-----------------------------------------------------------------------------
- Cost_Setup[2]={
- 1 => {:sp => 0, :gold => nil },
- 2 => {:sp => 0, :gold => nil },
- 3 => {:sp => 0, :gold => nil },
- 4 => {:sp => 0, :gold => nil },
- 5 => {:sp => 100, :gold => nil },
- 6 => {:sp => 200, :gold => nil },
- 7 => {:sp => 400, :gold => nil },
- 8 => {:sp => 800, :gold => nil },
- 9 => {:sp => 2000, :gold => 100_000 },
- } # << Cost_Setup[2]
- #-----------------------------------------------------------------------------
- # // Cost_Setup[ 3 ]
- #-----------------------------------------------------------------------------
- Cost_Setup[3]={
- 1 => {:sp => nil, :gold => nil },
- 2 => {:sp => nil, :gold => nil },
- 3 => {:sp => nil, :gold => nil },
- 4 => {:sp => nil, :gold => nil },
- 5 => {:sp => 100, :gold => nil },
- 6 => {:sp => 200, :gold => nil },
- 7 => {:sp => 400, :gold => nil },
- 8 => {:sp => 800, :gold => nil },
- 9 => {:sp => 1200, :gold => 100_000 },
- 10 => {:sp => 1800, :gold => 150_000 },
- 11 => {:sp => 2400, :gold => 200_000 },
- 12 => {:sp => 3000, :gold => 250_000 },
- 13 => {:sp => 3800, :gold => 300_000 },
- 14 => {:sp => 4500, :gold => 350_000 },
- 15 => {:sp => 5500, :gold => 400_000 },
- 16 => {:sp => 6600, :gold => 450_000 },
- 17 => {:sp => 7800, :gold => 500_000 },
- 18 => {:sp => 9000, :gold => 550_000 },
- 19 => {:sp => 15000, :gold => 750_000 },
- 20 => {:sp => 25000, :gold => 999_999 },
- } # << Cost_Setup[3]
- #=============================================================================
- # BEGIN SKILL TREE(s)
- #-----------------------------------------------------------------------------
- # NOTES::
- # :skill => the database id of the skill to show in this slot.
- # :pos => the position of this skill slot in the upgrade scene.
- # :dir => the destination slot that the player is taken when they press the
- # relevant key.
- # format is. dir: [slot_id, show_arrow]
- # eg. l: [1, true], r: [2, true], u: [3, true], d: [4, false]
- # this example means that when you are on this skill slot and press
- # :l (:LEFT) you will be taken to tree slot 1 and an arrow will be
- # also be shown.
- #
- #-----------------------------------------------------------------------------
- # // Skill Tree[ 0 ] Begin
- #-----------------------------------------------------------------------------
- Tree[0]=[
- {# 0
- :skill => 36,
- :pos => [201,208],
- :dir => {l: [1,true], r: [3,true], u: [6,false], d: [nil,false]},
- },
- {# 1
- :skill => 12,
- :pos => [163,208],
- :dir => {l: [nil,true], r: [0,false], u: [2,true], d: [nil,false]},
- },
- {# 2
- :skill => 13,
- :pos => [163,170],
- :dir => {l: [nil,true], r: [4,false], u: [5,true], d: [1,false]},
- },
- {# 3
- :skill => 14,
- :pos => [239,208],
- :dir => {l: [0,false], r: [nil,false], u: [4,true], d: [nil,false]},
- },
- {# 4
- :skill => 15,
- :pos => [239,170],
- :dir => {l: [2,false], r: [nil,true], u: [7,true], d: [3,false]},
- },
- {# 5
- :skill => 16,
- :pos => [163,132],
- :dir => {l: [nil,false], r: [6,false], u: [11,false], d: [2,false]},
- },
- {# 6
- :skill => 18,
- :pos => [201,132],
- :dir => {l: [5,false], r: [7,false], u: [12,false], d: [0,false]},
- },
- {# 7
- :skill => 17,
- :pos => [239,132],
- :dir => {l: [6,false], r: [nil,false], u: [13,false], d: [4,false]},
- },
- {# 8
- :skill => 38,
- :pos => [49,94],
- :dir => {l: [nil,false], r: [9,false], u: [17,true], d: [nil,false]},
- },
- {# 9
- :skill => 39,
- :pos => [87,94],
- :dir => {l: [8,false], r: [10,false], u: [18,true], d: [nil,false]},
- },
- {# 10
- :skill => 40,
- :pos => [125,94],
- :dir => {l: [9,false], r: [11,false], u: [19,true], d: [nil,false]},
- },
- {# 11
- :skill => 41,
- :pos => [163,94],
- :dir => {l: [10,false], r: [12,false], u: [20,true], d: [5,false]},
- },
- {# 12
- :skill => 37,
- :pos => [201,94],
- :dir => {l: [11,false], r: [13,false], u: [nil,true], d: [6,false]},
- },
- {# 13
- :skill => 42,
- :pos => [239,94],
- :dir => {l: [12,false], r: [14,false], u: [21,true], d: [7,false]},
- },
- {# 14
- :skill => 43,
- :pos => [277,94],
- :dir => {l: [13,false], r: [15,false], u: [22,true], d: [nil,false]},
- },
- {# 15
- :skill => 44,
- :pos => [315,94],
- :dir => {l: [14,false], r: [16,false], u: [23,true], d: [nil,false]},
- },
- {# 16
- :skill => 45,
- :pos => [353,94],
- :dir => {l: [15,false], r: [nil,false], u: [24,true], d: [nil,false]},
- },
- {# 17
- :skill => 19,
- :pos => [49,56],
- :dir => {l: [nil,false], r: [18,false], u: [25,true], d: [8,false]},
- },
- {# 18
- :skill => 21,
- :pos => [87,56],
- :dir => {l: [17,false], r: [19,false], u: [26,true], d: [9,false]},
- },
- {# 19
- :skill => 23,
- :pos => [125,56],
- :dir => {l: [18,false], r: [20,false], u: [27,true], d: [10,false]},
- },
- {# 20
- :skill => 25,
- :pos => [163,56],
- :dir => {l: [19,false], r: [21,false], u: [28,true], d: [11,false]},
- },
- {# 21
- :skill => 27,
- :pos => [239,56],
- :dir => {l: [20,false], r: [22,false], u: [29,true], d: [13,false]},
- },
- {# 22
- :skill => 29,
- :pos => [277,56],
- :dir => {l: [21,false], r: [23,false], u: [30,true], d: [14,false]},
- },
- {# 23
- :skill => 31,
- :pos => [315,56],
- :dir => {l: [22,false], r: [24,false], u: [31,true], d: [15,false]},
- },
- {# 24
- :skill => 33,
- :pos => [353,56],
- :dir => {l: [23,false], r: [nil,false], u: [32,true], d: [16,false]},
- },
- {# 25
- :skill => 20,
- :pos => [49,18],
- :dir => {l: [nil,false], r: [26,false], u: [nil,true], d: [17,false]},
- },
- {# 26
- :skill => 22,
- :pos => [87,18],
- :dir => {l: [25,false], r: [27,false], u: [nil,true], d: [18,false]},
- },
- {# 27
- :skill => 24,
- :pos => [125,18],
- :dir => {l: [26,false], r: [28,false], u: [nil,true], d: [19,false]},
- },
- {# 28
- :skill => 26,
- :pos => [163,18],
- :dir => {l: [27,false], r: [29,false], u: [nil,true], d: [20,false]},
- },
- {# 29
- :skill => 28,
- :pos => [239,18],
- :dir => {l: [28,false], r: [30,false], u: [nil,true], d: [21,false]},
- },
- {# 30
- :skill => 30,
- :pos => [277,18],
- :dir => {l: [29,false], r: [31,false], u: [nil,true], d: [22,false]},
- },
- {# 31
- :skill => 32,
- :pos => [315,18],
- :dir => {l: [30,false], r: [32,false], u: [nil,true], d: [23,false]},
- },
- {# 32
- :skill => 34,
- :pos => [353,18],
- :dir => {l: [31,false], r: [nil,false], u: [nil,true], d: [24,false]},
- },
- ]# << Skill Tree [0] END
- #=============================================================================
- # // You can create more (unlimited) Tree[id]'s below this point.
- #=============================================================================
- # // Enter your skill Tree(s) Here
- # // Enter your skill Tree(s) Here
- # // Enter your skill Tree(s) Here
- # // Enter your skill Tree(s) Here
- #=============================================================================
- #####################
- # CUSTOMISATION END #
- end #####################
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
- # #
- # http://dekitarpg.wordpress.com/ #
- # #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- #===============================================================================#
- # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
- # YES?\.\. #
- # OMG, REALLY? \| #
- # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
- # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
- #===============================================================================#
- module Cache
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def self.sd13x_sug(filename, hue = 0)
- load_bitmap("Graphics/#{Skill_Upgrade::Folder}", filename, hue)
- end
- end
- #===============================================================================
- module DataManager
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- class << self
- alias :lbd_sug :load_database
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def self.load_database
- lbd_sug
- loa_sug
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def self.loa_sug
- for o in $data_skills
- next if o == nil
- o.load_sug
- end
- end
- end # DataManager
- #===============================================================================
- module BattleManager
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- class << self
- alias :gain_sp_exp :gain_exp
- end
- #-----------------------------------------------------------------------------
- # Process Victory
- #-----------------------------------------------------------------------------
- def self.gain_exp
- gain_battle_sp_
- gain_sp_exp
- end
- #-----------------------------------------------------------------------------
- # Gain Battle Exp
- #-----------------------------------------------------------------------------
- def self.gain_battle_sp_
- $game_party.battle_members.each do |m|
- next unless m != nil
- next unless m.hp > 0
- m.gain_battle_sp
- end
- end
- end
- #===============================================================================
- class RPG::Actor < RPG::BaseItem
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def sug_id
- if self.note =~ Skill_Upgrade::SUG_Note
- return $1.to_i
- else
- return Skill_Upgrade::Default_Skill_Tree
- end
- end
- end
- #===============================================================================
- class RPG::Class < RPG::BaseItem
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def sug_id
- if self.note =~ Skill_Upgrade::SUG_Note
- return $1.to_i
- else
- return Skill_Upgrade::Default_Skill_Tree
- end
- end
- end
- #===============================================================================
- class RPG::Skill < RPG::UsableItem
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- attr_accessor :sug_cost_id
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def load_sug
- @sug_cost_id = Skill_Upgrade::Default_Cost_Setup
- check_sug_notetags
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def check_sug_notetags
- self.note.split(/[\r\n]+/).each do |line|
- case line
- when Skill_Upgrade::Cost_Note then @sug_cost_id = $1.to_i
- end
- end
- end
- end # << RPG::BaseItem
- #===============================================================================
- class RPG::UsableItem < RPG::BaseItem
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def sp_when_used
- if self.note =~ Skill_Upgrade::SP_Use_Note
- return $1.to_s
- else
- return Skill_Upgrade::SP_Settings[:each__use]
- end
- end
- end
- #===============================================================================
- class Game_Battler < Game_BattlerBase
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :_MDV__spexp :make_damage_value
- #-----------------------------------------------------------------------------
- # M.D.V
- #-----------------------------------------------------------------------------
- def make_damage_value(user, item)
- check_sp_gain(user,item)
- _MDV__spexp(user, item)
- end
- #-----------------------------------------------------------------------------
- # Check sp Gains
- #-----------------------------------------------------------------------------
- def check_sp_gain(user,item)
- return unless user.is_a?(Game_Actor)
- if item.is_a?(RPG::Skill)
- case item.id
- when user.attack_skill_id
- user.gain_attack_sp
- when user.guard_skill_id
- user.gain_guard_sp
- else
- user.gain_skill_sp
- end
- else
- user.gain_item_sp
- end
- user.gain_sp_for_use(item)
- end
- end
- #===============================================================================
- class Game_Actor < Game_Battler
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- attr_accessor :skill_points
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- alias :setup_sug_actor :setup
- alias :lev_up_sug :level_up
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def setup(actor_id)
- setup_sug_actor(actor_id)
- setup_sug_shit(actor_id)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def setup_sug_shit(actor_id)
- @skill_points = Skill_Upgrade::Starting_SP[actor_id]
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def level_up
- lev_up_sug
- gain_sp_for_level
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def class_sug_id
- return $data_classes[@class_id].sug_id
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def sug_id
- defa = Skill_Upgrade::Default_Skill_Tree
- defa = class_sug_id if class_sug_id != Skill_Upgrade::Default_Skill_Tree
- defa = actor.sug_id if actor.sug_id != Skill_Upgrade::Default_Skill_Tree
- return defa
- end
- #-----------------------------------------------------------------------------
- # Get Learning Skill Conditions
- #-----------------------------------------------------------------------------
- def sug_conditions_met?(learning, mult, gold_fee, sklp_fee, exp_req)
- 8.times do |i|
- return false if @param_fix_II[i] < (learning.param_req[i] * mult).to_i
- end
- if $D13x[:Stats_Control]
- 10.times do |i|
- return false if @xparam_fix_II[i] < (learning.xpars_req[i] * mult).to_f
- end
- 10.times do |i|
- return false if @sparam_fix_II[i] < (learning.spars_req[i] * mult).to_f
- end
- end
- learning.swtch_req.each do |switch|
- return false if !$game_switches[ switch ]
- end
- learning.varis_req.each do |vari|
- return false if $game_variables[ vari[0] ] < (vari[1] * mult).to_i
- end
- learning.evals_req.each do |evl|
- return false if eval( evl.to_s )
- end
- if $D13x[:Elems_Control]
- $data_system.elements.size.times do |i|
- return false if @def_ele_fix_II[i] < learning.def_ele_req[i]
- return false if @atk_ele_fix_II[i] < learning.atk_ele_req[i]
- end
- end
- if $D13x[:Atk_Def_Lvs]
- 2.times do |i|
- return false if @atl_dfl_prefix[i] < learning.atl_dfl_req[i]
- end
- end
- if $D13x[:ISPDS]
- SPDS::Commands.each do |i|
- return false if parent_stat(i) < learning.spds_stats_req[i]
- end
- end
- learning.skill_req.each do |skil|
- return false if !skills.include?($data_skills[skil[0]])
- return false if skills_lv(skil[0]) < skil[1]
- end
- return false if @level < (learning.level_req * mult).to_i
- if Skill_Upgrade::Reqs[:exp]
- return false if exp_req > skills_exp(learning.id)
- end
- if Skill_Upgrade::Reqs[:gold]
- return false if $game_party.gold < gold_fee
- end
- if Skill_Upgrade::Reqs[:sp]
- return false if @skill_points < sklp_fee
- end
- return true
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def can_level_skill?(skill)
- have = skills.include?(skill)
- levz = skills_lv(skill.id) >= skill.max_lv
- return false if levz && (have == false)
- return true
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def sug_sp(type)
- return Skill_Upgrade::Sp_Settings[type]
- end
- #-----------------------------------------------------------------------------
- # Gain Battle Sp
- #-----------------------------------------------------------------------------
- def gain_battle_sp
- value = ([eval(sug_sp(:each_battle)), 0].max rescue 0)
- @skill_points += value
- end
- #-----------------------------------------------------------------------------
- # Gain Attack Sp
- #-----------------------------------------------------------------------------
- def gain_attack_sp
- value = ([eval(sug_sp(:each_attack)), 0].max rescue 0)
- @skill_points += value
- end
- #-----------------------------------------------------------------------------
- # Gain Guard Sp
- #-----------------------------------------------------------------------------
- def gain_guard_sp
- value = ([eval(sug_sp(:each_guard)), 0].max rescue 0)
- @skill_points += value
- end
- #-----------------------------------------------------------------------------
- # Gain Skill sp
- #-----------------------------------------------------------------------------
- def gain_skill_sp
- value = ([eval(sug_sp(:each_skill)), 0].max rescue 0)
- @skill_points += value
- end
- #-----------------------------------------------------------------------------
- # Gain Item Sp
- #-----------------------------------------------------------------------------
- def gain_item_sp
- value = ([eval(sug_sp(:each_item)), 0].max rescue 0)
- @skill_points += value
- end
- #-----------------------------------------------------------------------------
- # Gain Sp For Skill Use
- #-----------------------------------------------------------------------------
- def gain_sp_for_use(item)
- value = ([eval(item.sp_when_used), 0].max rescue 0)
- @skill_points += value
- end
- #-----------------------------------------------------------------------------
- # Gain Sp For Level Up
- #-----------------------------------------------------------------------------
- def gain_sp_for_level
- value = ([eval(Skill_Upgrade::SP_Settings[:each_lvl_up]), 0].max rescue 0)
- @skill_points += value
- end
- #-----------------------------------------------------------------------------
- # Gain Sp For Skill Use
- #-----------------------------------------------------------------------------
- def gain_general_sp(eVal)
- value = ([eval(eVal), 0].max rescue 0)
- @skill_points += value
- end
- end
- #===============================================================================
- class SUG_Sml_Window < Window_Selectable
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def initialize(actor,x,y)
- w = Graphics.width / 3 + 1
- h = fitting_height( 2 )
- super(x, y+8, w, h)
- @actor = actor
- refresh
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def standard_padding
- return 8
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def actor=(actor)
- return if @actor == actor
- @actor = actor
- refresh
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def refresh
- contents.clear
- return unless @actor
- reset_font_settings
- draw_skill_pts
- draw_gold
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def reset_font_settings
- change_color(normal_color)
- self.contents.font.name = General::Fonts
- self.contents.font.size = General::Font_Size
- self.contents.font.bold = General::Font_Bold
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_skill_pts
- pts = @actor.skill_points.to_i
- contents.fill_rect(0,0,self.width-16,line_height-2,Color.new(0,0,0,64))
- draw_text(4, 0, self.width-24, line_height,Skill_Upgrade::SP_Vocab[0],0)
- draw_text(0, 0, self.width-20, line_height, pts ,2)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_gold
- pts = $game_party.gold
- contents.fill_rect(0,24,self.width-16,line_height-2,Color.new(0,0,0,64))
- draw_text(4, 24, self.width-24, line_height, "#{Vocab.currency_unit}:",0)
- draw_text(0, 24, self.width-20, line_height, pts ,2)
- end
- end
- #===============================================================================
- class SUG_Main_Window < Window_Selectable
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def initialize(actor, y)
- h = Graphics.height - y
- super(0, y, Graphics.width/3*2, h)
- @actor = actor
- refresh
- activate
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def actor=(actor)
- return if @actor == actor
- @actor = actor
- refresh
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def refresh
- contents.clear
- end
- end
- #===============================================================================
- class SUG_Data_Window < Window_Selectable
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- attr_reader :gotsk
- attr_reader :sk_lv
- attr_reader :skill
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def initialize(actor,skill,data,y,d)
- x = Graphics.width/3*2
- w = Graphics.width/3+1
- h = Graphics.height-y-d
- super(x, y, w, h)
- @actor = actor
- @skill = skill
- @data = data
- refresh
- activate
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def standard_padding
- return 4
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def actor=(actor)
- return if @actor == actor
- @actor = actor
- refresh
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def skill=(skill)
- return if @skill == skill
- @skill = skill
- refresh
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def data=(data)
- return if @data == data
- @data = data
- refresh
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def refresh
- contents.clear
- return unless @actor
- return unless @skill
- return unless @data
- reset_font_settings
- draw_all_sug_info
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def reset_font_settings
- change_color(normal_color)
- self.contents.font.name = General::Fonts
- self.contents.font.size = General::Font_Size
- self.contents.font.bold = General::Font_Bold
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def box_color
- return Color.new(0,0,0,64)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_all_sug_info
- @de_x = 4
- @de_y = 30
- @gotsk = @actor.skills.include?(@skill)
- @sk_lv = @actor.skills_lv(@skill.id)
- draw_name
- draw_level
- draw_exp_req if Skill_Upgrade::Draw_Exp_Req
- draw_sp_cost if Skill_Upgrade::Draw_SP_Req
- draw_gold_cost if Skill_Upgrade::Draw_Gold_Req
- draw_requirements
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def skill_maxed?
- return @actor.skills_lv(@skill.id) >= $data_skills[@skill.id].max_lv
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_name
- contents.fill_rect(@de_x,4,self.width-16,line_height, box_color)
- draw_de_icon(@skill.icon_index,@de_x, 4, hue = 0, enabled = true)
- draw_text(@de_x, 4, self.width-16, line_height, @skill.name,1)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_level
- contents.fill_rect(@de_x,@de_y,self.width-16,line_height-6,box_color)
- if skill_maxed?
- text = Skill_Levels::Exp_Set[@skill.exp_set][@sk_lv][1]
- else
- text = Skill_Levels::Exp_Set[@skill.exp_set][@sk_lv+1][1]
- end
- text = "Learn" if !@gotsk
- text = "MASTERED" if @gotsk && skill_maxed?
- draw_text(@de_x, 28, self.width-16, line_height, text, 1) if @skill.show_exp_data
- @de_y += 20
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_exp_req
- contents.fill_rect(@de_x,@de_y,self.width-16,line_height-6,box_color)
- if @gotsk
- draw_text(@de_x+4,@de_y-2,self.width-16,line_height, "Exp Req:")
- if skill_maxed?
- gote = "--"
- need = "--"
- else
- gote = @actor.skills_exp(@skill.id)
- need = Skill_Levels::Exp_Set[@skill.exp_set][@sk_lv+1][0]
- end
- draw_text(@de_x,@de_y-2, self.width-20, line_height, "#{gote}/#{need}", 2)
- else
- draw_text(@de_x+4,@de_y-2,self.width-16, line_height, "Exp Req:")
- draw_text(@de_x,@de_y-2,self.width-20, line_height, "--/--", 2)
- end
- @de_y += 20
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_sp_cost
- contents.fill_rect(@de_x,@de_y,self.width-16,line_height-6,box_color)
- draw_text(@de_x+4,@de_y-2, self.width-16, line_height,Skill_Upgrade::SP_Vocab[1])
- if skill_maxed?
- need = "--"
- else
- need = Skill_Upgrade::Cost_Setup[@skill.sug_cost_id][@sk_lv+1][:sp]
- need = Skill_Upgrade::Cost_Setup[@skill.sug_cost_id][@sk_lv][:sp] if !@gotsk
- end
- draw_text(@de_x,@de_y-2, self.width-20, line_height, "#{need}", 2)
- @de_y += 20
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_gold_cost
- contents.fill_rect(@de_x,@de_y,self.width-16,line_height-6,box_color)
- text = "#{Vocab.currency_unit} Cost:"
- draw_text(@de_x+4,@de_y-2,self.width-16, line_height, text)
- if skill_maxed?
- need = "--"
- else
- need = Skill_Upgrade::Cost_Setup[@skill.sug_cost_id][@sk_lv+1][:gold]
- need = Skill_Upgrade::Cost_Setup[@skill.sug_cost_id][@sk_lv][:gold] if !@gotsk
- end
- draw_text(@de_x,@de_y-2,self.width-20,line_height,"#{need}", 2)
- @de_y += 20
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_requirements
- y = @de_y
- sklv = Skill_Levels::Exp_Set[@skill.exp_set]
- if skill_maxed?
- mult = sklv[@sk_lv ][2]
- else
- mult = sklv[@sk_lv+1][2]
- mult = sklv[@sk_lv ][2] if !@gotsk
- end
- 8.times do |i|
- if (@skill.param_req[i] * mult).to_i != 0
- y = draw_param_req(y,i,mult)
- end
- end
- if $D13x[:Stats_Control]
- 7.times do |i|
- if (@skill.xpars_req[i] * mult).to_i != 0.0
- y = draw_xparam_req(y,i,mult)
- end
- end
- 3.times do |i|
- if (@skill.xpars_req[i+7] * mult).to_f > (-1.0)
- y = draw_xparam_req(y,i+7,mult)
- end
- end
- 10.times do |i|
- if (@skill.spars_req[i] * mult).to_i != 0.0
- y = draw_sparam_req(y,i,mult)
- end
- end
- end
- @skill.swtch_req.each do |switch|
- if !$game_switches[ switch ]
- y = draw_switch_req(y,switch)
- end
- end
- @skill.varis_req.each do |vari|
- if $game_variables[ vari[0] ] < (vari[1] * mult).to_i
- y = draw_var_req(y,vari,mult)
- end
- end
- @skill.evals_req.each do |evl|
- if eval( evl.to_s )
- y = draw_eval_req(y,mult)
- end
- end
- if $D13x[:Elems_Control]
- $data_system.elements.size.times do |i|
- if @skill.atk_ele_req[i]*mult > (-2.0)
- y = draw_atke_req(y,i,mult)
- end
- if @skill.def_ele_req[i]*mult > (-2.0)
- y = draw_defe_req(y,i,mult)
- end
- end
- end
- if $D13x[:Atk_Def_Lvs]
- 2.times do |i|
- if @skill.atl_dfl_req[i]*mult.to_i != 0
- y = draw_atldfl_req(y,i,mult)
- end
- end
- end
- if $D13x[:ISPDS]
- SPDS::Commands.each do |i|
- if @skill.spds_stats_req[i]*mult != 0
- y = draw_ispds_req(y,i,mult)
- end
- end
- end
- @skill.skill_req.each do |skil|
- if @actor.skills_lv(skil[0]) < skil[1]
- y = draw_skill_lv_req(y,$data_skills[skil[0]],skil[1])
- else
- y = draw_skill_req(y,$data_skills[ skil[0] ] )
- end
- end
- y = draw_level_req(y,@skill.level_req)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_param_req(y,i,m)
- contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
- draw_text(@de_x+4, y-2, self.width-16, line_height, "#{Vocab.param(i)}:")
- draw_text(@de_x, y-2, self.width-20, line_height, "#{(@skill.param_req[i]*m).to_i}",2)
- return y += 20
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_xparam_req(y,i,m)
- contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
- draw_text(@de_x+4, y-2, self.width-16, line_height, "#{Vocab.x_param(i)}:")
- draw_text(@de_x, y-2, self.width-20, line_height, "#{(@skill.xpars_req[i]*m).to_f}",2)
- return y += 20
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_sparam_req(y,i,m)
- contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
- draw_text(@de_x+4, y-2, self.width-16, line_height, "#{Vocab.s_param(i)}:")
- draw_text(@de_x, y-2, self.width-20, line_height, "#{(@skill.spars_req[i]*m).to_f}",2)
- return y += 20
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_switch_req(y,switch)
- contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
- draw_text(@de_x+2, y-2, self.width-16, line_height, "Classified",1)
- return y += 20
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_var_req(y,var,m)
- contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
- draw_text(@de_x+2, y-2, self.width-16, line_height, "Classified",1)
- return y += 20
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_eval_req(y)
- contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
- draw_text(@de_x+2, y-2, self.width-16, line_height, "Classified",1)
- return y += 20
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_atke_req(y,i,m)
- contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
- draw_text(@de_x+4, y-2, self.width-16, line_height, "#{$data_system.elements[i]}:")
- draw_text(@de_x, y-2, self.width-20, line_height, "#{(@skill.atk_ele_req[i]*m).to_f}",2)
- return y += 20
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_defe_req(y,i,m)
- contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
- draw_text(@de_x+4, y-2, self.width-16, line_height, "#{$data_system.elements[i]}:")
- draw_text(@de_x, y-2, self.width-20, line_height, "#{(@skill.def_ele_req[i]*m).to_f}",2)
- return y += 20
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_atldfl_req(y,i,m)
- name = Atl_Dfl::Atl_Name if i == 0
- name = Atl_Dfl::Atl_Name if i == 1
- contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
- draw_text(@de_x+4, y-2, self.width-16, line_height, "#{name}:")
- draw_text(@de_x, y-2, self.width-20, line_height, "#{(@skill.atl_dfl_req[i]*m).to_i}",2)
- return y += 20
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_ispds_req(y,i,m)
- com = SPDS::Commands[i]
- return y unless @actor.spds_set[com]
- contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
- draw_text(@de_x+4, y-2, self.width-16, line_height, "Req #{@actor.spds_set[com][:name]}:")
- draw_text(@de_x, y-2, self.width-20, line_height, "#{(@skill.spds_stats_req[i]*m).to_i}",2)
- return y += 20
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_skill_req(y,skil)
- contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
- draw_text(@de_x+4, y-2, self.width-16, line_height, "#{skil.name}:")
- text = Skill_Levels::Exp_Set[@skill.exp_set][@sk_lv][1]
- draw_text(@de_x, y-2, self.width-20-(self.width/4), line_height, "#{text}",2)
- return y += 20
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_skill_lv_req(y,skil,req_lv)
- contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
- draw_text(@de_x+4, y-2, self.width-16, line_height, "Req Skill:")
- text = Skill_Levels::Exp_Set[@skill.exp_set][req_lv][1]
- draw_text(@de_x, y-2, self.width-20, line_height, "#{skil.name} #{text}",2)
- return y += 20
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def draw_level_req(y,req_lv)
- contents.fill_rect(@de_x,y,self.width-16,line_height-6,box_color)
- draw_text(@de_x+4, y-2, self.width-16, line_height, "Req #{Vocab.level}:")
- draw_text(@de_x, y-2, self.width-20, line_height, "#{req_lv}",2)
- return y += 20
- end
- end
- #===============================================================================
- class Window_SUGCommand < Window_Command
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def initialize(x, y)
- @can_buy = true
- super(x, y)
- select(-1)
- deactivate
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def can_buy?
- return @can_buy
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def change_can_buy(val)
- @can_buy = val
- refresh
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def alignment
- return 1
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def window_width
- return Graphics.width / 4
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def window_height
- return fitting_height(2)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def make_command_list
- add_command("Purchase", :buy_skill, can_buy?)
- add_command("Back", :no_buy)
- end
- end
- #===============================================================================
- class SUG_Icon
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Pi Variables
- #-----------------------------------------------------------------------------
- attr_reader :data, :l, :r, :u, :d, :selected
- #-----------------------------------------------------------------------------
- # Initialize
- #-----------------------------------------------------------------------------
- def initialize(data, y, actor)
- @selected = false
- @actor = actor
- @data = data
- @y_val = y
- make_back
- make_icon
- make_dirs
- end
- #-----------------------------------------------------------------------------
- # Dispose
- #-----------------------------------------------------------------------------
- def dispose
- disp_back
- disp_icon
- disp_dirs
- end
- #-----------------------------------------------------------------------------
- # Update
- #-----------------------------------------------------------------------------
- def update
- updt_back
- updt_icon
- updt_dirs
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def x
- return @data[:pos][0]
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def y
- return @data[:pos][1]+@y_val
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def make_back
- @back = Sprite.new
- dat = Skill_Upgrade::Skill_Bx
- @back.bitmap = Cache.sd13x_sug(dat[0],dat[1])
- @back.x = @data[:pos][0]
- @back.y = @data[:pos][1]+@y_val
- @back.z = 200
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def disp_back
- @back.bitmap.dispose
- @back.dispose
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def updt_back
- @back.update
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def make_icon
- i = $data_skills[@data[:skill]].icon_index
- @icon = Sprite.new
- @icon.bitmap = Cache.system(Skill_Upgrade::Iconset)
- rect = Rect.new(i % 16 * 24, i / 16 * 24, 24, 24)
- @icon.bitmap.blt(0, 0, @icon.bitmap, rect)
- @icon.src_rect.set(rect.x, rect.y, 24, 24)
- @icon.x = @back.x+1
- @icon.y = @back.y+1
- @icon.z = @back.z+1
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def disp_icon
- @icon.bitmap.dispose
- @icon.dispose
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def updt_icon
- @icon.update
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def make_dirs
- make_l
- make_r
- make_u
- make_d
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def arw(dir)
- return Skill_Upgrade::Arrows[dir]
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def make_l
- if @data[:dir][:l][0] != nil
- @l = true
- return unless @data[:dir][:l][1]
- @ls = Sprite.new
- @ls.bitmap = Cache.sd13x_sug(arw(:L)[0],arw(:L)[1])
- @ls.x = @back.x-(@ls.bitmap.width)+1
- @ls.y = @back.y+2
- @ls.z = @back.z+2
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def make_r
- if @data[:dir][:r][0] != nil
- @r = true
- return unless @data[:dir][:r][1]
- @rs = Sprite.new
- @rs.bitmap = Cache.sd13x_sug(arw(:R)[0],arw(:R)[1])
- @rs.x = @back.x+@back.width-1
- @rs.y = @back.y+2
- @rs.z = @back.z+2
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def make_u
- if @data[:dir][:u][0] != nil
- @u = true
- return unless @data[:dir][:u][1]
- @us = Sprite.new
- @us.bitmap = Cache.sd13x_sug(arw(:U)[0],arw(:U)[1])
- @us.x = @back.x+2
- @us.y = @back.y-(@us.bitmap.height)+1
- @us.z = @back.z+2
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def make_d
- if @data[:dir][:d][0] != nil
- @d = true
- return unless @data[:dir][:d][1]
- @ds = Sprite.new
- @ds.bitmap = Cache.sd13x_sug(arw(:D)[0],arw(:D)[1])
- @ds.x = @back.x+2
- @ds.y = @back.y+@back.height-1
- @ds.z = @back.z+2
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def disp_dirs
- if @ls
- @ls.bitmap.dispose
- @ls.dispose
- end
- if @rs
- @rs.bitmap.dispose
- @rs.dispose
- end
- if @us
- @us.bitmap.dispose
- @us.dispose
- end
- if @ds
- @ds.bitmap.dispose
- @ds.dispose
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def updt_dirs
- if @ls
- @ls.update
- end
- if @rs
- @rs.update
- end
- if @ds
- @ds.update
- end
- if @us
- @us.update
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def select
- return if @selected
- @selected = true
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def unselect
- return unless @selected
- @selected = false
- end
- end
- #===============================================================================
- class SUG_Window
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def initialize(actor, y)
- @actor = actor
- @y_val = y
- make_skills
- make_command
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def actor=(actor)
- return unless @actor != actor
- @actor = actor
- disp_skills
- disp_command
- make_skills
- make_command
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def dispose
- disp_skills
- disp_command
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update
- updt_skills
- updt_command
- updt_inputs
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def make_skills
- @skills = []
- Skill_Upgrade::Tree[@actor.sug_id].each do |i|
- @skills << SUG_Icon.new(i, @y_val, @actor)
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def disp_skills
- return unless @skills
- @skills.each do |i|
- i.dispose
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def updt_skills
- @skills.each do |i|
- i.update
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def make_command
- @curr_comm = 0
- @comm = Sprite.new
- dat = Skill_Upgrade::Selected
- @comm.bitmap = Cache.sd13x_sug(dat[0],dat[1])
- @comm.x = @skills[@curr_comm].x
- @comm.y = @skills[@curr_comm].y
- @comm.z = 205
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def disp_command
- return unless @comm
- @comm.bitmap.dispose
- @comm.dispose
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def updt_command
- return unless @comm
- @comm.update
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def updt_inputs
- return unless @comm
- if Keys.trigger?(Keys::Key[:UP]) && @skills[@curr_comm].u
- @curr_comm = @skills[@curr_comm].data[:dir][:u][0]
- play_cursor
- end
- if Keys.trigger?(Keys::Key[:DOWN]) && @skills[@curr_comm].d
- @curr_comm = @skills[@curr_comm].data[:dir][:d][0]
- play_cursor
- end
- if Keys.trigger?(Keys::Key[:LEFT]) && @skills[@curr_comm].l
- @curr_comm = @skills[@curr_comm].data[:dir][:l][0]
- play_cursor
- end
- if Keys.trigger?(Keys::Key[:RIGHT]) && @skills[@curr_comm].r
- @curr_comm = @skills[@curr_comm].data[:dir][:r][0]
- play_cursor
- end
- if @comm.x != @skills[@curr_comm].x || @comm.y != @skills[@curr_comm].y
- @comm.x = @skills[@curr_comm].x
- @comm.y = @skills[@curr_comm].y
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def play_cursor
- RPG::SE.new(Skill_Upgrade::Cursor_Move_Sound).play
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def skill
- return $data_skills[@skills[@curr_comm].data[:skill]]
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def data
- return @skills[@curr_comm].data
- end
- end
- #===============================================================================
- class SUG_Scene < Scene_MenuBase
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def start
- super
- create_help_window
- create_status_window
- create_main_window
- create_SUG_window
- create_small_window
- create_data_window
- create_command_window
- update_can_buy_info(true)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def terminate
- super
- @SUG_window.dispose
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_small_window
- x = Graphics.width/3*2
- y = Graphics.height-@help_window.height
- @small_window = SUG_Sml_Window.new(@actor,x,y)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_help_window
- @help_window = Deki_Help.new
- @help_window.viewport = @viewport
- @help_window.x = Graphics.width / 4
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_status_window
- @status_window = Window_StatusDekita.new(@actor,@help_window.height)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_main_window
- y = @status_window.y + @status_window.height
- @main_window = SUG_Main_Window.new(@actor, y)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_SUG_window
- @SUG_window = SUG_Window.new(@actor, @main_window.y)
- @help_window.set_item(@SUG_window.skill)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_data_window
- skill = @SUG_window.skill
- data = @SUG_window.data
- d = @small_window.height
- @data_window = SUG_Data_Window.new(@actor,skill,data,@main_window.y,d)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def create_command_window
- @command_window = Window_SUGCommand.new(0,0)
- @command_window.set_handler(:buy_skill, method(:buy_skill))
- @command_window.set_handler(:no_buy, method(:leave_skill))
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update
- super
- @SUG_window.update if !@command_window.active
- @data_window.skill = @SUG_window.skill
- @data_window.data = @SUG_window.data
- update_help
- update_presses
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update_help
- if @command_window.active
- skill = @data_window.skill
- sk_lv = @actor.skills_lv(skill.database_id)
- suggg = Skill_Upgrade::Cost_Setup[skill.sug_cost_id]
- need = suggg[sk_lv][:sp]
- gold = suggg[sk_lv][:gold]
- if @data_window.gotsk && !@data_window.skill_maxed?
- need = suggg[sk_lv+1][:sp]
- gold = suggg[sk_lv+1][:gold]
- end
- text = Skill_Upgrade.confirm(@SUG_window.skill)
- @help_window.set_text(text)
- else
- @help_window.set_text(@SUG_window.skill.description)
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update_presses
- update_can_buy_info
- update_enter_press
- update_back_press
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update_enter_press
- return if @command_window.active
- if Keys.trigger?(Keys::Key[:ENTER])
- Sound.play_ok
- @command_window.activate
- @command_window.select(0)
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update_can_buy_info(bypass=false)
- return if @command_window.active unless bypass
- u = Keys.trigger?(Keys::Key[:UP])
- d = Keys.trigger?(Keys::Key[:DOWN])
- l = Keys.trigger?(Keys::Key[:LEFT])
- r = Keys.trigger?(Keys::Key[:RIGHT])
- return unless u || d || l || r || bypass
- a = @actor.skills_lv(@data_window.skill.id)
- b = $data_skills[@data_window.skill.id].max_lv
- h = @actor.skills.include?(@data_window.skill)
- if (a == 1) && (b == 1) && (h == false)
- @command_window.change_can_buy(true)
- else
- @command_window.change_can_buy(a < b)
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update_back_press
- e = Keys.trigger?(Keys::Key[:ESC])
- o = Keys.trigger?(Keys::Key[:N_0])
- x = Keys.trigger?(Keys::Key[:X])
- return unless e || o || x
- Sound.play_cancel
- if @command_window.active
- leave_skill
- else
- return_scene
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def get_all_bgs
- return unless $D13x[:Scene_BGs]
- @bg_set = Skill_Upgrade::BGs
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def buy_skill
- sk_lv = @data_window.sk_lv
- skill = @data_window.skill
- have = @actor.skill_learn?(skill)
- can = @actor.can_level_skill?(skill)
- if have
- return return_maxed_skill if (can == false)
- gold = Skill_Upgrade::Cost_Setup[skill.sug_cost_id][sk_lv+1][:gold]
- sklp = Skill_Upgrade::Cost_Setup[skill.sug_cost_id][sk_lv+1][:sp]
- exp_r = Skill_Levels::Exp_Set[skill.exp_set][sk_lv+1][0]
- sklna = Skill_Levels::Exp_Set[skill.exp_set][sk_lv+1][1]
- multi = Skill_Levels::Exp_Set[skill.exp_set][sk_lv+1][2]
- else
- gold = Skill_Upgrade::Cost_Setup[skill.sug_cost_id][sk_lv][:gold]
- sklp = Skill_Upgrade::Cost_Setup[skill.sug_cost_id][sk_lv][:sp]
- exp_r = Skill_Levels::Exp_Set[skill.exp_set][sk_lv][0]
- sklna = Skill_Levels::Exp_Set[skill.exp_set][sk_lv][1]
- multi = Skill_Levels::Exp_Set[skill.exp_set][sk_lv][2]
- end
- can_learn = @actor.sug_conditions_met?(skill,multi,gold,sklp,exp_r)
- if can_learn
- upgrade_skill(skill,have,sklna,gold,sklp)
- else
- return_skill_reqs_fail(sklna)
- end
- leave_skill
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def return_maxed_skill
- text = Skill_Upgrade.maxxed(@SUG_window.skill)
- @help_window.set_text(text)
- update_required
- leave_skill
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def return_skill_reqs_fail(lv_name)
- skill = @SUG_window.skill
- text = Skill_Upgrade.fail_buy(skill,lv_name)
- @help_window.set_text(text)
- update_required
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def upgrade_skill(skill,have,sklna,gold,sklp)
- if have
- @actor.increase_skill_proficiency(skill.database_id, false)
- text = Skill_Upgrade.upgrade(skill,sklna)
- else
- @actor.learn_skill(skill.database_id)
- text = Skill_Upgrade.learn(skill,sklna)
- end
- @help_window.set_text(text)
- update_required
- @actor.skill_points -= sklp if sklp != nil
- $game_party.lose_gold(gold) if gold != nil
- @data_window.refresh
- @small_window.refresh
- @status_window.refresh
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update_required(time=60)
- time.times do
- Graphics.update
- if $D13x[:Scene_BGs]
- @bks.each { |i| i.update }
- end # if $D13x[:Scene_BGs]
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def leave_skill
- @command_window.deactivate
- @command_window.select(-1)
- update_can_buy_info(true)
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def on_actor_change
- @small_window.actor = @actor
- @main_window.actor = @actor
- @data_window.actor = @actor
- @SUG_window.actor = @actor
- @status_window.actor = @actor
- end
- end
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
- end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement