Guest User

Illuminate's YEZ Skill Command Selection

a guest
Mar 22nd, 2014
147
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #===============================================================================
  2. #
  3. # Yanfly Engine Zealous - Skill Command Selection
  4. # Last Date Updated: 2010.01.28
  5. # Level: Normal
  6. #
  7. # This script basically functions as a bridge inbetween many YEZ scripts in
  8. # addition to making all of the skill-related YEZ scripts accessible from one
  9. # common place. Menu searching and surfing can become quite annoying for the
  10. # player and this script's main purpose is to minimize that annoyance.
  11. #
  12. #===============================================================================
  13. # Updates
  14. # -----------------------------------------------------------------------------
  15. # o 2010.01.28 - Efficiency update.
  16. # o 2010.01.20 - Passive equipping efficiency update.
  17. # o 2010.01.12 - Job System: Passives Compatibility.
  18. # o 2010.01.05 - Job System: Classes Compatibility.
  19. # o 2010.01.03 - Mastery refresh window bugfix.
  20. # o 2009.01.01 - Job System: Skill Levels Compatibility.
  21. #              - Efficiency update.
  22. # o 2009.12.30 - Started Script and Finished Script.
  23. #===============================================================================
  24. # Instructions
  25. # -----------------------------------------------------------------------------
  26. # To install this script, open up your script editor and copy/paste this script
  27. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  28. #
  29. # -----------------------------------------------------------------------------
  30. # Debug Shortcuts - Only during $TEST and $BTEST mode
  31. # -----------------------------------------------------------------------------
  32. # During testplay mode, pressing F5 during the command window selection process
  33. # or the skill selection process will recover all of the actor's MP.
  34. #
  35. #===============================================================================
  36. # Compatibility
  37. # -----------------------------------------------------------------------------
  38. # - Works With: YEZ Status Command Menu, YEZ Job System: Base
  39. # -----------------------------------------------------------------------------
  40. # Note: This script may not work with former Yanfly Engine ReDux scripts.
  41. #       Use Yanfly Engine Zealous scripts to work with this if available.
  42. #===============================================================================
  43.  
  44. $imported = {} if $imported == nil
  45. $imported["SkillCommandSelection"] = true
  46.  
  47. module YEZ
  48.   module SKILL
  49.    
  50.     #===========================================================================
  51.     # Basic Settings
  52.     # --------------------------------------------------------------------------
  53.     # The following below will adjust the basic settings and vocabulary that
  54.     # will display throughout the script. Change them as you see fit.
  55.     #===========================================================================
  56.    
  57.     # The following array determines the commands that appear in the command
  58.     # window at the skill scene's upper left corner.
  59.     COMMANDS =[
  60.       :view_skills, # View all skills.
  61.       :learn_skill, # Requires Job System: Base
  62.     # :level_skill, # Requires Job System: Skill Levels
  63.     #  :equip_state, # Requires Job System: Passives
  64.     # :learn_state, # Requires Job System: Passives
  65.     # :mastery,     # Requires Weapon Mastery Skills
  66.     ] # Do not remove this.
  67.    
  68.     # If you would like the command window to have centered alignment for text,
  69.     # set this to true. Otherwise, setting it to false will have left alignment.
  70.     CENTERED_COMMAND = true
  71.    
  72.     # The following determines the vocabulary used for the remade skill scene.
  73.     VOCAB ={
  74.       :view_skills => "View All",
  75.       :equip_state => "Add Passive",
  76.       :learn_state => "New Passive",
  77.     } # Do not remove this.
  78.    
  79.   end # SKILL
  80. end # YEZ
  81.  
  82. #===============================================================================
  83. # Editting anything past this point may potentially result in causing computer
  84. # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
  85. # Therefore, edit at your own risk.
  86. #===============================================================================
  87.  
  88. #===============================================================================
  89. # Game_Temp
  90. #===============================================================================
  91.  
  92. class Game_Temp
  93.  
  94.   #--------------------------------------------------------------------------
  95.   # public instance variables
  96.   #--------------------------------------------------------------------------
  97.   attr_accessor :scs_on
  98.   attr_accessor :scs_oy
  99.  
  100. end # Game_Temp
  101.  
  102. #===============================================================================
  103. # Scene_Skill
  104. #===============================================================================
  105.  
  106. class Scene_Skill < Scene_Base
  107.  
  108.   #--------------------------------------------------------------------------
  109.   # alias method: initialize
  110.   #--------------------------------------------------------------------------
  111.   alias initialize_scs initialize unless $@
  112.   def initialize(actor_index = 0, last_index = 0)
  113.     initialize_scs(actor_index, last_index)
  114.     @last_index = last_index
  115.     $game_temp.scs_on = true
  116.   end
  117.  
  118.   #--------------------------------------------------------------------------
  119.   # overwrite method: start
  120.   #--------------------------------------------------------------------------
  121.   def start
  122.     super
  123.     create_menu_background
  124.     @actor = $game_party.members[@actor_index]
  125.     $game_party.last_actor_index = @actor_index
  126.     @viewport = Viewport.new(0, 0, 544, 416)
  127.     @help_window = Window_Help.new
  128.     @help_window.viewport = @viewport
  129.     @help_window.y = 128
  130.     if $imported["JobSystemBase"]
  131.       @status_window = Window_JP_Actor.new(@actor)
  132.     elsif $imported["StatusCommandMenu"]
  133.       @status_window = Window_Status_Actor.new(@actor)
  134.     else
  135.       @status_window = Window_Skill_Actor.new(@actor)
  136.     end
  137.     @status_window.viewport = @viewport
  138.     if $imported["JobSystemClasses"] and @actor.all_unlocked_classes.size > 1
  139.       @class_window = Window_Class_List.new(@actor, 0, @help_window.y +
  140.       @help_window.height)
  141.       @class_window.help_window = @help_window
  142.       @classdata_window = Window_Class_Info.new(@class_window.width,
  143.         @class_window.y, @actor)
  144.       @class_window.y = 416*3
  145.       @classdata_window.y = @class_window.y
  146.     end
  147.     create_command_window
  148.     @target_window = Window_MenuStatus.new(0, 0)
  149.     hide_target_window
  150.   end
  151.  
  152.   #--------------------------------------------------------------------------
  153.   # overwrite method: terminate
  154.   #--------------------------------------------------------------------------
  155.   def terminate
  156.     super
  157.     dispose_menu_background
  158.     @help_window.dispose if @help_window != nil
  159.     @status_window.dispose if @status_window != nil
  160.     @target_window.dispose if @target_window != nil
  161.     @command_window.dispose if @command_window != nil
  162.     @learndata_window.dispose if @learndata_window != nil
  163.     @leveldata_window.dispose if @leveldata_window != nil
  164.     @class_window.dispose if @class_window != nil
  165.     @classdata_window.dispose if @classdata_window != nil
  166.     @stapas_window.dispose if @stapas_window != nil
  167.     @eqpaslist_window.dispose if @eqpaslist_window != nil
  168.     @eqpasstat_window.dispose if @eqpasstat_window != nil
  169.     @lepasdata_window.dispose if @lepasdata_window != nil
  170.     @clpasdata_window.dispose if @clpasdata_window != nil
  171.     dispose_mini_windows
  172.   end
  173.  
  174.   #--------------------------------------------------------------------------
  175.   # new method: create_command_window
  176.   #--------------------------------------------------------------------------
  177.   def create_command_window
  178.     commands = []; @data = []; @mini_windows = {}
  179.     for command in YEZ::SKILL::COMMANDS
  180.       case command
  181.       when :view_skills
  182.         @skill_window = Window_Skill.new(0, 184, 544, 232, @actor)
  183.         @skill_window.viewport = @viewport
  184.         @skill_window.help_window = @help_window
  185.         @skill_window.active = false
  186.         @mini_windows[@data.size] = @skill_window
  187.         commands.push(YEZ::SKILL::VOCAB[command])
  188.        
  189.       when :learn_skill
  190.         next unless $imported["JobSystemBase"]
  191.         next unless $game_switches[YEZ::JOB::LEARN_ENABLE_SWITCH]
  192.         dy = @status_window.height + @help_window.height
  193.         @learnskill_window = Window_LearnSkill.new(0, dy, @actor)
  194.         @learndata_window = Window_LearnData.new(@learnskill_window.width,
  195.           @learnskill_window.y, @learnskill_window.skill, @actor, @actor.class_id)
  196.         @learnskill_window.help_window = @help_window
  197.         @learnskill_window.active = false
  198.         @mini_windows[@data.size] = @learnskill_window
  199.         commands.push(YEZ::JOB::LEARN_TITLE)
  200.        
  201.       when :level_skill
  202.         next unless $imported["JobSystemSkillLevels"]
  203.         next unless $game_switches[YEZ::JOB::LEVEL_ENABLE_SWITCH]
  204.         dy = @status_window.height + @help_window.height
  205.         @levelskill_window = Window_LevelSkill.new(0, dy, @actor)
  206.         @leveldata_window = Window_LevelData.new(@levelskill_window.width,
  207.           @levelskill_window.y, @levelskill_window.skill, @actor, @actor.class_id)
  208.         @levelskill_window.help_window = @help_window
  209.         @levelskill_window.active = false
  210.         @mini_windows[@data.size] = @levelskill_window
  211.         commands.push(YEZ::JOB::LEVEL_TITLE)
  212.        
  213.       when :equip_state
  214.         next unless $imported["JobSystemPassives"]
  215.         next unless $game_switches[YEZ::JOB::ENABLE_PASSIVE_SWITCH]
  216.         create_passive_windows
  217.         @equippas_window = Window_PassiveEquip.new(0, @help_window.y +
  218.           @help_window.height, @actor)
  219.         @equippas_window.help_window = @help_window
  220.         @eqpaslist_window = Window_PassiveEquipList.new(0, @equippas_window.y,
  221.           @actor)
  222.         @eqpaslist_window.help_window = @help_window
  223.         @eqpasstat_window = Window_PassiveEquipStat.new(@eqpaslist_window.width,
  224.           @eqpaslist_window.y, @actor)
  225.         @mini_windows[@data.size] = @equippas_window
  226.         commands.push(YEZ::SKILL::VOCAB[command])
  227.        
  228.       when :learn_state
  229.         next unless $imported["JobSystemPassives"]
  230.         next unless $game_switches[YEZ::JOB::ENABLE_PASSIVE_SWITCH]
  231.         create_passive_windows
  232.         @learnpas_window = Window_LearnPassive.new(0, @help_window.y +
  233.           @help_window.height, @actor)
  234.         @learnpas_window.help_window = @help_window
  235.         @lepasdata_window = Window_LearnPassiveData.new(@learnpas_window.width,
  236.         @learnpas_window.y, @learnpas_window.passive, @actor)
  237.         @learnpas_window.active = false
  238.         @clpasdata_window = Window_Class_PassiveInfo.new(@class_window.width,
  239.           @learnpas_window.y, @actor) if @class_window != nil
  240.         @mini_windows[@data.size] = @learnpas_window
  241.         commands.push(YEZ::SKILL::VOCAB[command])
  242.        
  243.       when :mastery
  244.         next unless $imported["WeaponMasterySkills"]
  245.         @mastery_window = Window_Mastery.new(0, 128, @actor, true)
  246.         @mini_windows[@data.size] = @mastery_window
  247.         commands.push(YEZ::WEAPON_MASTERY::TITLE)
  248.        
  249.       else; next
  250.       end
  251.       @data.push(command)
  252.     end
  253.     if YEZ::SKILL::CENTERED_COMMAND
  254.       @command_window = Window_Command_Centered.new(160, commands)
  255.     else
  256.       @command_window = Window_Command.new(160, commands)
  257.     end
  258.     @command_window.height = 128
  259.     @command_window.oy = $game_temp.scs_oy if $game_temp.scs_oy != nil
  260.     @command_window.index = @last_index
  261.     @command_window.active = true
  262.     @command_window.viewport = @viewport
  263.     update_mini_windows
  264.   end
  265.  
  266.   #--------------------------------------------------------------------------
  267.   # new method: update_mini_windows
  268.   #--------------------------------------------------------------------------
  269.   def update_mini_windows
  270.     @last_index = @command_window.index
  271.     @status_window.y = 0
  272.     @class_window.y = 416*3 if @class_window != nil
  273.     @classdata_window.y = @class_window.y if @classdata_window != nil
  274.     @learndata_window.y = 416*3 if @learndata_window != nil
  275.     @leveldata_window.y = 416*3 if @leveldata_window != nil
  276.     @eqpaslist_window.y = 416*3 if @eqpaslist_window != nil
  277.     @eqpasstat_window.y = 416*3 if @eqpasstat_window != nil
  278.     @stapas_window.y = 416*3 if @stapas_window != nil
  279.     @lepasdata_window.y = 416*3 if @lepasdata_window != nil
  280.     @clpasdata_window.y = 416*3 if @clpasdata_window != nil
  281.     class_id = @status_window.class
  282.     for i in 0..(@mini_windows.size-1)
  283.       @mini_windows[i].y = 416*3
  284.     end
  285.     case @mini_windows[@last_index]
  286.     when @skill_window
  287.       @help_window.visible = true
  288.       @skill_window.refresh
  289.       @mini_windows[@last_index].update_help
  290.       @mini_windows[@last_index].y = @status_window.height
  291.       @mini_windows[@last_index].y += @help_window.height if @help_window.visible
  292.     when @learnskill_window
  293.       @help_window.visible = true
  294.       if @class_window != nil
  295.         @class_window.y = @status_window.height + @help_window.height
  296.         @classdata_window.y = @class_window.y
  297.         @class_window.update_help
  298.         return
  299.       end
  300.       @learnskill_window.refresh(class_id)
  301.       @learndata_window.y = @status_window.height + @help_window.height
  302.       @learndata_window.refresh(@learnskill_window.skill, @status_window.class)
  303.       @mini_windows[@last_index].update_help
  304.       @mini_windows[@last_index].y = @status_window.height
  305.       @mini_windows[@last_index].y += @help_window.height if @help_window.visible
  306.     when @levelskill_window
  307.       @help_window.visible = true
  308.       if @class_window != nil
  309.         @class_window.y = @status_window.height + @help_window.height
  310.         @classdata_window.y = @class_window.y
  311.         @class_window.update_help
  312.         return
  313.       end
  314.       @levelskill_window.refresh(class_id)
  315.       @leveldata_window.y = @status_window.height + @help_window.height
  316.       @leveldata_window.refresh(@levelskill_window.skill, @status_window.class)
  317.       @mini_windows[@last_index].update_help
  318.       @mini_windows[@last_index].y = @status_window.height
  319.       @mini_windows[@last_index].y += @help_window.height if @help_window.visible
  320.     when @equippas_window
  321.       @equippas_window.refresh
  322.       @stapas_window.refresh
  323.       @eqpasstat_window.refresh
  324.       @help_window.visible = true
  325.       @stapas_window.y = 0
  326.       @status_window.y = 416*3
  327.       @equippas_window.y = @help_window.height + @help_window.y
  328.       @eqpasstat_window.y = @equippas_window.y
  329.       @equippas_window.update_help
  330.     when @learnpas_window
  331.       @learnpas_window.refresh(@stapas_window.class)
  332.       @help_window.visible = true
  333.       @stapas_window.y = 0
  334.       @status_window.y = 416*3
  335.       if @class_window != nil
  336.         @class_window.y = @status_window.height + @help_window.height
  337.         @clpasdata_window.y = @class_window.y
  338.         @class_window.update_help
  339.         return
  340.       end
  341.       @learnpas_window.y = @help_window.height + @help_window.y
  342.       @lepasdata_window.y = @learnpas_window.y
  343.       @learnpas_window.update_help
  344.      
  345.     when @mastery_window
  346.       @help_window.visible = false
  347.       @mini_windows[@last_index].y = @status_window.height
  348.     end
  349.   end
  350.  
  351.   #--------------------------------------------------------------------------
  352.   # new method: dispose_mini_windows
  353.   #--------------------------------------------------------------------------
  354.   def dispose_mini_windows
  355.     for i in 0..(@mini_windows.size-1)
  356.       next if @mini_windows[i] == nil
  357.       @mini_windows[i].dispose
  358.       @mini_windows[i] = nil
  359.     end
  360.   end
  361.  
  362.   #--------------------------------------------------------------------------
  363.   # new method: refresh_windows
  364.   #--------------------------------------------------------------------------
  365.   def refresh_windows(class_id = nil)
  366.     @status_window.refresh(class_id) if @status_window != nil
  367.     @class_window.refresh if @class_window != nil
  368.     @classdata_window.refresh(class_id) if @classdata_window != nil
  369.   end
  370.  
  371.   #--------------------------------------------------------------------------
  372.   # new method: old_refresh_windows
  373.   #--------------------------------------------------------------------------
  374.   def old_refresh_windows(class_id = nil)
  375.     @status_window.refresh(class_id) if @status_window != nil
  376.     @skill_window.refresh if @skill_window != nil
  377.     @class_window.refresh if @class_window != nil
  378.     @classdata_window.refresh(class_id) if @classdata_window != nil
  379.     @learnskill_window.refresh(class_id) if @learnskill_window != nil
  380.     @levelskill_window.refresh(class_id) if @levelskill_window != nil
  381.     @equippas_window.refresh if @equippas_window != nil
  382.     @stapas_window.refresh if @stapas_window != nil
  383.     @eqpasstat_window.refresh if @eqpasstat_window != nil
  384.     @learnpas_window.refresh(@stapas_window.class) if @learnpas_window != nil
  385.   end
  386.  
  387.   #--------------------------------------------------------------------------
  388.   # alias method: return_scene
  389.   #--------------------------------------------------------------------------
  390.   alias return_scene_scs return_scene
  391.   def return_scene
  392.     $game_temp.scs_oy = nil
  393.     $game_temp.scs_on = nil
  394.     return_scene_scs
  395.   end
  396.  
  397.   #--------------------------------------------------------------------------
  398.   # overwrite method: next_actor
  399.   #--------------------------------------------------------------------------
  400.   def next_actor
  401.     $game_temp.scs_oy = @command_window.oy
  402.     @actor_index += 1
  403.     @actor_index %= $game_party.members.size
  404.     $scene = Scene_Skill.new(@actor_index, @last_index)
  405.   end
  406.  
  407.   #--------------------------------------------------------------------------
  408.   # overwrite method: prev_actor
  409.   #--------------------------------------------------------------------------
  410.   def prev_actor
  411.     $game_temp.scs_oy = @command_window.oy
  412.     @actor_index += $game_party.members.size - 1
  413.     @actor_index %= $game_party.members.size
  414.     $scene = Scene_Skill.new(@actor_index, @last_index)
  415.   end
  416.  
  417.   #--------------------------------------------------------------------------
  418.   # overwrite method: update
  419.   #--------------------------------------------------------------------------
  420.   def update
  421.     super
  422.     update_menu_background
  423.     @help_window.update
  424.     if @command_window.active
  425.       update_command_selection
  426.     elsif @subskill_window != nil and @subskill_window.active
  427.       update_subskill_window
  428.     elsif @learnskill_window != nil and @learnskill_window.active
  429.       update_learnskill_selection
  430.     elsif @levelskill_window != nil and @levelskill_window.active
  431.       update_levelskill_selection
  432.     elsif @equippas_window != nil and @equippas_window.active
  433.       update_equippas_selection
  434.     elsif @eqpaslist_window != nil and @eqpaslist_window.active
  435.       update_equiplist_selection
  436.     elsif @learnpas_window != nil and @learnpas_window.active
  437.       update_learnpassive_selection
  438.     elsif @class_window != nil and @class_window.active
  439.       update_class_selection
  440.     elsif @skill_window.active
  441.       @skill_window.update
  442.       update_skill_selection
  443.     elsif @target_window.active
  444.       @target_window.update
  445.       update_target_selection
  446.     end
  447.   end
  448.  
  449.   #--------------------------------------------------------------------------
  450.   # new method: update_command_selection
  451.   #--------------------------------------------------------------------------
  452.   def update_command_selection
  453.     @command_window.update
  454.     update_mini_windows if @last_index != @command_window.index
  455.     if Input.trigger?(Input::B)
  456.       Sound.play_cancel
  457.       return_scene
  458.     elsif $TEST and Input.trigger?(Input::F5)  # Debug MP Recovery
  459.       Sound.play_recovery
  460.       @actor.mp += @actor.maxmp
  461.       @status_window.refresh
  462.       @skill_window.refresh if @skill_window.visible
  463.     elsif Input.repeat?(Input::RIGHT)
  464.       Sound.play_cursor
  465.       next_actor
  466.     elsif Input.repeat?(Input::LEFT)
  467.       Sound.play_cursor
  468.       prev_actor
  469.     elsif Input.trigger?(Input::C)
  470.       Sound.play_decision
  471.       case @data[@command_window.index]
  472.       when :view_skills
  473.         @command_window.active = false
  474.         @skill_window.active = true
  475.       when :mastery
  476.         $scene = Scene_Mastery.new(@actor_index, @command_window.index)
  477.       when :learn_skill
  478.         if @class_window != nil
  479.           @command_window.active = false
  480.           @class_window.active = true
  481.         else
  482.           start_learnskill_selection
  483.         end
  484.       when :level_skill
  485.         if @class_window != nil
  486.           @command_window.active = false
  487.           @class_window.active = true
  488.         else
  489.           start_levelskill_selection
  490.         end
  491.       when :equip_state
  492.         Sound.play_decision
  493.         @command_window.active = false
  494.         @equippas_window.active = true
  495.       when :learn_state
  496.         if @class_window != nil
  497.           @command_window.active = false
  498.           @class_window.active = true
  499.         else
  500.           start_learn_passives
  501.         end
  502.       end
  503.     end
  504.   end
  505.  
  506.   #--------------------------------------------------------------------------
  507.   # overwrite method: update_skill_selection
  508.   #--------------------------------------------------------------------------
  509.   def update_skill_selection
  510.     if Input.trigger?(Input::B)
  511.       Sound.play_cancel
  512.       @command_window.active = true
  513.       @skill_window.active = false
  514.     elsif $TEST and Input.trigger?(Input::F5)  # Debug MP Recovery
  515.       Sound.play_recovery
  516.       @actor.mp += @actor.maxmp
  517.       @status_window.refresh
  518.       @skill_window.refresh
  519.     elsif Input.trigger?(Input::C)
  520.       @skill = @skill_window.skill
  521.       if @skill != nil
  522.         @actor.last_skill_id = @skill.id
  523.       end
  524.       if @actor.skill_can_use?(@skill)
  525.         Sound.play_decision
  526.         determine_skill
  527.       else
  528.         Sound.play_buzzer
  529.       end
  530.     end
  531.   end
  532.  
  533.   #--------------------------------------------------------------------------
  534.   # new method: update_class_selection
  535.   #--------------------------------------------------------------------------
  536.   def update_class_selection
  537.     @class_window.update
  538.     if @class_window.class != @status_window.class
  539.       @status_window.refresh(@class_window.class)
  540.       @stapas_window.refresh(@class_window.class) if @stapas_window != nil
  541.       @classdata_window.refresh(@class_window.class)
  542.       @clpasdata_window.refresh(@class_window.class) if @clpasdata_window != nil
  543.     end
  544.     if Input.trigger?(Input::B)
  545.       Sound.play_cancel
  546.       @command_window.active = true
  547.       @class_window.active = false
  548.     elsif Input.repeat?(Input::F8) and $TEST # Debug increase JP
  549.       Sound.play_equip
  550.       value = YEZ::JOB::JP_COST * 10
  551.       value *= 10 if Input.press?(Input::SHIFT)
  552.       for class_id in @actor.all_unlocked_classes
  553.         @actor.gain_jp(value + rand(value), class_id)
  554.       end
  555.       @class_window.refresh
  556.       @status_window.refresh(@class_window.class)
  557.     elsif Input.repeat?(Input::F7) and $TEST # Debug increase JP
  558.       Sound.play_equip
  559.       value = YEZ::JOB::JP_COST * 10
  560.       value *= 10 if Input.press?(Input::SHIFT)
  561.       for class_id in @actor.all_unlocked_classes
  562.         @actor.lose_jp(value + rand(value), class_id)
  563.       end
  564.       @class_window.refresh
  565.       @status_window.refresh(@class_window.class)
  566.     elsif Input.trigger?(Input::C)
  567.       Sound.play_decision
  568.       refresh_windows(@status_window.class)
  569.       class_id = @status_window.class
  570.       case @data[@command_window.index]
  571.       when :learn_skill
  572.         start_learnskill_selection
  573.         @learnskill_window.refresh(class_id)
  574.         @learndata_window.y = @status_window.height + @help_window.height
  575.         @learndata_window.refresh(@learnskill_window.skill, @status_window.class)
  576.       when :level_skill
  577.         start_levelskill_selection
  578.         @levelskill_window.refresh(class_id)
  579.         @leveldata_window.y = @status_window.height + @help_window.height
  580.         @leveldata_window.refresh(@levelskill_window.skill, @status_window.class)
  581.       when :learn_state
  582.         start_learn_passives
  583.         @learnpas_window.refresh(@stapas_window.class)
  584.         @clpasdata_window.y = 416*3 if @clpasdata_window != nil
  585.       end
  586.       @class_window.y = 416*3
  587.       @classdata_window.y = @class_window.y
  588.     end
  589.   end
  590.  
  591.   #--------------------------------------------------------------------------
  592.   # new method: create_passive_windows
  593.   #--------------------------------------------------------------------------
  594.   def create_passive_windows
  595.     return if @stapas_window != nil
  596.     @stapas_window = Window_Passive_Actor.new(@actor)
  597.   end
  598.  
  599.   #--------------------------------------------------------------------------
  600.   # new method: update_equippas_selection
  601.   #--------------------------------------------------------------------------
  602.   def update_equippas_selection
  603.     @equippas_window.update
  604.     if @equip_index != @equippas_window.index
  605.       @equip_index = @equippas_window.index
  606.     end
  607.     if Input.trigger?(Input::B)
  608.       Sound.play_cancel
  609.       @command_window.active = true
  610.       @equippas_window.active = false
  611.     elsif Input.trigger?(Input::C) or ($TEST and Input.trigger?(Input::F5))
  612.       if @equip_index <= @equippas_window.auto_size - 1
  613.         Sound.play_buzzer
  614.         return
  615.       end
  616.       Sound.play_decision
  617.       @equippas_window.active = false
  618.       @equippas_window.y = 416*3
  619.       @eqpaslist_window.active = true
  620.       @eqpaslist_window.y = @help_window.height + @stapas_window.height
  621.       @eqpaslist_window.refresh(@equippas_window.passive)
  622.       @eqpasstat_window.y = @help_window.height + @stapas_window.height
  623.       refresh_equipstat_window
  624.       @eqpaslist_window.update_help
  625.     elsif Input.trigger?(Input::X)
  626.       if @equip_index <= @equippas_window.auto_size - 1
  627.         Sound.play_buzzer
  628.         return
  629.       end
  630.       return if @equippas_window.passive == nil
  631.       Sound.play_equip
  632.       slot = @equippas_window.index - @equippas_window.auto_size
  633.       passive = 0
  634.       last_hp = @actor.maxhp
  635.       last_mp = @actor.maxmp
  636.       @actor.equip_passive(passive, slot)
  637.       @actor.hp += @actor.maxhp - last_hp
  638.       @actor.mp += @actor.maxmp - last_mp
  639.       @equippas_window.refresh
  640.       @equippas_window.update_help
  641.       @stapas_window.refresh
  642.     end
  643.   end
  644.  
  645.   #--------------------------------------------------------------------------
  646.   # refresh_equipstat_window
  647.   #--------------------------------------------------------------------------
  648.   def refresh_equipstat_window
  649.     @equiplist_last_index = @eqpaslist_window.index
  650.     passive = @eqpaslist_window.passive
  651.     slot = @equippas_window.index - @equippas_window.auto_size
  652.     if passive == @equippas_window.passive or passive == nil
  653.       passive = 0
  654.     elsif @actor.equipped_passives.include?(passive.id)
  655.       passive = @actor.equipped_passives[slot]
  656.     end
  657.     @eqpasstat_window.refresh(passive, slot)
  658.   end
  659.  
  660.   #--------------------------------------------------------------------------
  661.   # update_equiplist_selection
  662.   #--------------------------------------------------------------------------
  663.   def update_equiplist_selection
  664.     @eqpaslist_window.update
  665.     refresh_equipstat_window if @equiplist_last_index != @eqpaslist_window.index
  666.     if Input.trigger?(Input::B)
  667.       Sound.play_cancel
  668.       @equippas_window.active = true
  669.       @equippas_window.y = @help_window.height + @stapas_window.height
  670.       @eqpaslist_window.active = false
  671.       @eqpaslist_window.y = 416*3
  672.       refresh_windows
  673.       @equippas_window.refresh
  674.       @equippas_window.update_help
  675.     elsif $TEST and Input.repeat?(Input::F5)  # Debug Force Equip
  676.       Sound.play_equip
  677.       passive = @eqpaslist_window.passive
  678.       slot = @equippas_window.index - @equippas_window.auto_size
  679.       passive = 0 if passive == nil or passive == @equippas_window.passive
  680.       last_hp = @actor.maxhp
  681.       last_mp = @actor.maxmp
  682.       @actor.equip_passive(passive, slot)
  683.       @actor.hp += @actor.maxhp - last_hp
  684.       @actor.mp += @actor.maxmp - last_mp
  685.       @equippas_window.active = true
  686.       @equippas_window.y = @help_window.height + @stapas_window.height
  687.       @eqpaslist_window.active = false
  688.       @eqpaslist_window.y = 416*3
  689.       refresh_windows
  690.       @equippas_window.refresh
  691.       @stapas_window.refresh
  692.       @eqpasstat_window.refresh
  693.       @equippas_window.update_help
  694.     elsif Input.trigger?(Input::C)
  695.       passive = @eqpaslist_window.passive
  696.       if passive != nil and !@eqpaslist_window.enabled_passive?(passive)
  697.         Sound.play_buzzer
  698.         return
  699.       end
  700.       Sound.play_equip
  701.       slot = @equippas_window.index - @equippas_window.auto_size
  702.       passive = 0 if passive == nil or passive == @equippas_window.passive
  703.       last_hp = @actor.maxhp
  704.       last_mp = @actor.maxmp
  705.       @actor.equip_passive(passive, slot)
  706.       @actor.hp += @actor.maxhp - last_hp
  707.       @actor.mp += @actor.maxmp - last_mp
  708.       @equippas_window.active = true
  709.       @equippas_window.y = @help_window.height + @stapas_window.height
  710.       @eqpaslist_window.active = false
  711.       @eqpaslist_window.y = 416*3
  712.       refresh_windows
  713.       @equippas_window.refresh
  714.       @stapas_window.refresh
  715.       @eqpasstat_window.refresh
  716.       @equippas_window.update_help
  717.     elsif Input.trigger?(Input::X)
  718.       Sound.play_equip
  719.       slot = @equippas_window.index - @equippas_window.auto_size
  720.       passive = 0
  721.       last_hp = @actor.maxhp
  722.       last_mp = @actor.maxmp
  723.       @actor.equip_passive(passive, slot)
  724.       @actor.hp += @actor.maxhp - last_hp
  725.       @actor.mp += @actor.maxmp - last_mp
  726.       @equippas_window.active = true
  727.       @equippas_window.y = @help_window.height + @stapas_window.height
  728.       @eqpaslist_window.active = false
  729.       @eqpaslist_window.y = 416*3
  730.       refresh_windows
  731.       @equippas_window.refresh
  732.       @stapas_window.refresh
  733.       @eqpasstat_window.refresh
  734.       @equippas_window.update_help
  735.     end
  736.   end
  737.  
  738.   #--------------------------------------------------------------------------
  739.   # start_learn_passives
  740.   #--------------------------------------------------------------------------
  741.   def start_learn_passives
  742.     @learnpas_window.y = @help_window.height + @stapas_window.height
  743.     @learnpas_window.active = true
  744.     @lepasdata_window.y = @help_window.height + @stapas_window.height
  745.     @lepasdata_window.refresh(@learnpas_window.passive, @stapas_window.class)
  746.   end
  747.  
  748.   #--------------------------------------------------------------------------
  749.   # update_learnpassive_selection
  750.   #--------------------------------------------------------------------------
  751.   def update_learnpassive_selection
  752.     @learnpas_window.update
  753.     if @last_learn_index != @learnpas_window.index
  754.       @last_learn_index = @learnpas_window.index
  755.       @lepasdata_window.refresh(@learnpas_window.passive, @stapas_window.class)
  756.     end
  757.     if Input.trigger?(Input::B)
  758.       Sound.play_cancel
  759.       if @class_window != nil
  760.         @class_window.y = @learnpas_window.y
  761.         @class_window.active = true
  762.         @class_window.update_help
  763.         @clpasdata_window.y = @class_window.y
  764.         @learnpas_window.active = false
  765.         @learnpas_window.y = 416*3
  766.         @lepasdata_window.y = 416*3
  767.       else
  768.         @learnpas_window.active = false
  769.         @command_window.active = true
  770.       end
  771.     elsif $TEST and Input.repeat?(Input::F8)  # Debug JP Increase
  772.       Sound.play_equip
  773.       value = YEZ::JOB::DEFAULT_PASSIVE_JP_COST * 10
  774.       value *= 10 if Input.press?(Input::SHIFT)
  775.       @actor.gain_jp(value + rand(value), @stapas_window.class)
  776.       @stapas_window.refresh
  777.       @equippas_window.refresh if @equippas_window != nil
  778.       @lepasdata_window.refresh(@learnpas_window.passive, @stapas_window.class)
  779.       @class_window.refresh if @class_window != nil
  780.       @learnpas_window.refresh
  781.     elsif $TEST and Input.repeat?(Input::F7)  # Debug JP Decrease
  782.       Sound.play_equip
  783.       value = YEZ::JOB::DEFAULT_PASSIVE_JP_COST * 10
  784.       value *= 10 if Input.press?(Input::SHIFT)
  785.       @actor.lose_jp(value + rand(value), @stapas_window.class)
  786.       @stapas_window.refresh
  787.       @equippas_window.refresh if @equippas_window != nil
  788.       @lepasdata_window.refresh(@learnpas_window.passive, @stapas_window.class)
  789.       @class_window.refresh if @class_window != nil
  790.       @learnpas_window.refresh
  791.     elsif $TEST and Input.repeat?(Input::F5)  # Debug Force Learn
  792.       passive = @learnpas_window.passive
  793.       return if passive == nil
  794.       YEZ::JOB::LEARN_SOUND.play
  795.       @actor.learn_passive(passive)
  796.       @stapas_window.refresh
  797.       @learnpas_window.refresh
  798.       @equippas_window.refresh if @equippas_window != nil
  799.       @lepasdata_window.refresh(passive, @stapas_window.class)
  800.       @clpasdata_window.refresh(@class_window.class) if @clpasdata_window != nil
  801.     elsif Input.trigger?(Input::C)
  802.       passive = @learnpas_window.passive
  803.       if passive == nil or !@learnpas_window.enabled_state?(passive)
  804.         Sound.play_buzzer
  805.         return
  806.       end
  807.       YEZ::JOB::LEARN_SOUND.play
  808.       @actor.learn_passive(passive)
  809.       @actor.lose_jp(passive.jp_cost, @stapas_window.class)
  810.       @stapas_window.refresh
  811.       @learnpas_window.refresh
  812.       @equippas_window.refresh if @equippas_window != nil
  813.       @lepasdata_window.refresh(passive, @stapas_window.class)
  814.       @clpasdata_window.refresh(@class_window.class) if @clpasdata_window != nil
  815.     end
  816.   end
  817.  
  818. end # Scene_Skill
  819.  
  820. #===============================================================================
  821. # Window_Command_Centered
  822. #===============================================================================
  823.  
  824. class Window_Command_Centered < Window_Command
  825.  
  826.   #--------------------------------------------------------------------------
  827.   # draw_item
  828.   #--------------------------------------------------------------------------
  829.   def draw_item(index, enabled = true)
  830.     rect = item_rect(index)
  831.     rect.x += 4
  832.     rect.width -= 8
  833.     self.contents.clear_rect(rect)
  834.     self.contents.font.color = normal_color
  835.     self.contents.font.color.alpha = enabled ? 255 : 128
  836.     self.contents.draw_text(rect, @commands[index], 1)
  837.   end
  838.  
  839. end # Window_Command_Centered
  840.  
  841. #===============================================================================
  842. # Window_Skill_Actor
  843. #===============================================================================
  844.  
  845. class Window_Skill_Actor < Window_Base
  846.  
  847.   #--------------------------------------------------------------------------
  848.   # initialize
  849.   #--------------------------------------------------------------------------
  850.   def initialize(actor)
  851.     super(160, 0, 384, 128)
  852.     @actor = actor
  853.     refresh
  854.   end
  855.  
  856.   #--------------------------------------------------------------------------
  857.   # refresh
  858.   #--------------------------------------------------------------------------
  859.   def refresh
  860.     self.contents.clear
  861.     draw_actor_face(@actor, 0, 0, size = 96)
  862.     x = 104
  863.     y = WLH / 2
  864.     draw_actor_name(@actor, x, y)
  865.     draw_actor_class(@actor, x + 120, y)
  866.     draw_actor_level(@actor, x, y + WLH * 1)
  867.     draw_actor_state(@actor, x, y + WLH * 2)
  868.     draw_actor_hp(@actor, x + 120, y + WLH * 1)
  869.     draw_actor_mp(@actor, x + 120, y + WLH * 2)
  870.   end
  871.  
  872. end # Window_Skill_Actor
  873.  
  874. #===============================================================================
  875. #
  876. # END OF FILE
  877. #
  878. #===============================================================================
RAW Paste Data