IceDragon200

IEO011 - SkillLevelSystem V1_4

Nov 22nd, 2011
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 107.01 KB | None | 0 0
  1. #==============================================================================#
  2. # ** IEO(Icy Engine Omega) - Skill Level System
  3. #-*--------------------------------------------------------------------------*-#
  4. # ** Author        : IceDragon (http://www.rpgmakervx.net/)
  5. # ** Script-Status : Change (Skills)
  6. # ** Script Type   : Skill Modifier
  7. # ** Date Created  : 02/24/2011
  8. # ** Date Modified : 10/01/2011
  9. # ** Script Tag    : IEO-011(Skill Level System)
  10. # ** Difficulty    : Medium, Hard, Lunatic
  11. # ** Version       : 1.4
  12. # ** IEO ID        : 011
  13. #-*--------------------------------------------------------------------------*-#
  14. #==============================================================================#
  15. # ** CREDITS/USED STUFF/EDITING
  16. #-*--------------------------------------------------------------------------*-#
  17. # You may:
  18. # Edit and Adapt this script as long you credit aforementioned author(s).
  19. #
  20. # You may not:
  21. # Claim this as your own work, or redistribute without the consent of the author.
  22. #
  23. #------------------------------------------------------------------------------#
  24. #==============================================================================#
  25. # ** INTRODUCTION
  26. #-*--------------------------------------------------------------------------*-#
  27. # Huh? *Stares* Ohh your waiting for the intro.. Geez... Can't I get some rest!
  28. # Okay here we go...
  29. #
  30. # IEO Script ID 011 - Skill Level System
  31. # Based off an old idea I had when using GTBS, basically what this does is
  32. # modify an existing skill and changing something on it, like the base damage,
  33. # animation, scope etc.
  34. # As with any IEO script, this is a very hard script to use.
  35. #
  36. # You can jump to the customization sections using these
  37. # IEO011-Primary
  38. # IEO011-Secondary
  39. # IEO011-Lunatic
  40. # Though I encourage reading everything.
  41. #------------------------------------------------------------------------------#
  42. #==============================================================================#
  43. # ** INSTRUCTIONS
  44. #-*--------------------------------------------------------------------------*-#
  45. # Script Calls
  46. # *--------------------------------------------------------------------------* #
  47. # You can call the SkillForge scene with 1 on the following
  48. # In a event's script call
  49. # skill_forge(actor_index, lock_upgrade)
  50. # Setting lock_upgrade as nil will use the $game_system.can_upgrade_skills
  51. # value instead.
  52. # EG.
  53. # skill_forge(0, false)
  54. # skill_forge(4, true)
  55. #
  56. # $scene = Scene_SkillForge.new(actor_index, [lock_upgrade, [return_type, [return_index]]])
  57. # return_type s
  58. #   :map
  59. #   :menu
  60. #
  61. # *--------------------------------------------------------------------------* #
  62. # You can enable/disable the skill uprade with
  63. # $game_system.can_upgrade_skills
  64. # EG:
  65. # $game_system.can_upgrade_skills = true
  66. # $game_system.can_upgrade_skills = false
  67. #
  68. # *--------------------------------------------------------------------------* #
  69. # Place these "tags" in inside there respective noteboxes
  70. # *--------------------------------------------------------------------------* #
  71. # Item/Skill Notetags
  72. # *--------------------------------------------------------------------------* #
  73. # <skl_p: +/-x> (or) <skl p: +/-x>
  74. #   This sets the skill point distribution for the item/skill by x
  75. #   Positive values increase points, while negative decreases.
  76. #
  77. # EG:
  78. # <skl_p: +24>
  79. #
  80. # *--------------------------------------------------------------------------* #
  81. # Skill Notetags
  82. # *--------------------------------------------------------------------------* #
  83. # <perlevel phrase: change> (or) <atlevel(x) phrase: change>
  84. #   perlevel will cause a set change to occur each for each level of the skill.
  85. #   atlevel will allow you set whatever value at level (x) for the skill.
  86. #   Replace phrase with one of the following
  87. #     name
  88. #     cost
  89. #     subcost (with IEO003(CustomSkillCosts) 1.2)
  90. #     basedamage
  91. #     atk_f
  92. #     spi_f
  93. #     variance
  94. #     speed
  95. #     hit
  96. #     scope
  97. #     anim_id
  98. #     icon_index
  99. #     state_plus*
  100. #     state_minus*
  101. #     element*
  102. #
  103. #   NOTE* "name", "scope", "anim_id", "icon_index", "state_plus", "state_minus"
  104. #         and "element" are unaffected by "perlevel"
  105. #   NOTE* "state_plus", "state_minus", "element"
  106. #        <atleveln element: +2, -4, 1>
  107. #         The + operator will add the state/element to the current set
  108. #         The - operator will remove the state/element from the current set
  109. #         In other words, if your element set for the skill was:
  110. #         [4, 6, 8]
  111. #         After the operation:
  112. #         [2, 6, 8]
  113. #         1 was ignored because it had no forward operator.
  114. #   NOTE "atlevel" will cause any level above it to obtain its changes
  115. #        Meaning if you changed the scope at level 2, the scope will be kept
  116. #        for levels 3, 4, 5, etc.. But level 1 and 0 will have there originals.
  117. #
  118. #   Replace change with one of the following formats
  119. #     +/-x%
  120. #     x%
  121. #     +/-x
  122. #     x
  123. #   NOTE* "atk_f", "spi_f", "variance", "hit" Try to keep these positive.
  124. #
  125. # EG:
  126. #   <perlevel basedamage: +200>
  127. #   <perlevel atk_f: +10%>
  128. #   <perlevel cost: 1>
  129. #   <atlevel2 cost: 10>
  130. #   <atlevel5 scope: 9>
  131. #   <atlevel3 anim_id: 100>
  132. # # //
  133. # *--------------------------------------------------------------------------* #
  134. # 1.2
  135. # *--------------------------------------------------------------------------* #
  136. # Listing:
  137. #   <perlevel>
  138. #   basedamage: +10%
  139. #   cost: +10
  140. #   </perlevel>
  141. #  
  142. #   <atlevel2>
  143. #   scope: 9
  144. #   anim_id: 101
  145. #   name: Fire III
  146. #   </atlevel>
  147. # *--------------------------------------------------------------------------* #
  148. # <maxlevel: x>
  149. #   This sets the skills maximum level(x).
  150. #
  151. # EG:
  152. #   <maxlevel: 2>
  153. #   <maxlevel: 90>
  154. #
  155. # *--------------------------------------------------------------------------* #
  156. # <no edit>
  157. #   This prevents the skill from being changed, or gaining levels
  158. #
  159. # *--------------------------------------------------------------------------* #
  160. # <level cost x: y>
  161. #    This allows you to overwrite the level(x) cost(y)
  162. # NOTE* You must use this tag, AFTER you have changed the maxlevel, else the
  163. #       changes will be lost.
  164. #
  165. # EG:
  166. #   <level cost 2: 200>
  167. #   <level cost 4: 1200>
  168. #
  169. # *--------------------------------------------------------------------------* #
  170. # Enemy Notetags
  171. # *--------------------------------------------------------------------------* #
  172. # <skl_p: x> (or) <skl p: x>
  173. #   This sets the skill point distribution for the enemy by x
  174. # NOTE* This value can change during the game, from the skl_p_gain method.
  175. #
  176. # EG:
  177. #   <skl_p: 60>
  178. #
  179. #------------------------------------------------------------------------------#
  180. #==============================================================================#
  181. # ** COMPATABLITIES
  182. #-*--------------------------------------------------------------------------*-#
  183. #
  184. # Well has only been tested with the DBS.
  185. #
  186. #------------------------------------------------------------------------------#
  187. #==============================================================================#
  188. # ** INSTALLATION
  189. #-*--------------------------------------------------------------------------*-#
  190. # To install this script, open up your script editor and copy/paste this script
  191. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  192. #
  193. #-*--------------------------------------------------------------------------*-#
  194. # Below
  195. #   Materials
  196. #   CBS
  197. #  
  198. # Above
  199. #   Main
  200. #  
  201. #------------------------------------------------------------------------------#
  202. #==============================================================================#
  203. # ** CHANGES
  204. #-*--------------------------------------------------------------------------*-#
  205. # Classes
  206. #   RPG::Item
  207. #     new-method :ieo011_itemcache
  208. #   RPG::Skill
  209. #     new-method :change_skill_cost
  210. #     new-method :skillcache_set
  211. #     new-method :ieo011_skillcache
  212. #     new-method :ieo011_rebuild_levelcosts
  213. #     new-method :ieo011_build_level0_cache
  214. #     new-method :ieo011_build_mainsklcaches
  215. #     new-method :level_up
  216. #     new-method :level_down
  217. #     new-method :change_level
  218. #     new-method :skl_nextlevelcost
  219. #     new-method :get_nextlevel
  220. #     new-method :change_exp
  221. #     new-method :exp=
  222. #     new-method :next_exp
  223. #     new-method :level_exp
  224. #   RPG::Enemy
  225. #     new-method :ieo011_enemycache
  226. #   Game_System
  227. #     alias      :initialize
  228. #   Game_BattleAction
  229. #     alias      :clear
  230. #     alias      :set_skill
  231. #     new-method :assign_skl_skill
  232. #     overwrite  :skill
  233. #   Game_Battler
  234. #     alias      :skill_effect
  235. #     alias      :item_effect
  236. #   Game_Enemy
  237. #     alias      :initialize
  238. #     new-method :skl_p_limit
  239. #     new-method :skl_p
  240. #     new-method :skl_p=
  241. #   Game_Actor
  242. #     alias      :setup
  243. #     new-method :create_skl_skills
  244. #     new-method :match_skl_skill_to_id
  245. #     new-method :skl_p_limit
  246. #     new-method :skl_p
  247. #     new-method :skl_p=
  248. #     new-method :can_upgrade_skill?
  249. #     new-method :upgrade_skill
  250. #     overwrite  :learn_skill
  251. #     overwrite  :skills
  252. #     alias      :skill_can_use?
  253. #   Game_Troop
  254. #     new-method :distribute_skl_p
  255. #   Window_Base
  256. #     new-method :draw_actor_skl_p
  257. #     new-method :draw_skl_p
  258. #   Window_Skill
  259. #     new-method :draw_obj_name
  260. #     new-method :draw_obj_level
  261. #     overwrite  :draw_item
  262. #     new-method :enabled?
  263. #   Scene_Title
  264. #     alias      :load_database
  265. #     alias      :load_bt_database
  266. #     new-method :load_ieo011_cache
  267. #   *Scene_File (Only in SKLMODE 3)
  268. #     alias      :write_save_data
  269. #     alias      :read_save_data
  270. #   Scene_Battle
  271. #     new-method :perform_skl_p_gain
  272. #     alias      :execute_action_attack
  273. #     alias      :execute_action_guard
  274. #     alias      :execute_action_skill
  275. #     alias      :execute_action_item
  276. #     alias      :battle_end
  277. #
  278. #------------------------------------------------------------------------------#
  279. #==============================================================================#
  280. # ** CHANGE LOG
  281. #-*--------------------------------------------------------------------------*-#
  282. # (DD/MM/YYYY)
  283. #  02/26/2011 - V1.0  Finished Script
  284. #  05/13/2011 - V1.0  Code rearrangement
  285. #  05/14/2011 - V1.0  Minor Code Edits
  286. #  06/01/2011 - V1.1  Major Bug Fix regarding the EXP Skill Mode
  287. #  06/30/2011 - V1.2  Added Listing (So you can now use <atlevel2> and list the changes)
  288. #  08/29/2011 - V1.3  Added Skill Level Struct (Increased performance)
  289. #  10/01/2011 - V1.4  Rearranged Code, added MIXES
  290. #
  291. #------------------------------------------------------------------------------#
  292. #==============================================================================#
  293. # ** KNOWN ISSUES
  294. #------------------------------------------------------------------------------#  
  295. #
  296. #  Skills may not work correctly outside of the DBS and default scenes.
  297. #
  298. #------------------------------------------------------------------------------#
  299. #==============================================================================#
  300. # $imported - Is mostly used by Japanese RPG Maker XP/VX scripters.
  301. #             This acts as a flag, or signal to show that "x" script is present.
  302. #             This is used for compatability with other future scripts.
  303. ($imported ||= {})["IEO-SkillLevelSystem"] = true
  304. #==============================================================================#
  305. # $ieo_script - This is a hash specific to IEO scripts
  306. #               they work just like the $imported, but there key is slightly
  307. #               different, it is an array conatining an integer
  308. #               and a string, since IEO script all have an ID, the value
  309. #               is the scripts version number.
  310. #               A version number of nil, or 0 means the script isn't present
  311. # EG. $ieo_script[[ScriptID, "ScriptName"]]
  312. ($ieo_script ||= {})[[11, "SkillLevelSystem"]] = 1.3
  313. #-*--------------------------------------------------------------------------*-#
  314. #==============================================================================#
  315. #==============================================================================#
  316. # ** IEO::SKILL_LEVEL - IEO011-Primary
  317. #==============================================================================#
  318. module IEO
  319.   module SKILL_LEVEL
  320. #==============================================================================#
  321. #                      Start Primary Customization
  322. #------------------------------------------------------------------------------#
  323. #==============================================================================#    
  324.    
  325.   #--------------------------------------------------------------------------#
  326.   # * ONSTART_UPGRADE
  327.   #--------------------------------------------------------------------------#
  328.   # Should the skill upgrade feature be active on newgame?
  329.   # You can change this later with
  330.   # $game_system.can_upgrade_skills
  331.   # EG : $game_system.can_upgrade_skills = true
  332.   #--------------------------------------------------------------------------#
  333.     ONSTART_UPGRADE = true
  334.  
  335.   #--------------------------------------------------------------------------#
  336.   # * SKILL_MODE
  337.   #--------------------------------------------------------------------------#
  338.   # This sets the skill levelling mode
  339.   # 0 - Point based, players will buy the skill's level
  340.   # 1 - Exp Based, skills will gain exp on use, and level accordingly
  341.   #--------------------------------------------------------------------------#
  342.     SKILL_MODE = 1
  343.    
  344.   #--------------------------------------------------------------------------#
  345.   # * SLIDY_WINDOWS
  346.   #--------------------------------------------------------------------------#
  347.   # This only works if IEX_SceneActions is present
  348.   #--------------------------------------------------------------------------#  
  349.     SLIDY_WINDOWS   = true
  350.    
  351.     module_function # DO NOT REMOVE
  352.     #--------------------------------------------------------------------------#
  353.     # skl_p_limit
  354.     #--------------------------------------------------------------------------#
  355.     # This method is called ONCE, at start up for each actor, enemies will
  356.     # be setup as they are needed.
  357.     # This will set there skl_p limit
  358.     #--------------------------------------------------------------------------#
  359.     def skl_p_limit( battler )
  360.       return 5000
  361.     end
  362.    
  363.     #--------------------------------------------------------------------------#
  364.     # level_cost
  365.     #--------------------------------------------------------------------------#
  366.     # This is used to calculate the default skl_p growth for skills per level
  367.     #--------------------------------------------------------------------------#
  368.     def level_cost( skill, level )
  369.       return Integer( (level*10) + (level*16) )
  370.     end
  371.    
  372.     #--------------------------------------------------------------------------#
  373.     # skl_p_gain
  374.     #--------------------------------------------------------------------------#
  375.     # This method is called from battle and battlers when a skill/item effect
  376.     # is done.
  377.     #--------------------------------------------------------------------------#
  378.     def skl_p_gain( type, target, obj = nil, user = nil )
  379.       result = 0
  380.       case type
  381.       # ---------------------------------------------------------------------- #
  382.       when :attack # type and battler are valid
  383.         result = 5
  384.         result += rand( 10 )
  385.       # ---------------------------------------------------------------------- #
  386.       when :guard # type and battler are valid
  387.         result = 2
  388.         result += rand( 10 )
  389.       # ---------------------------------------------------------------------- #  
  390.       when :skill # type and battler are valid
  391.         result = ( target.action.skill.skl_level+1 ) * 2 unless target.action.skill.nil?()
  392.         result += rand( 10 )
  393.       # ---------------------------------------------------------------------- #  
  394.       when :item # type and battler are valid
  395.         result = 10
  396.         result += rand( 10 )
  397.       # ---------------------------------------------------------------------- #  
  398.       when :use # type, battler, obj, user are all valid
  399.         result = obj.skl_p + 15
  400.         if SKILL_MODE == 1 and obj.is_a?( RPG::Skill ) # // If skill mode is exp
  401.           obj.skl_exp += result if obj.skl_skill?() # // if skill is a valid skill level
  402.         end  
  403.       # ---------------------------------------------------------------------- #  
  404.       end  
  405.       # ---------------------------------------------------------------------- #
  406.       target.skl_p += result
  407.       # ---------------------------------------------------------------------- #
  408.       return result # Doesn't do anything really, but just for the sake of it
  409.     end  
  410.    
  411.     # // Exp Level Mode only
  412.     #--------------------------------------------------------------------------#
  413.     # skill_exp_max
  414.     #--------------------------------------------------------------------------#
  415.     # This method is used to set the maximum_exp obtainable by a skill
  416.     #--------------------------------------------------------------------------#
  417.     def skill_exp_max( skill )
  418.       result = skill.skl_exp_list[skill.skl_maxlevel] + 10
  419.       return result
  420.     end
  421.    
  422.     #--------------------------------------------------------------------------#
  423.     # skill_explist
  424.     #--------------------------------------------------------------------------#
  425.     # Used to create the explist for skills
  426.     #--------------------------------------------------------------------------#
  427.     def skill_explist( skill )
  428.       lmax = skill.skl_maxlevel
  429.       result = Array.new( lmax+1 ).map! { 0 }
  430.       result[0] = result[lmax+1] = 0
  431.       exp_basis     = skill.skl_exp_basis # 50 # 15
  432.       exp_inflation = skill.skl_exp_inflation # 40 # 20
  433.       m = exp_basis
  434.       n = 0.75 + exp_inflation / 200.0;
  435.       for i in 2..lmax
  436.         result[i] = result[i-1] + Integer(m) #Integer( (i*50) ) #+(10.0+rand(20))*0.7) # //
  437.         m *= 1 + n;
  438.         n *= 0.9;
  439.       end
  440.       return result.clone()
  441.     end  
  442.    
  443. #==============================================================================#
  444. #                        End Primary Customization
  445. #------------------------------------------------------------------------------#
  446. #==============================================================================#    
  447.   end
  448. end
  449.  
  450. #==============================================================================#
  451. # ** IEO::Vocab - IEO011-Secondary
  452. #==============================================================================#
  453. module IEO
  454.   module Vocab
  455. #==============================================================================#
  456. #                      Start Secondary Customization
  457. #------------------------------------------------------------------------------#
  458. #==============================================================================#    
  459.     module_function # DO NOT REMOVE
  460.    
  461.     #--------------------------------------------------------------------------#
  462.     # scope
  463.     #--------------------------------------------------------------------------#
  464.     def scope( num )
  465.       case num
  466.       when 0  ; return "No Target"        # (0:  None)
  467.       when 1  ; return "1 Enemy"          # (1:  One Enemy)
  468.       when 2  ; return "All Enemies"      # (2:  All Enemies)
  469.       when 3  ; return "Dual Enemy"       # (3:  One Enemy Dual)
  470.       when 4  ; return "1 Random Enemy"   # (4:  One Random Enemy)
  471.       when 5  ; return "2 Random Enemies" # (5:  2 Random Enemies)  
  472.       when 6  ; return "3 Random Enemies" # (6:  3 Random Enemies)
  473.       when 7  ; return "1 Ally"           # (7:  One Ally)
  474.       when 8  ; return "All Allies"       # (8:  All Allies)  
  475.       when 9  ; return "Dead Ally"        # (9:  One Ally (Dead))  
  476.       when 10 ; return "Dead Allies"      # (10: All Allies (Dead))  
  477.       when 11 ; return "User"             # (11: The User)  
  478.       else    ; return ""
  479.       end  
  480.     end
  481.    
  482.     module SKILL_LEVEL
  483.    
  484.       LEVEL_SUB     = "%s %d/%d"
  485.       NEXT_COST_SUB = "%s%d Cost"
  486.      
  487.       HIT           = "Hit"
  488.       HEAL          = "Heal"
  489.       VARIANCE      = "Variance"
  490.       DAMAGE        = "Damage"
  491.       ACTION_SPEED  = "Speed"
  492.       ATK_F         = "ATK Rate"
  493.       SPI_F         = "SPI Rate"
  494.        
  495.       ADD_STATE     = "Add State:"
  496.       MINUS_STATE   = "Minus State:"
  497.      
  498.       LEVEL_MAX     = "MAX"
  499.      
  500.     end
  501. #==============================================================================#
  502. #                        End Secondary Customization
  503. #------------------------------------------------------------------------------#
  504. #==============================================================================#    
  505.   end  
  506. end  
  507.  
  508. #==============================================================================#
  509. # ** RPG::Skill - IEO011-Lunatic
  510. #==============================================================================#
  511. class RPG::Skill
  512. #==============================================================================#
  513. #                      Start Lunatic Customization
  514. #------------------------------------------------------------------------------#
  515. #==============================================================================#    
  516.   #--------------------------------------------------------------------------#
  517.   # change_skill_cost - This is used to properly do changes to
  518.   # skill costs, this is mostly for compatability with IEO-003(Custom Skill Costs)
  519.   #--------------------------------------------------------------------------#
  520.   def change_skill_cost( oldcost, ratecost )
  521.     # ---------------------------------------------------------------------- #
  522.     return oldcost if ratecost.nil?()
  523.     # ---------------------------------------------------------------------- #
  524.     result = oldcost
  525.     # ---------------------------------------------------------------------- #
  526.     case result
  527.     # ---------------------------------------------------------------------- #
  528.     when /(\d+)[ ](MP|SP)/i
  529.       val = IEO::SKILL_LEVEL.change_numeric_value( $1.to_i, ratecost )
  530.       result = sprintf( "%d %s", val, $2 )
  531.     # ---------------------------------------------------------------------- #
  532.     when /(\d+)([%%])[ ](MP|SP|MAXMP|MAXSP)/i  
  533.       val = IEO::SKILL_LEVEL.change_numeric_value( $1.to_i, ratecost )
  534.       result = sprintf( "%d%s %s", val, $2, $3 )
  535.     # ---------------------------------------------------------------------- #  
  536.     when /(\d+)[ ](HP|LP)/i
  537.       val = IEO::SKILL_LEVEL.change_numeric_value( $1.to_i, ratecost )
  538.       result = sprintf( "%d %s", val, $2 )
  539.     # ---------------------------------------------------------------------- #  
  540.     when /(\d+)([%%])[ ](HP|LP|MAXHP|MAXLP)/i  
  541.       val = IEO::SKILL_LEVEL.change_numeric_value( $1.to_i, ratecost )
  542.       result = sprintf( "%d%s %s", val, $2, $3 )
  543.     # ---------------------------------------------------------------------- #  
  544.     when /ITEM[ ](\d+):(\d+)/i
  545.       iid = $1.to_i
  546.       val = IEO::SKILL_LEVEL.change_numeric_value( $2.to_i, ratecost )
  547.       result = sprintf( "ITEM %d:%d", iid, val )
  548.     end  
  549.     # ---------------------------------------------------------------------- #
  550.     return result
  551.     # ---------------------------------------------------------------------- #
  552.   end
  553. #==============================================================================#
  554. #                        End Lunatic Customization
  555. #------------------------------------------------------------------------------#
  556. #==============================================================================#  
  557. end
  558.  
  559. #==============================================================================#
  560. # ** IEO::Icon
  561. #==============================================================================#
  562. module IEO
  563.   module Icon
  564.    
  565.     module_function()
  566.    
  567.     def stat( cstat ) ; return 0 end      
  568.     def scope( num )  ; return 0 end
  569.      
  570.   end  
  571. end  
  572.  
  573. #==============================================================================#
  574. # ** IEO::REGEXP::SKILL_LEVEL
  575. #==============================================================================#
  576. module IEO
  577.   module REGEXP
  578.     module SKILL_LEVEL
  579.       module BASE
  580.         PER_P = /([\+\-]\d+)([%%])/i # Per Percent
  581.         SET_P = /(\d+)([%%])/i       # Set Percent
  582.         PER_S = /([\+\-]\d+)/i        # Per Set
  583.       end  
  584.       module ITEM
  585.         SKL_P = /<(?:SKL_P|skl p):[ ]*([\+\-]\d+)>/i
  586.       end  
  587.       module SKILL
  588.         LEVELMOD = /<(PERLEVEL|ATLEVEL.*)[ ](.*):[ ]*(.*)>/i
  589.         MAXLEVEL = /<(?:MAXLEVEL|MAX_LEVEL|MAX LEVEL):[ ]*(\d+)>/i
  590.         NOEDIT   = /<(?:NOTEDITABLE|NOT_EDITABLE|NOT EDITABLE|NOEDIT|NO_EDIT|NO EDIT)>/i
  591.         LEVELCOST= /<(?:LEVELCOST|LEVEL_COST|LEVEL COST)[ ](\d+):[ ]*(\d+)>/i
  592.        
  593.         LEVELMOD_SET  = /<(ATLEVEL.*)>/i
  594.         LEVELMOD_SET2 = /<\/ATLEVEL>/i
  595.         PERLEVEL_SET  = /<PERLEVEL>/i
  596.         PERLEVEL_SET2 = /<\/PERLEVEL>/i
  597.        
  598.         EXP_BASIS     = /<(EXP_BASIS|EXPBASIS|EXP BASIS):[ ]*(\d+)>/i
  599.         EXP_INFLATE   = /<(EXP_INFLATE|EXPINFLATE|EXP INFLATE):[ ]*(\d+)>/i
  600.       end
  601.       module ENEMY
  602.         SKL_P = /<(?:SKL_P|skl p):[ ]*(\d+)>/i
  603.       end
  604.     end
  605.   end
  606. end
  607.  
  608. #==============================================================================#
  609. # ** IEO::SKILL_LEVEL
  610. #==============================================================================#
  611. module IEO
  612.   module SKILL_LEVEL
  613.    
  614.     module_function()
  615.    
  616.     #--------------------------------------------------------------------------#
  617.     # * change_numeric_value
  618.     #--------------------------------------------------------------------------#
  619.     def change_numeric_value( oldvalue, mod )
  620.       return oldvalue if mod.nil?()
  621.       result = oldvalue
  622.       # ---------------------------------------------------------------------- #
  623.       case mod
  624.       when IEO::REGEXP::SKILL_LEVEL::BASE::PER_P  
  625.         result+= result * $1.to_i / 100
  626.       when IEO::REGEXP::SKILL_LEVEL::BASE::SET_P  
  627.         result = result * $1.to_i / 100
  628.       when IEO::REGEXP::SKILL_LEVEL::BASE::PER_S  
  629.         result+= $1.to_i
  630.       else      
  631.         result = mod.to_i
  632.       end  
  633.       # ---------------------------------------------------------------------- #
  634.       return Integer( result )
  635.     end
  636.    
  637.     #--------------------------------------------------------------------------#
  638.     # * dup_skill # // Used by SKLMODE 3
  639.     #--------------------------------------------------------------------------#
  640.     def dup_skill( skill_id )
  641.       new_id = $data_skills.size
  642.       $data_skills[new_id] = $data_skills[skill_id].deep_clone
  643.       $data_skills[new_id].id = new_id
  644.       return $data_skills[new_id]
  645.     end
  646.    
  647.     # // Uses a has for the skills instead of an array, increases performance
  648.     # // But can't use multiple same skills
  649.     # // 0 - Unsorted Array, 1 - Hash, 2 - Sorted Array, 3 - Dup Skill Array ($data_skills)
  650.     SKLMODE       = 2
  651.     LEVELPULLMODE = true
  652.    
  653.   end
  654. end
  655.  
  656. #==============================================================================#
  657. # ** IEO::SKILL_LEVEL::Level_Struct
  658. #==============================================================================#
  659. class IEO::SKILL_LEVEL::Level_Struct
  660.  
  661.   #--------------------------------------------------------------------------#
  662.   # * Constant(s)
  663.   #--------------------------------------------------------------------------#
  664.   (ATTRS = [:name, :cost, :subcost, :base_damage, :variance, :speed, :hit_ratio,
  665.            :spi_f, :atk_f, :scope, :anim_id, :icon_index,
  666.            :state_add, :state_rem, :elements]).each { |at|
  667.     attr_accessor at
  668.   }
  669.  
  670.   #--------------------------------------------------------------------------#
  671.   # * new-method :initialize
  672.   #--------------------------------------------------------------------------#
  673.   def initialize()
  674.     ATTRS.each { |a| instance_variable_set( "@#{a.to_s}", nil ) }
  675.   end
  676.  
  677.   #--------------------------------------------------------------------------#
  678.   # * new-method :attributes
  679.   #--------------------------------------------------------------------------#
  680.   def attributes() ; return ATTRS ; end
  681.  
  682.   #--------------------------------------------------------------------------#
  683.   # * new-method :[]
  684.   #--------------------------------------------------------------------------#
  685.   def []( value ) ; return self.send( value ) ; end
  686.  
  687.   #--------------------------------------------------------------------------#
  688.   # * new-method :[]=
  689.   #--------------------------------------------------------------------------#
  690.   def []=( value, set_value )
  691.     return self.send( value.to_s+"=", set_value )
  692.   end
  693.  
  694.   #--------------------------------------------------------------------------#
  695.   # * overwrite-method :to_s
  696.   #--------------------------------------------------------------------------#
  697.   def to_s()
  698.     return attributes.inject("") { |r, e| r + %Q(\n<#{e} = "#{self[e]}"/>) }
  699.   end
  700.  
  701. end  
  702.  
  703. #==============================================================================#
  704. # ** IEO::SKILL_LEVEL::WIN_BASE
  705. #==============================================================================#
  706. module IEO::SKILL_LEVEL::WIN_BASE
  707.   INCL = %Q(
  708.   #--------------------------------------------------------------------------#
  709.   # * Draw Actor Skill Points
  710.   #     actor : Actor
  711.   #     rect  : Rect
  712.   #--------------------------------------------------------------------------#
  713.   def draw_actor_skl_p( actor, crect )
  714.     draw_skl_p( actor.skl_p, crect )
  715.   end
  716.  
  717.   #--------------------------------------------------------------------------#
  718.   # * Draw Skill Points
  719.   #     points: Points
  720.   #     rect  : Rect
  721.   #--------------------------------------------------------------------------#
  722.   def draw_skl_p( points, crect )
  723.     self.contents.font.size = 14
  724.     draw_icon( IEO::Icon.stat(:skl_p), crect.x+crect.width-32, crect.y )
  725.     crect.y -= 4 ; crect.width -= 34
  726.     self.contents.draw_text( crect, points, 2 )
  727.   end
  728.  
  729.   #--------------------------------------------------------------------------#
  730.   # * new-method :draw_obj_name
  731.   #--------------------------------------------------------------------------#
  732.   def draw_obj_name( obj, rect, enabled )
  733.     draw_icon( obj.icon_index, rect.x, rect.y, enabled )
  734.     self.contents.font.size = 16 #Font.default_size
  735.     self.contents.font.color = normal_color
  736.     self.contents.font.color.alpha = enabled ? 255 : 128
  737.     rect.width -= 48
  738.     self.contents.draw_text( rect.x+24, rect.y-4, rect.width-24, WLH, obj.name )
  739.     return self.contents.text_size( obj.name )
  740.   end
  741.  
  742.   #--------------------------------------------------------------------------#
  743.   # * new-method :draw_obj_level
  744.   #--------------------------------------------------------------------------#  
  745.   def draw_obj_level( obj, rect, align=0, enabled=true )
  746.     rect.width -= 8
  747.     self.contents.font.size = 12
  748.     self.contents.font.color = normal_color
  749.     self.contents.font.color.alpha = enabled ? 255 : 128
  750.     text = sprintf( "%s%d", Vocab.level_a, obj.skl_level )
  751.     self.contents.draw_text( rect, text, align )
  752.   end
  753.   )
  754. end
  755.  
  756. #==============================================================================#
  757. # ** IEO::SKILL_LEVEL::WIN_SKILL
  758. #==============================================================================#  
  759. module IEO::SKILL_LEVEL::WIN_SKILL
  760.   INCL = %Q(
  761.   #--------------------------------------------------------------------------#
  762.   # * overwrite-method :draw_item
  763.   #--------------------------------------------------------------------------#
  764.   def draw_item( index )
  765.     rect = item_rect( index )
  766.     self.contents.clear_rect( rect )
  767.     skill = @data[index]
  768.     return if skill == nil
  769.     enabled = enabled?( skill )
  770.     rect2 = rect.clone
  771.     rect2.x += 28; rect2.y += 14 ; rect2.height = 8 ; rect2.width /= 3
  772.    
  773.     #draw_grad_bar
  774.     draw_round_grad_bar( rect2.clone, skill.skl_unlocklevel, skill.skl_maxlevel,
  775.       normal_color, Color.new(200, 200, 200), Color.new(20, 20, 20),
  776.       2, enabled )
  777.     draw_round_grad_bar( rect2.clone, skill.skl_level, skill.skl_maxlevel,
  778.       mp_gauge_color1, mp_gauge_color2, Color.new(20, 20, 20),
  779.       2, enabled )
  780.     # //  
  781.     if IEO::SKILL_LEVEL::SKILL_MODE == 1  
  782.       rect2.x += rect2.width+16 ; rect2.width -= 16  
  783.       bc = skill.level_skl_exp() ; bm = skill.next_skl_expr()
  784.       if bm > 0 && !skill.unlocked_level?( skill.skl_maxlevel )
  785.         draw_grad_bar( rect2.clone(), bc, bm,
  786.           hp_gauge_color1(), hp_gauge_color2(), Color.new( 20, 20, 20 ),
  787.           2, enabled )
  788.       end    
  789.       rect2.height = WLH  ; rect2.y -= 16
  790.     end    
  791.     te = draw_obj_name( skill, rect.clone(), enabled )
  792.     rect2 = rect.clone
  793.     rect2.y -= 6 ; rect2.height = WLH ; rect2.x += te.width+28
  794.     draw_obj_level( skill, rect2.clone(), 0, enabled )  
  795.     if $imported["IEO-CustomSkillCosts"]
  796.       draw_obj_cost( skill, rect.clone(), enabled )
  797.     else
  798.       rect.width -= 8 ; self.contents.draw_text( rect.clone(), skill.mp_cost, 2 )
  799.     end  
  800.   end
  801.  
  802.   #--------------------------------------------------------------------------
  803.   # * new-method :enabled?
  804.   #--------------------------------------------------------------------------
  805.   def enabled?( skill )
  806.     return false if skill.nil?()
  807.     return false unless skill.editable if $scene.is_a?( Scene_SkillForge )
  808.     return @actor.skill_can_use?( skill )
  809.   end
  810.   )
  811. end
  812.  
  813. #==============================================================================#
  814. # ** IEO::SKILL_LEVEL::MIXES
  815. #==============================================================================#
  816. module IEO::SKILL_LEVEL::MIXES ; end
  817. #==============================================================================#
  818. # ** IEO::SKILL_LEVEL::MIXES::Item
  819. #==============================================================================#
  820. module IEO::SKILL_LEVEL::MIXES::Item
  821.  
  822.   #--------------------------------------------------------------------------#
  823.   # * Public Instance Variables
  824.   #--------------------------------------------------------------------------#
  825.   attr_accessor :skl_p
  826.  
  827.   #--------------------------------------------------------------------------#
  828.   # * new-method :ieo011_itemcache
  829.   #--------------------------------------------------------------------------#
  830.   def ieo011_itemcache()
  831.     @skl_p = 0
  832.     # ---------------------------------------------------------------------- #
  833.     self.note.split(/[\r\n]+/).each { |line|
  834.       case line
  835.     # ---------------------------------------------------------------------- #
  836.       when IEO::REGEXP::SKILL_LEVEL::ITEM::SKL_P
  837.         @skl_p = $1.to_i
  838.       end
  839.     }
  840.     # ---------------------------------------------------------------------- #
  841.     @ieo011_itemcache_complete = true
  842.     # ---------------------------------------------------------------------- #
  843.   end
  844.  
  845. end
  846.  
  847. #==============================================================================#
  848. # ** IEO::SKILL_LEVEL::MIXES::Skill
  849. #==============================================================================#
  850. module IEO::SKILL_LEVEL::MIXES::Skill
  851.  
  852.   #--------------------------------------------------------------------------#
  853.   # * Public Instance Variables
  854.   #--------------------------------------------------------------------------#
  855.   attr_accessor :original_id
  856.   attr_accessor :editable
  857.   attr_accessor :skl_skill       # Is this an skl_skill?
  858.   attr_accessor :skl_level
  859.   attr_accessor :skl_maxlevel
  860.   attr_accessor :skl_atlevelmod
  861.   attr_accessor :skl_perlevelmod
  862.   attr_accessor :skl_levelcache
  863.   attr_accessor :skl_openlevels
  864.   attr_accessor :skl_levelcosts
  865.   attr_accessor :skl_unlocklevel
  866.   attr_accessor :skl_p
  867.  
  868.   attr_accessor :skl_exp_basis
  869.   attr_accessor :skl_exp_inflation
  870.  
  871.   attr_reader   :skl_exp
  872.   attr_reader   :skl_expmax
  873.   attr_reader   :skl_exp_list
  874.  
  875.   #--------------------------------------------------------------------------#
  876.   # * new-method :skl_skill?
  877.   #--------------------------------------------------------------------------#  
  878.   def skl_skill?()
  879.     @skl_skill = false if @skl_skill.nil?()
  880.     return @skl_skill
  881.   end  
  882.  
  883.   #--------------------------------------------------------------------------#
  884.   # * new-method :skillcache_set
  885.   #--------------------------------------------------------------------------#  
  886.   def skillcache_set( base, type, val )
  887.     config = []
  888.     case type.upcase()
  889.     when "NAME"
  890.       config = [:name, val]
  891.     when "COST"
  892.       config = [:cost, val]
  893.     when "SUBCOST"
  894.       config = [:subcost, val]  
  895.     when "BASE_DAMAGE", "BASEDAMAGE", "BASE DAMAGE"
  896.       config = [:base_damage, val]
  897.     when "ATK_F"  
  898.       config = [:atk_f, val]
  899.     when "SPI_F"  
  900.       config = [:spi_f, val]
  901.     when "VARIANCE"
  902.       config = [:variance, val]
  903.     when "SPEED"  
  904.       config = [:speed, val]
  905.     when "HITRATIO", "HIT_RATIO", "HIT RATIO", "HIT"
  906.       config = [:hit_ratio, val]
  907.     when "SCOPE"  
  908.       config = [:scope, val]
  909.     when "ANIM_ID", "ANIMID", "ANIM ID"  
  910.       config = [:anim_id, val]
  911.     when "ICONINDEX", "ICON_INDEX", "ICON INDEX", "ICON"
  912.       config = [:icon_index, val]
  913.     when "SADD", "STATE_PLUS", "STATEPLUS", "STATE PLUS"  
  914.       config = [:state_add, val]
  915.     when "SRMV", "STATE_MINUS", "STATEMINUS", "STATE MINUS"      
  916.       config = [:state_rem, val]
  917.     when "ELEMENT"  
  918.       config = [:element, val]
  919.     else
  920.       config = setup_skl_custom_type( type, val )
  921.       return if config.nil?()
  922.     end
  923.     # -------------------------------------------------------------------- #
  924.     case base.upcase()
  925.     when /ATLEVEL(.*)/i
  926.       v = $1
  927.       case v.upcase
  928.       when "(MAX)" ; lvl = @skl_maxlevel
  929.       else         ; lvl = v.to_i
  930.       end  
  931.       (@skl_atlevelmod[lvl] ||= { })[config[0]] = config[1]
  932.     when "PERLEVEL"
  933.       (@skl_perlevelmod[config[0]] ||= []) << config[1]
  934.     end
  935.   end  
  936.  
  937.   #--------------------------------------------------------------------------#
  938.   # * new-method :ieo011_skillcache
  939.   #--------------------------------------------------------------------------#
  940.   def ieo011_skillcache()
  941.     @original_id     = @id
  942.     @editable        = true
  943.     @skl_skill       = false
  944.     @skl_level       = 1
  945.     @skl_unlocklevel = 1
  946.     @skl_min_level   = 1
  947.     # ---------------------------------------------------------------------- #
  948.     @skl_maxlevel    = 5
  949.     @skl_atlevelmod  = { }
  950.     @skl_perlevelmod = { }
  951.     @skl_levelcosts  = { }
  952.     @skl_openlevels  = [ ]
  953.     @skl_p           = 0
  954.     # ---------------------------------------------------------------------- #
  955.     @skl_exp         = 0
  956.     # ---------------------------------------------------------------------- #
  957.     @skl_exp_basis   = 50
  958.     @skl_exp_inflation = 40
  959.     # ---------------------------------------------------------------------- #    
  960.     ieo011_rebuild_levelcosts()
  961.     # ---------------------------------------------------------------------- #
  962.     @cabase = ""
  963.     @level_caching = false
  964.     self.note.split(/[\r\n]+/).each { |line|
  965.       case line
  966.       when IEO::REGEXP::SKILL_LEVEL::SKILL::LEVELMOD_SET
  967.         @cabase = $1
  968.         @level_caching = true
  969.       when IEO::REGEXP::SKILL_LEVEL::SKILL::LEVELMOD_SET2
  970.         @cabase = ""
  971.         @level_caching = false
  972.       when IEO::REGEXP::SKILL_LEVEL::SKILL::PERLEVEL_SET
  973.         @cabase = "PERLEVEL"
  974.         @level_caching = true
  975.       when IEO::REGEXP::SKILL_LEVEL::SKILL::PERLEVEL_SET2
  976.         @cabase = ""
  977.         @level_caching = false
  978.     # ---------------------------------------------------------------------- #
  979.       when IEO::REGEXP::SKILL_LEVEL::SKILL::LEVELMOD
  980.         base = $1
  981.         type = $2
  982.         val  = $3
  983.         skillcache_set( base, type, val )
  984.     # ---------------------------------------------------------------------- #  
  985.       when IEO::REGEXP::SKILL_LEVEL::SKILL::MAXLEVEL
  986.         @skl_maxlevel = $1.to_i
  987.         ieo011_rebuild_levelcosts()
  988.     # ---------------------------------------------------------------------- #  
  989.       when IEO::REGEXP::SKILL_LEVEL::SKILL::NOEDIT
  990.         @editable = false
  991.     # ---------------------------------------------------------------------- #        
  992.       when IEO::REGEXP::SKILL_LEVEL::SKILL::LEVELCOST
  993.         @skl_levelcosts[$1.to_i] = $2.to_i
  994.     # ---------------------------------------------------------------------- #            
  995.       when IEO::REGEXP::SKILL_LEVEL::ITEM::SKL_P
  996.         @skl_p = $1.to_i  
  997.     # ---------------------------------------------------------------------- #                
  998.       when IEO::REGEXP::SKILL_LEVEL::SKILL::EXP_BASIS  
  999.         @skl_exp_basis = $1.to_i
  1000.     # ---------------------------------------------------------------------- #                
  1001.       when IEO::REGEXP::SKILL_LEVEL::SKILL::EXP_INFLATE
  1002.         @skl_exp_inflation = $1.to_i    
  1003.     # ---------------------------------------------------------------------- #            
  1004.       else
  1005.         if @level_caching
  1006.           case line
  1007.           when /(.*):[ ](.*)/i
  1008.             skillcache_set( @cabase, $1, $2 )
  1009.           end  
  1010.         end
  1011.       end  
  1012.     }
  1013.     # ---------------------------------------------------------------------- #
  1014.     ieo011_build_firstlevel_cache()
  1015.     ieo011_build_mainsklcaches()
  1016.     # ---------------------------------------------------------------------- #
  1017.     @ieo011_skillcache_complete = true
  1018.     # ---------------------------------------------------------------------- #
  1019.     @skl_exp_list   = IEO::SKILL_LEVEL.skill_explist( self )
  1020.     @skl_expmax     = IEO::SKILL_LEVEL.skill_exp_max( self )
  1021.     # ---------------------------------------------------------------------- #
  1022.     change_level( @skl_unlocklevel )
  1023.     # ---------------------------------------------------------------------- #
  1024.     #File.open("SkillLevelData/SK#{"%03d"%@id}#{@name}.xml", "w+") { |f|
  1025.     #  @skl_levelcache.each { |e| f.puts(e.to_s) }
  1026.     #}
  1027.   end
  1028.  
  1029.   #--------------------------------------------------------------------------#
  1030.   # * new-method :setup_skl_custom_type
  1031.   #--------------------------------------------------------------------------#
  1032.   def setup_skl_custom_type( type, value )
  1033.     return nil
  1034.   end
  1035.  
  1036.   #--------------------------------------------------------------------------#
  1037.   # * new-method :ieo011_rebuild_levelcosts
  1038.   #--------------------------------------------------------------------------#
  1039.   def ieo011_rebuild_levelcosts()
  1040.     @skl_levelcosts.clear()
  1041.     @skl_openlevels.clear()
  1042.     for i in 0..@skl_maxlevel
  1043.       @skl_levelcosts[i] = IEO::SKILL_LEVEL.level_cost( self, i )
  1044.       @skl_openlevels[i] = false
  1045.     end
  1046.     @skl_openlevels[@skl_min_level] = true
  1047.   end
  1048.  
  1049.   #--------------------------------------------------------------------------#
  1050.   # * new-method :ieo011_build_firstlevel_cache
  1051.   #--------------------------------------------------------------------------#
  1052.   def ieo011_build_firstlevel_cache()
  1053.     # ---------------------------------------------------------------------- #
  1054.     @skl_levelcache = {}
  1055.     tcost = "#{@mp_cost} MP"
  1056.     # ---------------------------------------------------------------------- #
  1057.     @skl_levelcache[@skl_min_level] = ::IEO::SKILL_LEVEL::Level_Struct.new()
  1058.     # ---------------------------------------------------------------------- #
  1059.     @skl_levelcache[@skl_min_level][:name]        = @name
  1060.     @skl_levelcache[@skl_min_level][:cost]        = $imported["IEO-CustomSkillCosts"] ? @cost : tcost
  1061.     @skl_levelcache[@skl_min_level][:subcost]     = $imported["IEO-CustomSkillCosts"] ? @subcost : ""
  1062.     @skl_levelcache[@skl_min_level][:base_damage] = @base_damage
  1063.     @skl_levelcache[@skl_min_level][:variance]    = @variance
  1064.     @skl_levelcache[@skl_min_level][:speed]       = @speed
  1065.     @skl_levelcache[@skl_min_level][:hit_ratio]   = @hit
  1066.     @skl_levelcache[@skl_min_level][:spi_f]       = @spi_f
  1067.     @skl_levelcache[@skl_min_level][:atk_f]       = @atk_f
  1068.     @skl_levelcache[@skl_min_level][:scope]       = @scope
  1069.     @skl_levelcache[@skl_min_level][:anim_id]     = @animation_id
  1070.     @skl_levelcache[@skl_min_level][:icon_index]  = @icon_index
  1071.     @skl_levelcache[@skl_min_level][:state_add]   = @plus_state_set
  1072.     @skl_levelcache[@skl_min_level][:state_rem]   = @minus_state_set
  1073.     @skl_levelcache[@skl_min_level][:elements]    = @element_set
  1074.     build_firstlevel_cache_custom()
  1075.     # ---------------------------------------------------------------------- #
  1076.   end
  1077.  
  1078.   #--------------------------------------------------------------------------#
  1079.   # * new-method :build_firstlevel_cache_custom
  1080.   #--------------------------------------------------------------------------#  
  1081.   def build_firstlevel_cache_custom()
  1082.     return 0
  1083.   end  
  1084.  
  1085.   #--------------------------------------------------------------------------#
  1086.   # * new-method :ieo011_build_mainsklcaches
  1087.   #--------------------------------------------------------------------------#
  1088.   def ieo011_build_mainsklcaches()
  1089.     iskl = IEO::SKILL_LEVEL
  1090.     # ---------------------------------------------------------------------- #
  1091.     for i in (@skl_min_level+1)..@skl_maxlevel
  1092.       @skl_atlevelmod[i] ||= { }
  1093.       @skl_levelcache[i] ||= { }
  1094.       # ---------------------------------------------------------------------- #
  1095.       lastlevel = [@skl_min_level, i-1].max()
  1096.       @skl_levelcache[i] = @skl_levelcache[lastlevel].clone()
  1097.       # //
  1098.       level_proc = Proc.new { |clc, lvmods|
  1099.         result = clc
  1100.         lvmods.each { |r|
  1101.           result = IEO::SKILL_LEVEL.change_numeric_value( result, r )
  1102.         } unless lvmods.nil?()
  1103.         result
  1104.       }
  1105.       atlevel_proc = Proc.new { |clc, lvmod|
  1106.         result = clc
  1107.         result = IEO::SKILL_LEVEL.change_numeric_value( clc, lvmod ) unless lvmod.nil?()
  1108.         result
  1109.       }
  1110.       # //
  1111.       level_proc_cost = Proc.new { |clc, lvmods|
  1112.         result = clc
  1113.         lvmods.each { |r|
  1114.           result = change_skill_cost( result, r )
  1115.         } unless lvmods.nil?()
  1116.         result
  1117.       }
  1118.       atlevel_array_proc = Proc.new { |clc, lvmod|
  1119.         result = clc.clone
  1120.         lvmod.to_s.scan(/([\+\-])(\d+)/i).each { |d|
  1121.           op, val = $1, $2
  1122.           case $1
  1123.           when "+"
  1124.             result |= [$2.to_i]
  1125.           when "-"  
  1126.             result -= [$2.to_i]
  1127.           end  
  1128.         }
  1129.         result
  1130.       }
  1131.       # ---------------------------------------------------------------------- #
  1132.       @skl_levelcache[i][:cost]        = level_proc_cost.call( @skl_levelcache[i][:cost], @skl_perlevelmod[:cost] )
  1133.       @skl_levelcache[i][:subcost]     = level_proc_cost.call( @skl_levelcache[i][:subcost], @skl_perlevelmod[:subcost] )
  1134.       @skl_levelcache[i][:base_damage] = level_proc.call( @skl_levelcache[i][:base_damage], @skl_perlevelmod[:base_damage] )
  1135.       @skl_levelcache[i][:variance]    = level_proc.call( @skl_levelcache[i][:variance]   , @skl_perlevelmod[:variance] )
  1136.       @skl_levelcache[i][:speed]       = level_proc.call( @skl_levelcache[i][:speed]      , @skl_perlevelmod[:speed] )
  1137.       @skl_levelcache[i][:hit_ratio]   = level_proc.call( @skl_levelcache[i][:hit_ratio]  , @skl_perlevelmod[:hit_ratio] )
  1138.       @skl_levelcache[i][:spi_f]       = level_proc.call( @skl_levelcache[i][:spi_f]      , @skl_perlevelmod[:spi_f] )
  1139.       @skl_levelcache[i][:atk_f]       = level_proc.call( @skl_levelcache[i][:atk_f]      , @skl_perlevelmod[:atk_f] )
  1140.       # ---------------------------------------------------------------------- #
  1141.       @skl_levelcache[i][:name]        = @skl_atlevelmod[i][:name] unless @skl_atlevelmod[i][:name].nil?()
  1142.       @skl_levelcache[i][:cost]        = change_skill_cost( @skl_levelcache[i][:cost], @skl_atlevelmod[i][:cost] )
  1143.       @skl_levelcache[i][:subcost]     = change_skill_cost( @skl_levelcache[i][:subcost], @skl_atlevelmod[i][:subcost] )
  1144.       @skl_levelcache[i][:base_damage] = atlevel_proc.call( @skl_levelcache[i][:base_damage], @skl_atlevelmod[i][:base_damage] )
  1145.       @skl_levelcache[i][:variance]    = atlevel_proc.call( @skl_levelcache[i][:variance]   , @skl_atlevelmod[i][:variance] )    
  1146.       @skl_levelcache[i][:speed]       = atlevel_proc.call( @skl_levelcache[i][:speed]      , @skl_atlevelmod[i][:speed] )      
  1147.       @skl_levelcache[i][:hit_ratio]   = atlevel_proc.call( @skl_levelcache[i][:hit_ratio]  , @skl_atlevelmod[i][:hit_ratio] )  
  1148.       @skl_levelcache[i][:spi_f]       = atlevel_proc.call( @skl_levelcache[i][:spi_f]      , @skl_atlevelmod[i][:spi_f] )      
  1149.       @skl_levelcache[i][:atk_f]       = atlevel_proc.call( @skl_levelcache[i][:atk_f]      , @skl_atlevelmod[i][:atk_f] )      
  1150.       @skl_levelcache[i][:scope]       = atlevel_proc.call( @skl_levelcache[i][:scope]      , @skl_atlevelmod[i][:scope] )      
  1151.       @skl_levelcache[i][:anim_id]     = atlevel_proc.call( @skl_levelcache[i][:anim_id]    , @skl_atlevelmod[i][:anim_id] )    
  1152.       @skl_levelcache[i][:icon_index]  = atlevel_proc.call( @skl_levelcache[i][:icon_index] , @skl_atlevelmod[i][:icon_index] )  
  1153.       @skl_levelcache[i][:state_add]   = atlevel_array_proc.call( @skl_levelcache[i][:state_add] , @skl_atlevelmod[i][:state_add] )  
  1154.       @skl_levelcache[i][:state_rem]   = atlevel_array_proc.call( @skl_levelcache[i][:state_rem] , @skl_atlevelmod[i][:state_rem] )  
  1155.       @skl_levelcache[i][:elements]    = atlevel_array_proc.call( @skl_levelcache[i][:elements] , @skl_atlevelmod[i][:elements] )  
  1156.       # ---------------------------------------------------------------------- #          
  1157.       build_custom_mainsklcache( i, [level_proc, atlevel_proc, atlevel_array_proc] )
  1158.     end  
  1159.   end
  1160.  
  1161.   #--------------------------------------------------------------------------#
  1162.   # * new-method :build_custom_mainsklcache
  1163.   #--------------------------------------------------------------------------#
  1164.   def build_custom_mainsklcache( index, procs )
  1165.   end  
  1166.  
  1167.   #--------------------------------------------------------------------------#
  1168.   # * new-method :level_up
  1169.   #--------------------------------------------------------------------------#
  1170.   def level_up( change_only=false )   ; return change_level( @skl_level+1, change_only ) end
  1171.    
  1172.   #--------------------------------------------------------------------------#
  1173.   # * new-method :level_down
  1174.   #--------------------------------------------------------------------------#  
  1175.   def level_down( change_only=false ) ; return change_level( @skl_level-1, change_only ) end
  1176.  
  1177.   #--------------------------------------------------------------------------#
  1178.   # * new-method :change_level
  1179.   #--------------------------------------------------------------------------#
  1180.   def change_level( new_level, change_only=false )
  1181.     if IEO::SKILL_LEVEL::SKILL_MODE == 1
  1182.       @skl_unlocklevel = [[new_level, @skl_maxlevel].min(), @skl_min_level].max() if new_level > @skl_unlocklevel unless change_only
  1183.     end  
  1184.     # ---------------------------------------------------------------------- #
  1185.     new_level    = [[[new_level, @skl_unlocklevel].min(), @skl_maxlevel].min(), @skl_min_level].max()
  1186.     # ---------------------------------------------------------------------- #
  1187.     @skl_level   = new_level
  1188.     # ---------------------------------------------------------------------- #
  1189.     @name            = @skl_levelcache[new_level][:name]
  1190.     @cost            = @skl_levelcache[new_level][:cost]
  1191.     @subcost         = @skl_levelcache[new_level][:subcost]
  1192.     @base_damage     = @skl_levelcache[new_level][:base_damage]
  1193.     @variance        = @skl_levelcache[new_level][:variance]    
  1194.     @speed           = @skl_levelcache[new_level][:speed]      
  1195.     @hit             = @skl_levelcache[new_level][:hit_ratio]  
  1196.     @spi_f           = @skl_levelcache[new_level][:spi_f]      
  1197.     @atk_f           = @skl_levelcache[new_level][:atk_f]      
  1198.     @scope           = @skl_levelcache[new_level][:scope]
  1199.     @animation_id    = @skl_levelcache[new_level][:anim_id]
  1200.     @icon_index      = @skl_levelcache[new_level][:icon_index]
  1201.     @plus_state_set  = @skl_levelcache[new_level][:state_add]
  1202.     @minus_state_set = @skl_levelcache[new_level][:state_rem]  
  1203.     @element_set     = @skl_levelcache[new_level][:elements]    
  1204.     # ---------------------------------------------------------------------- #
  1205.     unless $imported["IEO-CustomSkillCosts"]
  1206.       @mp_cost = @cost.gsub( /(\d+)[ ]*(MP|SP)/i ) { $1.to_i }  
  1207.       @mp_cost = Integer( @mp_cost )
  1208.     end
  1209.     # ---------------------------------------------------------------------- #
  1210.     change_level_custom( new_level )
  1211.     # ---------------------------------------------------------------------- #
  1212.     @skl_exp = next_skl_exp( 0 ) if @skl_exp < next_skl_exp( 0 )
  1213.     return new_level
  1214.   end
  1215.  
  1216.   #--------------------------------------------------------------------------#
  1217.   # * new-method :change_level_custom
  1218.   #--------------------------------------------------------------------------#  
  1219.   def change_level_custom( new_level )
  1220.   end  
  1221.  
  1222.   #--------------------------------------------------------------------------#
  1223.   # * new-method :skl_nextlevelcost
  1224.   #--------------------------------------------------------------------------#
  1225.   def skl_nextlevelcost( n )
  1226.     return 0 if @skl_unlocklevel >= @skl_maxlevel
  1227.     level = get_nextlevel( n )
  1228.     return @skl_levelcosts[level]
  1229.   end
  1230.  
  1231.   #--------------------------------------------------------------------------#
  1232.   # * new-method :get_nextlevel
  1233.   #--------------------------------------------------------------------------#
  1234.   def get_nextlevel( n=1 )
  1235.     return [[@skl_unlocklevel+n, @skl_maxlevel].min, @skl_min_level].max()
  1236.   end
  1237.  
  1238.   # // Level Skill Mode
  1239.   #--------------------------------------------------------------------------#
  1240.   # * new-method :change_skl_exp
  1241.   #--------------------------------------------------------------------------#
  1242.   def change_skl_exp( nexp )
  1243.     last_level = @skl_unlocklevel
  1244.     @skl_exp = [[nexp, @skl_expmax].min, 0].max()
  1245.     while @skl_exp >= @skl_exp_list[@skl_unlocklevel+1] and @skl_exp_list[@skl_unlocklevel+1] > 0
  1246.       level_up()
  1247.       break if @skl_unlocklevel == @skl_maxlevel
  1248.     end
  1249.     while @skl_exp < @skl_exp_list[@skl_unlocklevel]
  1250.       level_down()
  1251.       break if @skl_unlocklevel == @skl_min_level
  1252.     end
  1253.   end
  1254.  
  1255.   #--------------------------------------------------------------------------#
  1256.   # * new-method :skl_exp=
  1257.   #--------------------------------------------------------------------------#
  1258.   def skl_exp=( val )
  1259.     change_skl_exp( val )
  1260.   end
  1261.  
  1262.   #--------------------------------------------------------------------------#
  1263.   # * new-method :next_skl_exp
  1264.   #--------------------------------------------------------------------------#
  1265.   def next_skl_exp(n=1)
  1266.     return @skl_exp_list[@skl_unlocklevel+n]
  1267.   end
  1268.  
  1269.   #--------------------------------------------------------------------------#
  1270.   # * new-method :next_expr
  1271.   #--------------------------------------------------------------------------#
  1272.   def next_skl_expr()
  1273.     return @skl_exp_list[@skl_unlocklevel+1] - @skl_exp_list[@skl_unlocklevel]
  1274.   end
  1275.  
  1276.   #--------------------------------------------------------------------------#
  1277.   # * new-method :level_skl_exp
  1278.   #--------------------------------------------------------------------------#
  1279.   def level_skl_exp()
  1280.     return @skl_exp - @skl_exp_list[@skl_unlocklevel]
  1281.   end
  1282.  
  1283.   #--------------------------------------------------------------------------#
  1284.   # * new-method :maxed_level?
  1285.   #--------------------------------------------------------------------------#
  1286.   def maxed_level?() ; return (@skl_unlocklevel >= @skl_maxlevel) ; end
  1287.  
  1288.   #--------------------------------------------------------------------------#
  1289.   # * new-method :unlocked_level?
  1290.   #--------------------------------------------------------------------------#
  1291.   def unlocked_level?( level ) ; return level < @skl_unlocklevel ; end
  1292.    
  1293. end  
  1294.  
  1295. #==============================================================================#
  1296. # ** IEO::SKILL_LEVEL::MIXES::Enemy
  1297. #==============================================================================#
  1298. module IEO::SKILL_LEVEL::MIXES::Enemy
  1299.  
  1300.   #--------------------------------------------------------------------------#
  1301.   # * Public Instance Variables
  1302.   #--------------------------------------------------------------------------#
  1303.   attr_accessor :skl_p
  1304.  
  1305.   #--------------------------------------------------------------------------#
  1306.   # * new-method :ieo011_enemycache
  1307.   #--------------------------------------------------------------------------#
  1308.   def ieo011_enemycache
  1309.     @skl_p = 0
  1310.     # ---------------------------------------------------------------------- #
  1311.     self.note.split(/[\r\n]+/).each { |line|
  1312.       case line
  1313.     # ---------------------------------------------------------------------- #
  1314.       when IEO::REGEXP::SKILL_LEVEL::ENEMY::SKL_P
  1315.         @skl_p = $1.to_i
  1316.       end
  1317.     }
  1318.     # ---------------------------------------------------------------------- #
  1319.     @ieo011_enemycache_complete = true
  1320.     # ---------------------------------------------------------------------- #
  1321.   end
  1322.  
  1323. end
  1324.  
  1325. #==============================================================================#
  1326. # ** RPG::Item
  1327. #==============================================================================#
  1328. class RPG::Item
  1329.  
  1330.   include IEO::SKILL_LEVEL::MIXES::Item
  1331.  
  1332. end  
  1333.  
  1334. #==============================================================================#
  1335. # ** RPG::Skill
  1336. #==============================================================================#
  1337. class RPG::Skill
  1338.  
  1339.   include IEO::SKILL_LEVEL::MIXES::Skill
  1340.  
  1341.   # // Level Pull Mode
  1342. if IEO::SKILL_LEVEL::LEVELPULLMODE
  1343.   #--------------------------------------------------------------------------#
  1344.   # * overwrite accessor method :cost
  1345.   #--------------------------------------------------------------------------#
  1346.   def cost( level = @skl_level )
  1347.     return @skl_levelcache[level][:cost]
  1348.   end  
  1349.  
  1350.   #--------------------------------------------------------------------------#
  1351.   # * overwrite accessor method :base_damage
  1352.   #--------------------------------------------------------------------------#
  1353.   def base_damage( level = @skl_level )
  1354.     return @skl_levelcache[level][:base_damage]
  1355.   end  
  1356.  
  1357.   #--------------------------------------------------------------------------#
  1358.   # * overwrite accessor method :variance
  1359.   #--------------------------------------------------------------------------#
  1360.   def variance( level = @skl_level )
  1361.     return @skl_levelcache[level][:variance]    
  1362.   end  
  1363.  
  1364.   #--------------------------------------------------------------------------#
  1365.   # * overwrite accessor method :speed
  1366.   #--------------------------------------------------------------------------#
  1367.   def speed( level = @skl_level )
  1368.     return @skl_levelcache[level][:speed]
  1369.   end
  1370.  
  1371.   #--------------------------------------------------------------------------#
  1372.   # * overwrite accessor method :hit
  1373.   #--------------------------------------------------------------------------#  
  1374.   def hit( level = @skl_level )      
  1375.     return @skl_levelcache[level][:hit_ratio]
  1376.   end
  1377.  
  1378.   #--------------------------------------------------------------------------#
  1379.   # * overwrite accessor method :spi_f
  1380.   #--------------------------------------------------------------------------#  
  1381.   def spi_f( level = @skl_level )
  1382.     return @skl_levelcache[level][:spi_f]
  1383.   end
  1384.  
  1385.   #--------------------------------------------------------------------------#
  1386.   # * overwrite accessor method :atk_f
  1387.   #--------------------------------------------------------------------------#  
  1388.   def atk_f( level = @skl_level )
  1389.     return @skl_levelcache[level][:atk_f]
  1390.   end
  1391.  
  1392.   #--------------------------------------------------------------------------#
  1393.   # * overwrite accessor method :scope
  1394.   #--------------------------------------------------------------------------#  
  1395.   def scope( level = @skl_level )
  1396.     return @skl_levelcache[level][:scope]
  1397.   end
  1398.  
  1399.   #--------------------------------------------------------------------------#
  1400.   # * overwrite accessor method :animation_id
  1401.   #--------------------------------------------------------------------------#  
  1402.   def animation_id( level = @skl_level )
  1403.     return @skl_levelcache[level][:anim_id]
  1404.   end
  1405.  
  1406.   #--------------------------------------------------------------------------#
  1407.   # * overwrite accessor method :mp_cost
  1408.   #--------------------------------------------------------------------------#  
  1409.   def mp_cost( level = @skl_level )
  1410.     return Integer( cost( level ).gsub( /(\d+)[ ]*(MP|SP)/i ) { $1.to_i } )
  1411.   end
  1412.  
  1413.   #--------------------------------------------------------------------------#
  1414.   # * overwrite accessor method :icon_index
  1415.   #--------------------------------------------------------------------------#
  1416.   def icon_index( level = @skl_level )
  1417.     return @skl_levelcache[level][:icon_index]
  1418.   end
  1419.  
  1420.   #--------------------------------------------------------------------------#
  1421.   # * overwrite accessor method :name
  1422.   #--------------------------------------------------------------------------#
  1423.   def name( level = @skl_level )
  1424.     return @skl_levelcache[level][:name]
  1425.   end
  1426.  
  1427.   #--------------------------------------------------------------------------#
  1428.   # * overwrite accessor method :plus_state_set
  1429.   #--------------------------------------------------------------------------#
  1430.   def plus_state_set( level = @skl_level )
  1431.     return @skl_levelcache[level][:state_add]
  1432.   end
  1433.  
  1434.   #--------------------------------------------------------------------------#
  1435.   # * overwrite accessor method :minus_state_set
  1436.   #--------------------------------------------------------------------------#
  1437.   def minus_state_set( level = @skl_level )
  1438.     return @skl_levelcache[level][:state_rem]
  1439.   end
  1440.  
  1441.   #--------------------------------------------------------------------------#
  1442.   # * overwrite accessor method :element_set
  1443.   #--------------------------------------------------------------------------#
  1444.   def element_set( level = @skl_level )
  1445.     return @skl_levelcache[level][:elements]
  1446.   end
  1447.    
  1448. end # // Level Pull Mode
  1449.  
  1450. end
  1451.  
  1452. #==============================================================================#
  1453. # ** RPG::Enemy
  1454. #==============================================================================#
  1455. class RPG::Enemy
  1456.  
  1457.   include IEO::SKILL_LEVEL::MIXES::Enemy
  1458.  
  1459. end
  1460.  
  1461. #==============================================================================#
  1462. # ** Game_System
  1463. #==============================================================================#
  1464. class Game_System
  1465.  
  1466.   #--------------------------------------------------------------------------#
  1467.   # * Public Instance Variables
  1468.   #--------------------------------------------------------------------------#
  1469.   attr_accessor :can_upgrade_skills
  1470.  
  1471.   #--------------------------------------------------------------------------#
  1472.   # * alias-method :initialize
  1473.   #--------------------------------------------------------------------------#
  1474.   alias :ieo011_gs_initialize :initialize unless $@
  1475.   def initialize()
  1476.     ieo011_gs_initialize()
  1477.     @can_upgrade_skills = IEO::SKILL_LEVEL::ONSTART_UPGRADE
  1478.   end
  1479.  
  1480. end  
  1481.  
  1482. #==============================================================================#
  1483. # ** Game_BattleAction
  1484. #==============================================================================#
  1485. class Game_BattleAction
  1486.    
  1487.   #--------------------------------------------------------------------------#
  1488.   # * alias-method :clear
  1489.   #--------------------------------------------------------------------------#
  1490.   alias :ieo011_gba_clear :clear unless $@
  1491.   def clear()
  1492.     ieo011_gba_clear()
  1493.     @skl_skill = nil
  1494.   end
  1495.  
  1496.   #--------------------------------------------------------------------------#
  1497.   # * alias-method :set_skill
  1498.   #--------------------------------------------------------------------------#
  1499.   alias :ieo011_gba_set_skill :set_skill unless $@
  1500.   def set_skill( skill_id )
  1501.     ieo011_gba_set_skill( skill_id )
  1502.     assign_skl_skill( skill_id )
  1503.   end
  1504.  
  1505.   #--------------------------------------------------------------------------#
  1506.   # * new-method :assign_skl_skill
  1507.   #--------------------------------------------------------------------------#
  1508.   def assign_skl_skill( skill_id )
  1509.     @skl_skill = $data_skills[skill_id]
  1510.     @skl_skill = @battler.match_skl_skill_to_id( skill_id ) if @battler.actor?() #.is_a?( Game_Actor )
  1511.   end  
  1512.  
  1513.   #--------------------------------------------------------------------------#
  1514.   # * overwrite-method :skill
  1515.   #--------------------------------------------------------------------------#
  1516.   def skill()
  1517.     assign_skl_skill( @skill_id ) if @skl_skill.nil?
  1518.     unless @skl_skill.nil?()
  1519.       assign_skl_skill( @skill_id ) if @skl_skill.id != @skill_id
  1520.     end  
  1521.     return skill?() ? @skl_skill : nil
  1522.   end
  1523.  
  1524.   #--------------------------------------------------------------------------#
  1525.   # * overwrite-method :valid?()
  1526.   #--------------------------------------------------------------------------#
  1527.   def valid?()
  1528.     return false if nothing?()                    # Do nothing
  1529.     return true if @forcing                       # Force to act
  1530.     return false unless battler.movable?()        # Cannot act
  1531.     if skill?()                                   # Skill
  1532.       return false unless battler.skill_can_use?( skill )
  1533.     elsif item?()                                 # Item
  1534.       return false unless friends_unit.item_can_use?( item )
  1535.     end
  1536.     return true
  1537.   end
  1538.  
  1539. end
  1540.  
  1541. #==============================================================================#
  1542. # ** Game_Battler
  1543. #==============================================================================#
  1544. class Game_Battler
  1545.  
  1546.   #--------------------------------------------------------------------------#
  1547.   # * alias-method :skill_effect
  1548.   #--------------------------------------------------------------------------#
  1549.   alias :ieo011_gb_skill_effect :skill_effect unless $@
  1550.   def skill_effect( user, skill )
  1551.     ieo011_gb_skill_effect( user, skill )
  1552.     return if @skipped || @missed || @evaded
  1553.     IEO::SKILL_LEVEL.skl_p_gain( :use, self, skill, user )
  1554.   end
  1555.  
  1556.   #--------------------------------------------------------------------------#
  1557.   # * alias-method :item_effect
  1558.   #--------------------------------------------------------------------------#
  1559.   alias :ieo011_gb_item_effect :item_effect unless $@
  1560.   def item_effect( user, item )
  1561.     ieo011_gb_item_effect( user, item )
  1562.     return if @skipped || @missed || @evaded
  1563.     IEO::SKILL_LEVEL.skl_p_gain( :use, self, item, user )
  1564.   end
  1565.  
  1566. end
  1567.  
  1568. #==============================================================================#
  1569. # ** Game_Enemy
  1570. #==============================================================================#
  1571. class Game_Enemy < Game_Battler
  1572.  
  1573.   #--------------------------------------------------------------------------#
  1574.   # * alias-method :initialize
  1575.   #--------------------------------------------------------------------------#
  1576.   alias :ieo011_ge_initialize :initialize unless $@
  1577.   def initialize( index, enemy_id )
  1578.     @skl_p = 0 ; @skl_p_limit = 0
  1579.     ieo011_ge_initialize( index, enemy_id )
  1580.     @skl_p = enemy.skl_p ; @skl_p_limit = IEO::SKILL_LEVEL.skl_p_limit( self )
  1581.   end
  1582.  
  1583.   #--------------------------------------------------------------------------#
  1584.   # * new-method :skl_p_limit
  1585.   #--------------------------------------------------------------------------#
  1586.   def skl_p_limit() ; return @skl_p_limit end
  1587.    
  1588.   #--------------------------------------------------------------------------#
  1589.   # * new-method :skl_p
  1590.   #--------------------------------------------------------------------------#    
  1591.   def skl_p()       ; return Integer(@skl_p) end
  1592.    
  1593.   #--------------------------------------------------------------------------#
  1594.   # * new-method :skl_p=
  1595.   #--------------------------------------------------------------------------#  
  1596.   def skl_p=( val ) ; @skl_p = Integer( [[val, 0].max(), skl_p_limit()].min ) end
  1597.    
  1598. end
  1599.  
  1600. #==============================================================================#
  1601. # ** Game_Actor
  1602. #==============================================================================#
  1603. class Game_Actor < Game_Battler
  1604.  
  1605.   #--------------------------------------------------------------------------#
  1606.   # * alias-method :setup
  1607.   #--------------------------------------------------------------------------#
  1608.   alias :ieo011_ga_setup :setup unless $@
  1609.   def setup( actor_id )
  1610.     create_skl_skills()
  1611.     @skl_p = 0 ; @skl_p_limit = 0
  1612.     ieo011_ga_setup( actor_id )
  1613.     @skl_p_limit = IEO::SKILL_LEVEL.skl_p_limit( self )
  1614.   end
  1615.  
  1616.   #--------------------------------------------------------------------------#
  1617.   # * new-method :create_skl_skills
  1618.   #--------------------------------------------------------------------------#
  1619.   def create_skl_skills()
  1620.     case IEO::SKILL_LEVEL::SKLMODE
  1621.     when 0
  1622.       @skl_skills = [ ]
  1623.     when 1
  1624.       @skl_skills = { }
  1625.     when 2  
  1626.       @skl_skills = Array.new( $data_skills.size, nil )
  1627.     end  
  1628.   end  
  1629.  
  1630.   #--------------------------------------------------------------------------#
  1631.   # * new-method :match_skl_skill_to_id
  1632.   #--------------------------------------------------------------------------#
  1633. case IEO::SKILL_LEVEL::SKLMODE
  1634. when 0, 2
  1635.   def match_skl_skill_to_id( skill_id )
  1636.     create_skl_skills() if @skl_skills.nil?()
  1637.     sklst = []
  1638.     sklst += @skl_skills.compact
  1639.     sklst += level_class( @class_id ).skills() if $imported["IEO-ClassSystem"]
  1640.     sklst.each { |ski| return ski if ski.id.eql?( skill_id ) }
  1641.     return $data_skills[skill_id]
  1642.   end
  1643. when 1
  1644.   def match_skl_skill_to_id( skill_id )
  1645.     create_skl_skills() if @skl_skills.nil?()
  1646.     sklst = {}
  1647.     sklst.update( @skl_skills )
  1648.     sklst += level_class( @class_id ).skills() if $imported["IEO-ClassSystem"]
  1649.     return sklst[skill_id] if sklst.has_key?( skill_id )
  1650.     return $data_skills[skill_id]
  1651.   end
  1652. when 3  
  1653.   def match_skl_skill_to_id( skill_id )
  1654.     return $data_skills[skill_id]
  1655.   end  
  1656. end
  1657.  
  1658.   #--------------------------------------------------------------------------#
  1659.   # * new-method :skl_p_limit
  1660.   #--------------------------------------------------------------------------#
  1661.   def skl_p_limit() ; return @skl_p_limit end
  1662.    
  1663.   #--------------------------------------------------------------------------#
  1664.   # * new-method :skl_p
  1665.   #--------------------------------------------------------------------------#    
  1666.   def skl_p()       ; return Integer( @skl_p ) end
  1667.    
  1668.   #--------------------------------------------------------------------------#
  1669.   # * new-method :skl_p=
  1670.   #--------------------------------------------------------------------------#  
  1671.   def skl_p=( val ) ; @skl_p = Integer( [[val, 0].max(), skl_p_limit].min() ) end
  1672.    
  1673.   #--------------------------------------------------------------------------#
  1674.   # * new-method :can_upgrade_skill?
  1675.   #--------------------------------------------------------------------------#
  1676.   def can_upgrade_skill?( skill, level, bypasscost = false )
  1677.     return false if skill.nil?()
  1678.     return false if skill.skl_maxlevel < level
  1679.     return false if skill.skl_nextlevelcost( 1 ) > skl_p unless bypasscost
  1680.     return false if skill.skl_openlevels[skill.skl_unlocklevel+1]
  1681.     return false if skill.skl_unlocklevel >= skill.skl_maxlevel
  1682.     return false unless skill.editable
  1683.     return false unless skill.skl_skill?()
  1684.     return false unless @skl_skills.include?( skill )
  1685.     return true
  1686.   end
  1687.  
  1688.   #--------------------------------------------------------------------------#
  1689.   # * new-method :upgrade_skill
  1690.   #--------------------------------------------------------------------------#
  1691.   def upgrade_skill( skill, level, bypasscost = false )
  1692.     return false unless can_upgrade_skill?( skill, level, bypasscost )
  1693.     self.skl_p -= skill.skl_nextlevelcost( 1 ) unless bypasscost
  1694.     skill.skl_openlevels[level] = true
  1695.     skill.skl_unlocklevel = level
  1696.     return true
  1697.   end  
  1698.  
  1699.   #--------------------------------------------------------------------------#
  1700.   # * overwrite-method :learn_skill
  1701.   #--------------------------------------------------------------------------#
  1702.   def learn_skill( skill_id )
  1703.     create_skl_skills() if @skl_skills.nil?()
  1704.     unless @skills.include?( skill_id )
  1705.       @skills.push( skill_id ) ; @skills.sort!()
  1706.       learn_skl_skill( skill_id )
  1707.     end
  1708.   end
  1709.  
  1710.   #--------------------------------------------------------------------------#
  1711.   # * new-method :learn_skl_skill
  1712.   #--------------------------------------------------------------------------#
  1713. case IEO::SKILL_LEVEL::SKLMODE  
  1714. when 0
  1715.   def learn_skl_skill( skill_id )
  1716.     duski = $data_skills[skill_id].deep_clone() ; duski.skl_skill = true
  1717.     @skl_skills << duski
  1718.   end
  1719. when 1, 2
  1720.   def learn_skl_skill( skill_id )
  1721.     duski = $data_skills[skill_id].deep_clone() ; duski.skl_skill = true
  1722.     @skl_skills[skill_id] = duski
  1723.   end  
  1724. when 3  
  1725.   def learn_skl_skill( skill_id )
  1726.     duski = IEO::SKILL_LEVEL.dup_skill( skill_id ) ; duski.skl_skill = true
  1727.     @skills.push( duski.id ) ; @skills.sort!()
  1728.   end  
  1729.  
  1730.   #--------------------------------------------------------------------------#
  1731.   # * new-method :have_skill?
  1732.   #--------------------------------------------------------------------------#
  1733.   def have_skill?( skill_id )
  1734.     @skills.each { |i| return true if $data_skills[i].original_id == skill_id }
  1735.     return false
  1736.   end  
  1737.  
  1738.   #--------------------------------------------------------------------------#
  1739.   # * overwrite-method :learn_skill
  1740.   #--------------------------------------------------------------------------#
  1741.   def learn_skill( skill_id )
  1742.     create_skl_skills() if @skl_skills.nil?()
  1743.     unless have_skill?( skill_id )
  1744.       learn_skl_skill( skill_id )
  1745.     end
  1746.   end
  1747.  
  1748. end  
  1749.  
  1750.   #--------------------------------------------------------------------------#
  1751.   # * new-method :skl_skills
  1752.   #--------------------------------------------------------------------------#
  1753. case IEO::SKILL_LEVEL::SKLMODE
  1754. when 0
  1755.   def skl_skills()
  1756.     create_skl_skills() if @skl_skills.nil?()
  1757.     return @skl_skills
  1758.   end
  1759. when 1, 2
  1760.   def skl_skills()
  1761.     create_skl_skills() if @skl_skills.nil?()
  1762.     return @skills.inject([]) { |result, i| result << @skl_skills[i] }  
  1763.   end    
  1764. when 3  
  1765.   def skl_skills()
  1766.     return @skills.inject([]) { |r, s| r << $data_skills[s] }
  1767.   end  
  1768. end  
  1769.  
  1770.   #--------------------------------------------------------------------------#
  1771.   # * overwrite-method :skills
  1772.   #--------------------------------------------------------------------------#
  1773.   def skills()
  1774.     result = skl_skills()    
  1775.     return result
  1776.   end
  1777.  
  1778.   #--------------------------------------------------------------------------#
  1779.   # * overwrite-method :skill_learn?
  1780.   #--------------------------------------------------------------------------#
  1781.   def skill_learn?( obj ) ; return true ; end
  1782.  
  1783.   #--------------------------------------------------------------------------#
  1784.   # * alias-method :skill_can_use?
  1785.   #--------------------------------------------------------------------------#
  1786.   alias :ieo011_ga_skill_can_use? :skill_can_use? unless $@
  1787.   def skill_can_use?( skill )
  1788.     return true if $scene.is_a?( Scene_SkillForge )
  1789.     return ieo011_ga_skill_can_use?( skill )
  1790.   end
  1791.  
  1792. end  
  1793.  
  1794. #==============================================================================#
  1795. # ** Game_Troop
  1796. #==============================================================================#
  1797. class Game_Troop < Game_Unit
  1798.  
  1799.   #--------------------------------------------------------------------------#
  1800.   # * new-method :distribute_skl_p
  1801.   #--------------------------------------------------------------------------#
  1802.   def distribute_skl_p()
  1803.     skl_p = 0
  1804.     for member in dead_members.compact()        ; skl_p += member.skl_p end
  1805.     for member in $game_party.members.compact() ; member.skl_p += skl_p end
  1806.   end
  1807.  
  1808. end  
  1809.  
  1810. #==============================================================================#
  1811. # ** Game_Interpreter
  1812. #==============================================================================#
  1813. class Game_Interpreter
  1814.  
  1815.   #--------------------------------------------------------------------------#
  1816.   # * new-method :skill_forge
  1817.   #--------------------------------------------------------------------------#
  1818.   def skill_forge( actor, lock_upgrade=nil )
  1819.     $scene = Scene_SkillForge.new( actor, lock_upgrade, :map )
  1820.   end
  1821.    
  1822. end
  1823.  
  1824. #==============================================================================#
  1825. # ** Window_Base
  1826. #==============================================================================#
  1827. class Window_Base < Window
  1828.  
  1829.   module_eval( IEO::SKILL_LEVEL::WIN_BASE::INCL )
  1830.   #--------------------------------------------------------------------------#
  1831.   # * new-method :__force_update
  1832.   #--------------------------------------------------------------------------#
  1833.   def __force_update ; return false end
  1834.    
  1835. end
  1836.  
  1837. #==============================================================================#
  1838. # ** Window_Skill
  1839. #==============================================================================#
  1840. class Window_Skill < Window_Selectable
  1841.    
  1842.   #--------------------------------------------------------------------------#
  1843.   # * Public Instance Variables
  1844.   #--------------------------------------------------------------------------#
  1845.   attr_accessor :actor
  1846.   attr_accessor :column_max
  1847.  
  1848.   module_eval( IEO::SKILL_LEVEL::WIN_SKILL::INCL )
  1849.  
  1850. end
  1851.  
  1852. #==============================================================================#
  1853. # ** Window_SKL_Help
  1854. #==============================================================================#
  1855. class Window_SKL_Help < Window_Base
  1856.  
  1857.   #--------------------------------------------------------------------------#
  1858.   # * method :initialize
  1859.   #--------------------------------------------------------------------------#
  1860.   def initialize( x, y, width, height )
  1861.     super( x, y, width, height )
  1862.     @old_obj = nil
  1863.   end
  1864.  
  1865.   #--------------------------------------------------------------------------#
  1866.   # * method :draw_obj_stateset
  1867.   #--------------------------------------------------------------------------#
  1868.   def draw_obj_stateset( set, x, y, spacing=0 )
  1869.     for i in 0...set.size
  1870.       sti = set[i]
  1871.       draw_icon( $data_states[sti].icon_index, x+(i*24)+spacing, y )
  1872.     end  
  1873.   end
  1874.  
  1875.   #--------------------------------------------------------------------------#
  1876.   # * method :set_obj
  1877.   #--------------------------------------------------------------------------#
  1878.   def set_obj( obj, bypass=false )
  1879.     return if @old_obj.eql?( obj ) unless bypass
  1880.     #self.contents.clear
  1881.     create_contents
  1882.     @old_obj = obj
  1883.     return if obj.nil?
  1884.     self.contents.font.size = 18
  1885.     rect = Rect.new( 4, 4, self.contents.width-24, WLH )
  1886.     brect = rect.dup ; brect.width /= 2
  1887.     draw_grad_bar( brect.clone, obj.skl_unlocklevel, obj.skl_maxlevel,
  1888.       normal_color, Color.new( 200, 200, 200 ), Color.new( 20, 20, 20 ),
  1889.       2, true )
  1890.     draw_grad_bar( brect.clone, obj.skl_level, obj.skl_maxlevel,
  1891.       mp_gauge_color1, mp_gauge_color2, Color.new(20, 20, 20),
  1892.       2, true )
  1893.     brect.x += brect.width
  1894.     draw_obj_properties( obj, brect.clone, 4 )
  1895.     brect.x = self.contents.width - 24
  1896.     draw_obj_occasion( obj, brect )
  1897.     draw_item_name( obj, 4, 4 )
  1898.     rect.y += 24
  1899.     # ----------------------------------------------------------------------- #
  1900.     self.contents.font.size = 18
  1901.     self.contents.font.color = system_color
  1902.     zrect = rect.clone
  1903.     icon = IEO::Icon.stat( :skl_u )
  1904.     draw_icon( icon, zrect.x, zrect.y )
  1905.     zrect.x += 24 if icon > 0
  1906.     text = sprintf( IEO::Vocab::SKILL_LEVEL::LEVEL_SUB,
  1907.       Vocab.level_a, obj.skl_level, obj.skl_unlocklevel )
  1908.     self.contents.draw_text( zrect.clone, text )
  1909.     rect.y += 24
  1910.     rect.width -= 48
  1911.     # ----------------------------------------------------------------------- #
  1912.     ctw2 = ( self.contents.width-48 ) / 2
  1913.     srect = rect.clone
  1914.     srect.width /= 2
  1915.     oolx = srect.x
  1916.     # ----------------- #
  1917.     ans = draw_obj_stat( obj, :based, srect ) if obj.base_damage > 0
  1918.     ans = draw_obj_stat( obj, :heal_, srect ) if obj.base_damage < 0
  1919.     srect.x += ctw2 if ans
  1920.     ans = draw_obj_stat( obj, :varia, srect )
  1921.     srect.x = oolx if ans
  1922.     srect.y += 24 if ans
  1923.     # ----------------- #
  1924.     ans = draw_obj_stat( obj, :atk_f, srect )
  1925.     srect.x += ctw2 if ans
  1926.     ans = draw_obj_stat( obj, :spi_f, srect )
  1927.     srect.x = oolx if ans
  1928.     srect.y += 24 if ans
  1929.     # ----------------- #
  1930.     ans = draw_obj_stat( obj, :hit_r, srect )
  1931.     srect.x += ctw2 if ans
  1932.     ans = draw_obj_stat( obj, :speed, srect )
  1933.     srect.x = oolx
  1934.     srect.y += 24  
  1935.     # ----------------------------------------------------------------------- #
  1936.     icon = IEO::Icon.scope( obj.scope )
  1937.     draw_icon( icon, srect.x, srect.y )
  1938.     trect = srect.clone ; trect.x += 24 if icon > 0
  1939.     self.contents.draw_text( trect, IEO::Vocab.scope(obj.scope) )
  1940.     # ----------------------------------------------------------------------- #
  1941.     self.contents.font.size = 18
  1942.     self.contents.font.color = normal_color
  1943.     trect = srect.clone
  1944.     trect.y += 24
  1945.     self.contents.draw_text( trect, IEO::Vocab::SKILL_LEVEL::ADD_STATE )
  1946.     trect.y += 16
  1947.     draw_obj_stateset( obj.plus_state_set, rect.x, trect.y, 4 )
  1948.     trect.y += 24
  1949.     self.contents.draw_text( trect, IEO::Vocab::SKILL_LEVEL::MINUS_STATE )
  1950.     trect.y += 16
  1951.     draw_obj_stateset( obj.minus_state_set, rect.x, trect.y, 4 )
  1952.     # ----------------------------------------------------------------------- #
  1953.     zrect.y = trect.y + 32
  1954.     zrect.x = 0
  1955.     zrect.width = self.contents.width
  1956.     if $game_system.can_upgrade_skills
  1957.       if obj.skl_unlocklevel != obj.skl_maxlevel
  1958.         self.contents.draw_text(zrect.clone, sprintf(IEO::Vocab::SKILL_LEVEL::NEXT_COST_SUB,
  1959.           Vocab.level, obj.get_nextlevel))
  1960.         self.contents.font.color = normal_color
  1961.         draw_skl_p(obj.skl_nextlevelcost(1), zrect.clone)
  1962.       else  
  1963.         self.contents.draw_text(zrect.clone, sprintf("%s %s", Vocab.level,
  1964.           IEO::Vocab::SKILL_LEVEL::LEVEL_MAX))
  1965.       end
  1966.     end
  1967.    
  1968.   end
  1969.  
  1970.   #--------------------------------------------------------------------------#
  1971.   # * method :draw_obj_occasion
  1972.   #--------------------------------------------------------------------------#
  1973.   def draw_obj_occasion( obj, rect )
  1974.     draw_icon( IEO::Icon.stat(:alway), rect.x, rect.y ) if obj.occasion.eql?( 0 )
  1975.     draw_icon( IEO::Icon.stat(:battl), rect.x, rect.y ) if obj.occasion.eql?( 1 )
  1976.     draw_icon( IEO::Icon.stat(:menuo), rect.x, rect.y ) if obj.occasion.eql?( 2 )
  1977.     draw_icon( IEO::Icon.stat(:never), rect.x, rect.y ) if obj.occasion.eql?( 3 )
  1978.   end
  1979.  
  1980.   #--------------------------------------------------------------------------#
  1981.   # * method :draw_obj_properties
  1982.   #--------------------------------------------------------------------------#
  1983.   def draw_obj_properties( obj, rect, spacing=0 )
  1984.     i = 0 ; draw_icon( IEO::Icon.stat( :physa ),
  1985.       rect.x+( 24*i )+spacing, rect.y ) if obj.physical_attack
  1986.     i += 1 ; draw_icon( IEO::Icon.stat( :dam_m ),
  1987.       rect.x+( 24*i )+spacing, rect.y ) if obj.damage_to_mp
  1988.     i += 1 ; draw_icon( IEO::Icon.stat( :dam_a ),
  1989.       rect.x+( 24*i )+spacing, rect.y ) if obj.absorb_damage
  1990.     i += 1 ; draw_icon( IEO::Icon.stat( :i_def ),
  1991.       rect.x+( 24*i )+spacing, rect.y ) if obj.ignore_defense
  1992.   end
  1993.  
  1994.   #--------------------------------------------------------------------------#
  1995.   # * method :draw_obj_stat
  1996.   #--------------------------------------------------------------------------#
  1997.   def draw_obj_stat( obj, stat, rect, draw0=false, enabled=true )
  1998.     case stat
  1999.     when :spi_f # (Spi_F)
  2000.       vocab= IEO::Vocab::SKILL_LEVEL::SPI_F
  2001.       val  = obj.spi_f
  2002.       icon = IEO::Icon.stat( :spi_f )
  2003.     when :atk_f # (Atk_F)
  2004.       vocab= IEO::Vocab::SKILL_LEVEL::ATK_F
  2005.       val  = obj.atk_f
  2006.       icon = IEO::Icon.stat( :atk_f )
  2007.     when :speed # (Action Speed)
  2008.       vocab= IEO::Vocab::SKILL_LEVEL::ACTION_SPEED
  2009.       val  = obj.speed
  2010.       icon = IEO::Icon.stat( :speed )
  2011.     when :hit_r # (Hit Rate)
  2012.       vocab= IEO::Vocab::SKILL_LEVEL::HIT
  2013.       val  = obj.hit
  2014.       icon = IEO::Icon.stat( :hit_r )
  2015.     when :based # (Base Damage)
  2016.       vocab= IEO::Vocab::SKILL_LEVEL::DAMAGE
  2017.       val  = obj.base_damage
  2018.       icon = IEO::Icon.stat( :based )
  2019.     when :varia # (Variance)
  2020.       vocab= IEO::Vocab::SKILL_LEVEL::VARIANCE
  2021.       val  = obj.variance
  2022.       icon = IEO::Icon.stat( :varia )
  2023.     when :heal_ # (Heal Type - Base Damage)
  2024.       vocab= IEO::Vocab::SKILL_LEVEL::HEAL
  2025.       val  = obj.base_damage.abs
  2026.       icon = IEO::Icon.stat( :heal_ )
  2027.     else ; return false
  2028.     end
  2029.     return false unless draw0 if val.eql?(0)
  2030.     if icon > 0
  2031.       draw_icon(icon, rect.x, rect.y)
  2032.       rect.x += 24
  2033.     end  
  2034.     self.contents.font.size = 16
  2035.     self.contents.font.color = system_color
  2036.     self.contents.draw_text( rect, vocab )
  2037.     self.contents.font.color = normal_color
  2038.     self.contents.draw_text( rect, val, 2 )
  2039.     return true
  2040.   end
  2041.  
  2042. end  
  2043.  
  2044. #==============================================================================#
  2045. # ** Window_SKL_ActorStrip
  2046. #==============================================================================#
  2047. class Window_SKL_ActorStrip < Window_Selectable
  2048.  
  2049.   #--------------------------------------------------------------------------#
  2050.   # * Constants
  2051.   #--------------------------------------------------------------------------#
  2052.   ITEM_RECT      = Rect.new( 0, 0, 40, 40 )
  2053.   CHARACTER_RECT = Rect.new( 4, 4, 32, 32 )
  2054.  
  2055.   #--------------------------------------------------------------------------#
  2056.   # * method :initialize
  2057.   #--------------------------------------------------------------------------#
  2058.   def initialize( x, y )
  2059.     super( x, y, Graphics.width, CHARACTER_RECT.height+ITEM_RECT.height ) # 64
  2060.     self.index = 0
  2061.     @spacing = 4 ; @item_max = 1 ; @column_max = 1
  2062.     refresh()
  2063.   end
  2064.  
  2065.   #--------------------------------------------------------------------------#
  2066.   # * method :actor
  2067.   #--------------------------------------------------------------------------#
  2068.   def actor() ; return @data[self.index] end
  2069.  
  2070.   #--------------------------------------------------------------------------#
  2071.   # * method :item_rect
  2072.   #--------------------------------------------------------------------------#
  2073.   def item_rect( index )
  2074.     rect = Rect.new(0, 0, 0, 0)
  2075.     rect.width = ITEM_RECT.width*2
  2076.     rect.height = ITEM_RECT.height
  2077.    
  2078.     wd = ( rect.width + @spacing ) * @column_max
  2079.     ofx = ( self.contents.width - wd ) / 2
  2080.    
  2081.     rect.x = index % @column_max * ( rect.width + @spacing ) + ofx
  2082.     rect.y = index / @column_max * rect.height
  2083.    
  2084.     return rect
  2085.   end
  2086.  
  2087.   #--------------------------------------------------------------------------#
  2088.   # * method :refresh
  2089.   #--------------------------------------------------------------------------#
  2090.   def refresh()
  2091.     @data = $game_party.members.compact
  2092.     @item_max = @data.size()
  2093.     @column_max = [[1, @item_max].max, 12].min
  2094.     create_contents
  2095.     for i in 0...@item_max
  2096.       draw_item( i )  
  2097.     end
  2098.   end
  2099.  
  2100.   #--------------------------------------------------------------------------#
  2101.   # * method :draw_item
  2102.   #--------------------------------------------------------------------------#
  2103.   def draw_item( index, enabled = true )
  2104.     irect = item_rect( index )
  2105.     crect = irect.clone()
  2106.     crect.x    += CHARACTER_RECT.x     ; crect.y     += CHARACTER_RECT.y
  2107.     crect.width = CHARACTER_RECT.width ; crect.height = CHARACTER_RECT.height
  2108.     self.contents.clear_rect( irect )
  2109.     mem = @data[index]
  2110.     return if mem.nil?()
  2111.     # ---------------------------------------------------- #
  2112.     draw_actor_sprite( mem, crect.x, crect.y, enabled )
  2113.     crect.width = irect.width
  2114.     # ---------------------------------------------------- #
  2115.     draw_actor_skl_p( mem, crect.clone )
  2116.     # ---------------------------------------------------- #
  2117.   end
  2118.  
  2119.   #--------------------------------------------------------------------------#
  2120.   # * method :__force_update
  2121.   #--------------------------------------------------------------------------#  
  2122.   def __force_update ; return true end
  2123.    
  2124. end
  2125.  
  2126. #==============================================================================#
  2127. # ** Window_SKL_Level
  2128. #==============================================================================#
  2129. class Window_SKL_Level < Window_Selectable
  2130.  
  2131.   #--------------------------------------------------------------------------#
  2132.   # * Public Instance Variables
  2133.   #--------------------------------------------------------------------------#
  2134.   attr_accessor :refresh_call
  2135.   attr_accessor :skill
  2136.  
  2137.   #--------------------------------------------------------------------------#
  2138.   # * method :initialize
  2139.   #--------------------------------------------------------------------------#
  2140.   def initialize( x, y, width, height )
  2141.     super( x, y, width, height )
  2142.     @skill = nil
  2143.     self.index = 0
  2144.     @item_max = 1
  2145.   end
  2146.  
  2147.   #--------------------------------------------------------------------------#
  2148.   # * method :change_skill
  2149.   #--------------------------------------------------------------------------#
  2150.   def change_skill( new_skill )
  2151.     if @skill != new_skill
  2152.       @skill = new_skill
  2153.       refresh
  2154.     end  
  2155.   end  
  2156.  
  2157.   #--------------------------------------------------------------------------#
  2158.   # * method :item_rect
  2159.   #--------------------------------------------------------------------------#
  2160.   def item_rect( index )
  2161.     return Rect.new( 3, 37, self.contents.width - 26, 10 )
  2162.   end
  2163.  
  2164.   #--------------------------------------------------------------------------#
  2165.   # * method :create_contents
  2166.   #--------------------------------------------------------------------------#
  2167.   def create_contents()
  2168.     self.contents.dispose()
  2169.     maxbitmap = 8192
  2170.     dw = [width - 32, maxbitmap].min()
  2171.     dh = [[height - 32, row_max * WLH].max, maxbitmap].min
  2172.     bitmap = Bitmap.new(dw, dh)
  2173.     self.contents = bitmap
  2174.     self.contents.font.color = normal_color()
  2175.   end
  2176.  
  2177.   #--------------------------------------------------------------------------#
  2178.   # * method :refresh
  2179.   #--------------------------------------------------------------------------#
  2180.   def refresh()
  2181.     rect2 = Rect.new( 4, 4, self.contents.width - 28, WLH )
  2182.     create_contents()
  2183.     return if @skill.nil?()
  2184.     enabled = true
  2185.     rect = rect2.clone()
  2186.     rect.height = 8
  2187.     rect.y += 34
  2188.     # Limit Bar
  2189.     draw_grad_bar( rect, @skill.skl_unlocklevel, @skill.skl_maxlevel,
  2190.       normal_color, Color.new(200, 200, 200), Color.new(20, 20, 20),
  2191.       2, enabled )
  2192.     draw_grad_bar( rect, @skill.skl_level, @skill.skl_maxlevel,
  2193.       mp_gauge_color1, mp_gauge_color2, Color.new(20, 20, 20),
  2194.       2, enabled )
  2195.     self.contents.font.size = 16
  2196.     self.contents.font.color = normal_color()
  2197.     draw_item_name( @skill, rect2.x, rect2.y )
  2198.     self.contents.font.size = 16
  2199.     self.contents.font.color = normal_color()
  2200.     rect.height = 24
  2201.     rect.width -= 24
  2202.     rect.y -= 8
  2203.     text = sprintf( IEO::Vocab::SKILL_LEVEL::LEVEL_SUB, Vocab.level_a, @skill.skl_level, @skill.skl_unlocklevel )
  2204.     self.contents.draw_text( rect, text, 2 )
  2205.   end
  2206.  
  2207.   #--------------------------------------------------------------------------#
  2208.   # * method :update
  2209.   #--------------------------------------------------------------------------#
  2210.   def update()
  2211.     super()
  2212.     if Input.trigger?( Input::RIGHT )
  2213.       return if @skill.nil?()
  2214.       Sound.play_cursor()
  2215.       oldlevel = @skill.skl_level
  2216.       @skill.level_up( true )  
  2217.       Sound.play_buzzer if @skill.skl_level == oldlevel
  2218.       @refresh_call = true
  2219.     elsif Input.trigger?( Input::LEFT )  
  2220.       return if @skill.nil?()
  2221.       Sound.play_cursor()
  2222.       oldlevel = @skill.skl_level
  2223.       @skill.level_down( true )  
  2224.       Sound.play_buzzer if @skill.skl_level == oldlevel
  2225.       @refresh_call = true
  2226.     end  
  2227.   end
  2228.  
  2229. end  
  2230.  
  2231. #==============================================================================#
  2232. # ** Scene_Title
  2233. #==============================================================================#
  2234. class Scene_Title < Scene_Base
  2235.  
  2236.   #--------------------------------------------------------------------------#
  2237.   # * alias-method :load_database
  2238.   #--------------------------------------------------------------------------#
  2239.   alias :ieo011_sct_load_database :load_database unless $@
  2240.   def load_database()
  2241.     ieo011_sct_load_database()
  2242.     load_ieo011_cache()
  2243.   end
  2244.  
  2245.   #--------------------------------------------------------------------------#
  2246.   # * alias-method :load_bt_database
  2247.   #--------------------------------------------------------------------------#
  2248.   alias :ieo011_sct_load_bt_database :load_database unless $@
  2249.   def load_bt_database()
  2250.     ieo011_sct_load_bt_database()
  2251.     load_ieo011_cache()
  2252.   end  
  2253.  
  2254.   #--------------------------------------------------------------------------#
  2255.   # * new-method :load_ieo011_cache
  2256.   #--------------------------------------------------------------------------#
  2257.   def load_ieo011_cache()
  2258.     objs = [$data_items, $data_skills, $data_enemies]
  2259.     objs.each { |group| group.each { |obj| next if obj.nil?
  2260.       obj.ieo011_itemcache()  if obj.is_a?(RPG::Item)
  2261.       obj.ieo011_skillcache() if obj.is_a?(RPG::Skill)
  2262.       obj.ieo011_enemycache() if obj.is_a?(RPG::Enemy) } }
  2263.   end
  2264.  
  2265. end
  2266.  
  2267. if $imported["ISS-MGPAS"]
  2268. #==============================================================================#
  2269. # ** ISS::MGPAS
  2270. #==============================================================================#
  2271. module ISS::MGPAS
  2272.  
  2273.   class << self
  2274.     #--------------------------------------------------------------------------#
  2275.     # * alias-method :write_save_data
  2276.     #--------------------------------------------------------------------------#
  2277.     alias :ieo011_scf_write_save_data :write_save_data unless $@
  2278.     def write_save_data( file )
  2279.       ieo011_scf_write_save_data( file )
  2280.       Marshal.dump( $data_skills, file )
  2281.     end  
  2282.  
  2283.     #--------------------------------------------------------------------------#
  2284.     # * alias-method :read_save_data
  2285.     #--------------------------------------------------------------------------#
  2286.     alias :ieo011_scf_read_save_data :read_save_data unless $@
  2287.     def read_save_data( file )
  2288.       ieo011_scf_read_save_data( file )
  2289.       $data_skills = Marshal.load( file )
  2290.     end
  2291.   end  
  2292.  
  2293. end
  2294.  
  2295. else
  2296. #==============================================================================#
  2297. # ** Scene_File
  2298. #==============================================================================#
  2299. class Scene_File < Scene_Base
  2300.  
  2301.   #--------------------------------------------------------------------------#
  2302.   # * alias-method :write_save_data
  2303.   #--------------------------------------------------------------------------#
  2304.   alias :ieo011_scf_write_save_data :write_save_data unless $@
  2305.   def write_save_data( file )
  2306.     ieo011_scf_write_save_data( file )
  2307.     Marshal.dump( $data_skills, file )
  2308.   end
  2309.  
  2310.   #--------------------------------------------------------------------------#
  2311.   # * alias-method :read_save_data
  2312.   #--------------------------------------------------------------------------#
  2313.   alias :ieo011_scf_read_save_data :read_save_data unless $@
  2314.   def read_save_data( file )
  2315.     ieo011_scf_read_save_data( file )
  2316.     $data_skills = Marshal.load( file )
  2317.   end
  2318.  
  2319. end
  2320.  
  2321. end if IEO::SKILL_LEVEL::SKLMODE == 3
  2322.  
  2323. #==============================================================================#
  2324. # ** Scene_Battle
  2325. #==============================================================================#
  2326. class Scene_Battle < Scene_Base
  2327.  
  2328.   #--------------------------------------------------------------------------#
  2329.   # * new-method :perform_skl_p_gain
  2330.   #--------------------------------------------------------------------------#  
  2331.   def perform_skl_p_gain( type = :attack, battler = nil )
  2332.     return if battler.nil?()
  2333.     IEO::SKILL_LEVEL.skl_p_gain( type, battler )
  2334.   end
  2335.  
  2336.   #--------------------------------------------------------------------------#
  2337.   # * alias-method :execute_action_attack
  2338.   #--------------------------------------------------------------------------#
  2339.   alias :ieo011_scb_execute_action_attack :execute_action_attack unless $@
  2340.   def execute_action_attack()
  2341.     ieo011_scb_execute_action_attack()
  2342.     perform_skl_p_gain( :attack, @active_battler )
  2343.   end
  2344.  
  2345.   #--------------------------------------------------------------------------#
  2346.   # * alias-method :execute_action_guard
  2347.   #--------------------------------------------------------------------------#
  2348.   alias :ieo011_scb_execute_action_guard :execute_action_guard unless $@
  2349.   def execute_action_guard()
  2350.     ieo011_scb_execute_action_guard()
  2351.     perform_skl_p_gain( :guard, @active_battler )
  2352.   end
  2353.  
  2354.   #--------------------------------------------------------------------------#
  2355.   # * alias-method :execute_action_skill
  2356.   #--------------------------------------------------------------------------#
  2357.   alias :ieo011_scb_execute_action_skill :execute_action_skill unless $@
  2358.   def execute_action_skill()
  2359.     ieo011_scb_execute_action_skill()
  2360.     perform_skl_p_gain( :skill, @active_battler )
  2361.   end
  2362.  
  2363.   #--------------------------------------------------------------------------#
  2364.   # * alias-method :execute_action_item
  2365.   #--------------------------------------------------------------------------#
  2366.   alias :ieo011_scb_execute_action_item :execute_action_item unless $@
  2367.   def execute_action_item()
  2368.     ieo011_scb_execute_action_item()
  2369.     perform_skl_p_gain( :item, @active_battler )
  2370.   end
  2371.  
  2372.   #--------------------------------------------------------------------------#
  2373.   # * alias-method :battle_end
  2374.   #--------------------------------------------------------------------------#
  2375.   alias :ieo011_scb_battle_end :battle_end unless $@
  2376.   def battle_end( result )
  2377.     $game_troop.distribute_skl_p()
  2378.     ieo011_scb_battle_end( result )
  2379.   end
  2380.  
  2381. end
  2382.  
  2383. #==============================================================================#
  2384. # ** Scene_SkillForge
  2385. #==============================================================================#
  2386. class Scene_SkillForge < Scene_Base
  2387.  
  2388.   include IEX::SCENE_ACTIONS if $imported["IEX_SceneActions"]
  2389.  
  2390.   #--------------------------------------------------------------------------#
  2391.   # * Constants
  2392.   #--------------------------------------------------------------------------#
  2393.   SLIDY_WINDOWS = IEO::SKILL_LEVEL::SLIDY_WINDOWS
  2394.   SLIDY_WINDOWS = ($imported["IEX_SceneActions"] && SLIDY_WINDOWS)
  2395.  
  2396.   #--------------------------------------------------------------------------#
  2397.   # * method :initialize
  2398.   #--------------------------------------------------------------------------#
  2399.   def initialize( actor, lock_upgrade = nil, called = :map, return_index=0 )
  2400.     super()
  2401.     unless $imported["ICY_Bitmap_Xtended"]
  2402.       raise "ICY - BitmapExtended Not Present, cannot continue"
  2403.       exit
  2404.     end  
  2405.     lock_upgrade = !$game_system.can_upgrade_skills if lock_upgrade.eql?(nil)
  2406.     # ---------------------------------------------------- #
  2407.     @calledfrom = called
  2408.     @return_index = return_index
  2409.     # ---------------------------------------------------- #
  2410.     @actor = nil
  2411.     @act_index = 0
  2412.     @index_call = false
  2413.     # ---------------------------------------------------- #
  2414.     if actor.kind_of?( Game_Battler )
  2415.       @actor = actor
  2416.     elsif actor != nil  
  2417.       @actor = $game_party.members[actor]
  2418.       @act_index = actor
  2419.       @index_call = true
  2420.     end
  2421.     # ---------------------------------------------------- #
  2422.     lock_upgrade = !$game_system.can_upgrade_skills if lock_upgrade.nil?()
  2423.     @lock_upgrade = lock_upgrade
  2424.   end
  2425.  
  2426.   #--------------------------------------------------------------------------#
  2427.   # * method :start
  2428.   #--------------------------------------------------------------------------#
  2429.   def start()
  2430.     # ---------------------------------------------------- #
  2431.     super()
  2432.     create_menu_background()
  2433.     # ---------------------------------------------------- #
  2434.     @iwps = [Graphics.width / 2, Graphics.height / 2,
  2435.       Graphics.width, Graphics.height]
  2436.     iwps  = @iwps
  2437.     # ---------------------------------------------------- #
  2438.     @windows = { }
  2439.     # ---------------------------------------------------- #
  2440.     @windows["Party"] = Window_SKL_ActorStrip.new( 0, 0 )
  2441.     @windows["Party"].active = false
  2442.     @windows["Party"].index = @act_index
  2443.     @windows["Party"].update_cursor()
  2444.     # ---------------------------------------------------- #
  2445.     sh = iwps[1]
  2446.     @windows["Skill"] = Window_Skill.new( 0, @windows["Party"].height,
  2447.       iwps[0], sh, @windows["Party"].actor )
  2448.     @windows["Skill"].column_max = 1
  2449.     @windows["Skill"].refresh
  2450.     @windows["Skill"].update_cursor()
  2451.     # ---------------------------------------------------- #
  2452.     @windows["SStat"] = Window_SKL_Help.new(
  2453.       @windows["Skill"].width, @windows["Party"].height,
  2454.       iwps[0], iwps[3]-@windows["Party"].height )
  2455.     @windows["SStat"].set_obj( @windows["Skill"].skill )
  2456.     # ---------------------------------------------------- #
  2457.     @windows["Level"] = Window_SKL_Level.new(
  2458.       0, @windows["Skill"].y + @windows["Skill"].height,
  2459.       iwps[0], iwps[3] - ( @windows["Skill"].y + @windows["Skill"].height) )
  2460.     # ---------------------------------------------------- #
  2461.    
  2462.     # ---------------------------------------------------- #
  2463.     #(windows, value, rates=[DROP_RATE, RETURN_RATE], mult=1)
  2464.     if SLIDY_WINDOWS
  2465.       # ---------------------------------------------------- #
  2466.       pull_windows_right( ["SStat"], @windows["SStat"].width, [1, 1] )
  2467.       pull_windows_left( ["Level", "Skill"], @windows["Skill"].width, [1, 1] )
  2468.       pull_windows_up( ["Party"], @windows["Party"].height, [1, 1] )
  2469.       # ---------------------------------------------------- #
  2470.     end
  2471.     @startup = true
  2472.     # ---------------------------------------------------- #
  2473.   end
  2474.  
  2475.   #--------------------------------------------------------------------------#
  2476.   # * method :terminate
  2477.   #--------------------------------------------------------------------------#
  2478.   def terminate()
  2479.     # ---------------------------------------------------- #
  2480.     super()
  2481.     # ---------------------------------------------------- #
  2482.     dispose_menu_background()
  2483.     # ---------------------------------------------------- #
  2484.     @windows.values.compact.each { |win| win.dispose }
  2485.     # ---------------------------------------------------- #
  2486.   end  
  2487.  
  2488.   #--------------------------------------------------------------------------#
  2489.   # * method :return_scene
  2490.   #--------------------------------------------------------------------------#
  2491.   def return_scene()
  2492.     if SLIDY_WINDOWS
  2493.       # ---------------------------------------------------- #
  2494.       pull_windows_right(["SStat"], @windows["SStat"].width)
  2495.       pull_windows_left(["Level", "Skill"], @windows["Skill"].width)
  2496.       pull_windows_up(["Party"], @windows["Party"].height)
  2497.       # ---------------------------------------------------- #
  2498.     end
  2499.     case @calledfrom
  2500.     when :map
  2501.       $scene = Scene_Map.new()
  2502.     when :menu
  2503.       $scene = Scene_Menu.new( @return_index )
  2504.     end  
  2505.   end
  2506.  
  2507.   #--------------------------------------------------------------------------#
  2508.   # * method :update
  2509.   #--------------------------------------------------------------------------#  
  2510.   def update()
  2511.     # ---------------------------------------------------- #
  2512.     super()
  2513.     # ---------------------------------------------------- #
  2514.     update_party_shift()
  2515.     # ---------------------------------------------------- #
  2516.     if Input.trigger?( Input::C ) and !@lock_upgrade
  2517.     # ---------------------------------------------------- #
  2518.       skill = @windows["Skill"].skill()
  2519.       actor = @windows["Party"].actor()
  2520.       # ---------------------------------------------------- #
  2521.       unless skill.nil?() or actor.nil?()
  2522.         if actor.can_upgrade_skill?( skill, skill.get_nextlevel(1), false )
  2523.         # ---------------------------------------------------- #
  2524.           Sound.play_recovery()
  2525.           actor.upgrade_skill( skill, skill.get_nextlevel(1), false )
  2526.           @windows["Level"].refresh
  2527.           @windows["Skill"].draw_item( @windows["Skill"].index )
  2528.           @windows["Party"].refresh
  2529.           @windows["SStat"].set_obj( @windows["Skill"].skill, true )
  2530.         # ---------------------------------------------------- #
  2531.         else ; Sound.play_buzzer
  2532.         # ---------------------------------------------------- #
  2533.         end
  2534.       # ---------------------------------------------------- #
  2535.       else ; Sound.play_buzzer
  2536.       # ---------------------------------------------------- #  
  2537.       end  
  2538.     # ---------------------------------------------------- #
  2539.     elsif Input.trigger?( Input::B )
  2540.     # ---------------------------------------------------- #
  2541.       Sound.play_cancel
  2542.       return_scene()
  2543.     # ---------------------------------------------------- #
  2544.     end  
  2545.     # ---------------------------------------------------- #
  2546.     if @startup
  2547.       if SLIDY_WINDOWS
  2548.         pull_windows_down( ["Party"], @windows["Party"].height )
  2549.         pull_windows_right( ["Level", "Skill"], @windows["Skill"].width )
  2550.         pull_windows_left( ["SStat"], @windows["SStat"].width )
  2551.       end  
  2552.       @startup = false
  2553.     end  
  2554.     # ---------------------------------------------------- #
  2555.     if @windows["Level"].refresh_call
  2556.       @windows["Level"].refresh_call = false
  2557.       @windows["Level"].refresh()
  2558.       @windows["Skill"].draw_item( @windows["Skill"].index )
  2559.       @windows["SStat"].set_obj( @windows["Skill"].skill, true )
  2560.     end
  2561.     # ---------------------------------------------------- #
  2562.     @windows["SStat"].set_obj( @windows["Skill"].skill )
  2563.     @windows["Level"].change_skill( @windows["Skill"].skill )
  2564.     # ---------------------------------------------------- #
  2565.     @windows.values.compact.each { |win|
  2566.       win.update() if win.active or win.__force_update
  2567.     }
  2568.     # ---------------------------------------------------- #
  2569.   end
  2570.  
  2571.   #--------------------------------------------------------------------------#
  2572.   # * method :update_party_shift
  2573.   #--------------------------------------------------------------------------#
  2574.   def update_party_shift()
  2575.     # ---------------------------------------------------- #
  2576.     if Input.trigger?(Input::Y)
  2577.     # ---------------------------------------------------- #  
  2578.       Sound.play_cursor
  2579.       @windows["Party"].index = @windows["Party"].index + 1
  2580.       @windows["Party"].index%= @windows["Party"].item_max
  2581.       @windows["Skill"].actor = @windows["Party"].actor
  2582.       @windows["Skill"].index = 0
  2583.       @windows["Skill"].refresh()
  2584.       Graphics.frame_reset()
  2585.     # ---------------------------------------------------- #  
  2586.     elsif Input.trigger?(Input::X)      
  2587.     # ---------------------------------------------------- #  
  2588.       Sound.play_cursor
  2589.       @windows["Party"].index = @windows["Party"].index - 1
  2590.       @windows["Party"].index%= @windows["Party"].item_max
  2591.       @windows["Skill"].actor = @windows["Party"].actor
  2592.       @windows["Skill"].index = 0
  2593.       @windows["Skill"].refresh()
  2594.       Graphics.frame_reset()
  2595.     # ---------------------------------------------------- #
  2596.     end
  2597.   end
  2598.  
  2599. end
  2600. #==============================================================================#
  2601. IEO::REGISTER.log_script( 11, "SkillLevelSystem", 1.4 ) if $imported["IEO-Register"]
  2602. #=*==========================================================================*=#
  2603. # ** END OF FILE
  2604. #=*==========================================================================*=#
  2605.  
Advertisement
Add Comment
Please, Sign In to add comment