DK_1990

Dark Souls System

Nov 14th, 2014
2,412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 179.03 KB | None | 0 0
  1. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2. #                       Dark Souls System
  3. #                       Version: 1.8
  4. #                       Author: GGSlayer
  5. #                       Credit: Tsukihime
  6. #                       Required: Tsukihime's Item Instance
  7. #                       Date: 14th  Nov, 2014
  8. #--------------------------------------------------------------------------------  
  9. # ** Terms of Use
  10. #
  11. #   * Free to use in non-commercial projects
  12. #   * Contact me for commercial use
  13. #   * Credits to GGSlayer and Tsukihime in your project
  14. #-------------------------------------------------------------------------------
  15. # Description:
  16. #
  17. #       This Script allow you to Have one or More of dark souls game features
  18. #
  19. #-------------------------------------------------------------------------------
  20. # Instruction:
  21. #
  22. #     - Just Copy And Paste Under Materials and Above Main Process
  23. #
  24. #     - Everything Is Put As defult But You Can Chagne It In Editable Region
  25. #
  26. #     - In Editablel Region do the following:
  27. #      
  28. #       - Exp_Unit: Unit Shown For Exp Ex.(Gold Unit is G)
  29. #
  30. #       - Command_Name: Command Shown In Menu
  31. #
  32. #       - Start_Class_Stat: Each Class Is Strong at something so you modify
  33. #           stat at start of the game for each class (There Is Two Example
  34. #             of how modify class stat)
  35. #
  36. #       - Parameter_Increase_Per_Stat: How Much parameter Increase At level Up
  37. #
  38. #       - In skill Note tag wright the following:
  39. #           <(name of stat with small letter)(:)(space)(number that needed to learn skill)>
  40. #           add (,) if you need multiple stat to learn skill, you have until 4 stats needed
  41. #            ex:
  42. #               <str: 5>
  43. #               <str: 5, dex: 3>
  44. #               <str: 5, dex: 3, int: 3>
  45. #               <str: 5, dex: 3, int: 3, luk: 3>
  46. #
  47. #       - In Weapon, Armor note tag wright The same note as skill note tag
  48. #
  49. #       - When Equip Weapon or Armor you will see two stat color:
  50. #         Red: If actor stat less than needed stat to equip weapon or armor
  51. #         Green: If actor stat equal or more than needed
  52. #                     stat to equip weapon or armor
  53. #
  54. #       - you can not use physical and magical skills if you not have the
  55. #           right weapon
  56. #
  57. #       - To specify attribute of weapon and skill write in note tag:
  58. #           - Physical: to do physical skill
  59. #           - Magical: to do magical skill
  60. #           - Faith:  to do faith skill
  61. #
  62. #       - To add durability for weapon and armor write in note tag:
  63. #         - <Durability Number>
  64. #         - Number: Equipment Durability
  65. #
  66. #       - Durability consume for skills that learned from weapon or armor write
  67. #           In skill note tag:
  68. #         - <w_id consume> For weapon
  69. #         - <a_id consume> For armor
  70. #         - id: Weapon or armor id that skill learned from
  71. #         - consume: Durability consume from use that skill
  72. #
  73. #       - For skills that effect durability write in skill note tag:
  74. #         - <Effect amount>
  75. #         - amount: amount of durability decrease from this skill
  76. #
  77. #       - For make skills or items that recover equipment durability like
  78. #           Repair powder write in skill or item note tag:
  79. #         - <Repair percentage>
  80. #         - percentage: percentage of eguipment durability that will return
  81. #
  82. #       - you can return original stat by add this command in the event script:
  83. #          - name = Name
  84. #             $game_party.members.each do |actor|
  85. #               if actor.name == name
  86. #                 actor.return_original_stat
  87. #               end
  88. #             end
  89. #          - name: is character name
  90. #
  91. #       - To level up from specific places by write this command in
  92. #             event script:
  93. #           - $actor_name = Name
  94. #              SceneManager.call(Scene_Status_Point)
  95. #           - Name: is character name
  96. #
  97. #       - Blacksmith scene write this command in event script:
  98. #         - SceneManager.call(Scene_repair)
  99. #
  100. #       - To Activate Durability Damage Floor Select Region ID and write it in:
  101. #           Durability_Effect_Region_ID
  102. #
  103. #       - To Determine the amount decrease of durability when step on
  104. #           the effected region by write the amount in:
  105. #           Durability_Decrease_from_Field
  106. #
  107. #       - To Infuse weapon and shield:
  108. #         - INFUSE_COST: Cost of Infuse Weapon and Shield
  109. #         - ELEMENT_RESISTANCE_PERCENTAGE: Percentage of element resistance(For Shield)
  110. #
  111. #       - To Learn Skill You need Actor Memory Slot and Stats to be
  112. #           equal or more than Skill Required Memory Slot and Stats
  113. #
  114. #       - Actor Memory Slot Increase by 1 for each number divisible by 5
  115. #
  116. #       - To Add Required Memory Slot for Skill from Skill note tag Write:
  117. #         - <MS: (Needed Memory Slot)>
  118. #
  119. #       - To link Item To Skill You need To do the following:
  120. #         - The Item Type Should be: Key Item
  121. #         - Consume Should be: No
  122. #         - In the note Tag: <Skill (Skill_Id)>
  123. #
  124. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  125. # Note:
  126. #   Make Character can use everything:
  127. #     All weapons, All armors, dual Wielding, Special Skills, Magic Skills
  128. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  129.  
  130. module GGSlayer
  131.   module Dark_Souls_System
  132.    
  133.     #---------------------------------------------------------------------  
  134.     #                                                                 #
  135.     #                   Start of EDITABLE REGION                      #
  136.     #                                                                 #
  137.     #--------------------------------------------------------------------
  138.    
  139.     Exp_Unit = "Exp" # Unit Shown For Exp Ex.(Gold Unit is G)
  140.    
  141.     Command_Name = "Exp Stat" # Command Shown In Menu
  142.    
  143.     Durability_Effect_Region_ID = 1 # Map Region ID that effect durability
  144.    
  145.     Durability_Decrease_from_Field = 1 # Amount Decrease of Durability when step on the effected region
  146.    
  147.     INFUSE_COST = 0  # Cost of Infuse Weapon and Shield
  148.    
  149.     ELEMENT_RESISTANCE_PERCENTAGE = 0.5 # Percentage of element resistance(For Shield)
  150.    
  151.     INCREASE_PERCENTAGE = 0.1 # Percentage of parameter increase per level
  152.    
  153.     DS_ICONS = "IconSet" # Name Icons Set File
  154.     #---------------------------------------------------------------
  155.     #   Actor Stats Icons
  156.     #---------------------------------------------------------------
  157.     EXP_ICON = 321          # Experience Icon
  158.     VIT_ICON = 122          # Vitality Icon
  159.     INT_ICON = 117          # Intelligent Icon
  160.     FTH_ICON = 143          # Faith Icon
  161.     STR_ICON = 116          # Strength Icon
  162.     DEX_ICON = 12           # Dexterity Icon
  163.     LUK_ICON = 259          # Luck Icon
  164.     ATN_ICON = 230          # Attunement Icon
  165.     DURABILITY_ICON = 115   # Durability Icon
  166.     MS_ICON = 228           # Memory Slot Icon
  167.    
  168.     #---------------------------------------------------------------
  169.     #   Equipment Elements Icons
  170.     #---------------------------------------------------------------
  171.     NO_ELEMENT_ICON = 116  
  172.     FIRE_ELEMENT_ICON = 96
  173.     ICE_ELEMENT_ICON = 97
  174.     THUNDER_ELEMENT_ICON = 98
  175.     WATER_ELEMENT_ICON = 99
  176.     EARTH_ELEMENT_ICON = 100
  177.     WIND_ELEMENT_ICON = 101
  178.     HOLY_ELEMNT_ICON = 102
  179.     DARK_ELEMENT_ICON = 103
  180.    
  181.    
  182.    
  183.     Start_Class_Stat =
  184.     {
  185.           #     "Write Class Name Start With Capital Letter
  186.                 "Soldier" =>
  187.                 {
  188.                     # Start Level Charcter
  189.                       :start_level  => 1,
  190.                     # Start Charcter Exp  
  191.                       :start_exp    => 0,
  192.                     # Start Character Vitality
  193.                       :start_vit    => 1,
  194.                     # Start Character Intelligent
  195.                       :start_int    => 1,
  196.                     # Start Character Faith
  197.                       :start_fth    => 3,
  198.                     # Start Character Strength
  199.                       :start_str    => 1,
  200.                     # Start Charcter Dexterity
  201.                       :start_dex    => 1,
  202.                     # Start Character Luck
  203.                       :start_luck   => 1,
  204.                     # Start Character Attunement
  205.                       :start_atn   =>  6,
  206.                     # Start Character physical Attribute
  207.                       :physical_att => false,
  208.                     # Start Character magical Attribute
  209.                       :magical_att  => false,
  210.                     # Start Character faith Attribute
  211.                       :faith_att    => false,
  212.                 },
  213.                
  214.                 "Monk" =>
  215.                 {
  216.                       :start_level => 5,
  217.                       :start_exp   => 0,
  218.                       :start_vit   => 1,
  219.                       :start_int   => 1,
  220.                       :start_fth   => 1,
  221.                       :start_str   => 5,
  222.                       :start_dex   => 1,
  223.                       :start_luck  => 1,
  224.                       :start_atn   =>  1,
  225.                       :physical_att => false,
  226.                       :magical_att  => false,
  227.                       :faith_att    => false,
  228.                 }
  229.     }
  230.    
  231.     Parameter_Increase_Per_Stat =
  232.     {
  233.                 :mhp  => 50,  # Default Increase Value For Hp
  234.                 :mmp  => 20,  # Default Increase Value For Mp
  235.                 :att  => 2,   # Default Increase Value For Att
  236.                 :def  => 2,   # Default Increase Value For Def
  237.                 :mat  => 2,   # Default Increase Value For MAT
  238.                 :mdf  => 2,   # Default Increase Value For MDF
  239.                 :agi  => 2,   # Default Increase Value For Agi
  240.                 :luk  => 2,   # Defaulr Increase Value For Luck
  241.     }
  242.    
  243.     #---------------------------------------------------------------------  
  244.     #                                                                 #
  245.     #                   End Of EDITABLE REGION                        #
  246.     #                                                                 #
  247.     #--------------------------------------------------------------------
  248.   end
  249. end
  250. #==============================================================================
  251. # ** BattleManager
  252. #------------------------------------------------------------------------------
  253. #  This module manages battle progress.
  254. #==============================================================================
  255.  
  256. module BattleManager
  257.  
  258.   #--------------------------------------------------------------------------
  259.   # * EXP Acquisition and Level Up Display
  260.   #--------------------------------------------------------------------------
  261.   def self.gain_exp
  262.     $game_party.gain_exp($game_troop.exp_total)
  263.     wait_for_message
  264.   end
  265. end
  266.  
  267. #============================================================================
  268. # **  RPG::EquipItem
  269. #============================================================================
  270. class RPG::EquipItem < RPG::BaseItem
  271.   include GGSlayer::Dark_Souls_System
  272.   attr_accessor   :durability   # Equipment Durability
  273.   attr_accessor   :equip_lv
  274.   attr_accessor   :original_params
  275.   #--------------------------------------------------------------------------
  276.   # * Object Initialization
  277.   #--------------------------------------------------------------------------
  278.   alias ggslayer_dark_souls_system_equipitem_initialize   initialize
  279.   def initialize
  280.     ggslayer_dark_souls_system_equipitem_initialize()
  281.     @durability = 0
  282.     @equip_lv = 0
  283.     @original_params = []
  284.   end
  285.   #--------------------------------------------------------------------------
  286.   # * New Method: Get Equipment Level
  287.   #--------------------------------------------------------------------------
  288.   def get_equip_lv
  289.     @equip_lv = 0 if @equip_lv == nil
  290.     return @equip_lv
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # * New Method: Write Equipment Level In the Name
  294.   #--------------------------------------------------------------------------
  295.   def write_equip_level_to_name
  296.     return "" if @equip_lv == nil || @equip_lv == 0
  297.     return @equip_lv.to_s + "+ " if @equip_lv > 0
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # * New Method: Upgrade Equip
  301.   #--------------------------------------------------------------------------
  302.   def upgrade_equip
  303.     @equip_lv  = 0 if @equip_lv == nil
  304.     @equip_lv += 1
  305.     6.times{|i| @params[i + 2] = @original_params[i + 2] + (@equip_lv * INCREASE_PERCENTAGE * @original_params[i + 2]).ceil}
  306.     change_equipment_name
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # * New Method: Fake Upgrade Equip
  310.   #--------------------------------------------------------------------------
  311.   def fake_upgrade(param_id)
  312.     @original_params = []         if  !@original_params.kind_of?(Array)
  313.     if @original_params.empty?
  314.       @params.each  do  |param|
  315.         @original_params.push(param)
  316.       end
  317.     end
  318.     return @original_params[param_id] + ((@equip_lv + 1) * INCREASE_PERCENTAGE * @original_params[param_id]).ceil
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # * New Method: Change Weapon Attack Element
  322.   #--------------------------------------------------------------------------
  323.   def change_atk_element(element_number)
  324.     @equip_element = element_number
  325.     @features.each do |feature|
  326.       @features.delete(feature) if feature.added
  327.     end
  328.     @features.push(RPG::BaseItem::Feature.new(31, element_number, 0, true))
  329.     change_equipment_name(element_number)
  330.   end
  331.   #--------------------------------------------------------------------------
  332.   # * New Method: Change Weapon Name
  333.   #--------------------------------------------------------------------------
  334.   def change_equipment_name(element_number = 0)
  335.     @original_name = self.name if @original_name == nil
  336.     self.name = write_equip_level_to_name + @original_name  if @equip_element == nil || @equip_element <= 1
  337.     self.name = write_equip_level_to_name + "Fire " + @original_name if @equip_element == 3
  338.     self.name = write_equip_level_to_name + "Ice " + @original_name if @equip_element == 4
  339.     self.name = write_equip_level_to_name + "Thunder " + @original_name if @equip_element == 5
  340.     self.name = write_equip_level_to_name + "Water " + @original_name if @equip_element == 6
  341.     self.name = write_equip_level_to_name + "Earth " + @original_name if @equip_element == 7
  342.     self.name = write_equip_level_to_name + "Wind " + @original_name if @equip_element == 8
  343.     self.name = write_equip_level_to_name + "Holy " + @original_name if @equip_element == 9
  344.     self.name = write_equip_level_to_name + "Dark " + @original_name if @equip_element == 10
  345.   end
  346.   #--------------------------------------------------------------------------
  347.   # * New Method: Change Weapon Attack Element
  348.   #--------------------------------------------------------------------------
  349.   def change_def_element(element_number)
  350.     @equip_element = element_number
  351.     @features.each do |feature|
  352.       @features.delete(feature) if feature.added
  353.     end
  354.     @features.push(RPG::BaseItem::Feature.new(11, element_number, ELEMENT_RESISTANCE_PERCENTAGE, true)) if element_number != 1
  355.     change_equipment_name(element_number)
  356.   end
  357.   #--------------------------------------------------------------------------
  358.   # * new Method: Set Weapon Durability
  359.   #--------------------------------------------------------------------------
  360.   def set_durability
  361.     if @durability == nil && self.note =~ /<Durability (\d+)>/
  362.       @durability = $1.to_i
  363.     elsif @durability == nil
  364.       @durability = 0
  365.     end
  366.   end
  367.   def get_features
  368.     return @features if @features != nil
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # * new Method: Get Weapon Original Durability
  372.   #--------------------------------------------------------------------------
  373.   def get_original_durability
  374.     if self.note =~ /<Durability (\d+)>/
  375.       return $1.to_i
  376.     else
  377.       set_durability
  378.       return @durability
  379.     end
  380.   end
  381.   #--------------------------------------------------------------------------
  382.   # * new Method: Get Weapon Durability
  383.   #--------------------------------------------------------------------------
  384.   def get_durability
  385.     set_durability if @durability == nil
  386.     return @durability
  387.   end
  388.   #--------------------------------------------------------------------------
  389.   # * new Method: Return Weapon Durability
  390.   #--------------------------------------------------------------------------
  391.   def repair(amount)
  392.     set_durability if @durability == nil
  393.     @durability += amount
  394.     @durability = self.get_original_durability if @durability > self.get_original_durability
  395.   end
  396.   #--------------------------------------------------------------------------
  397.   # * new Method: Decrease Weapon Durability
  398.   #--------------------------------------------------------------------------
  399.   def decrease_durability(amount)
  400.     @durability = $1.to_i if @durability == nil && self.note =~ /<Durability (\d+)>/
  401.     @durability -= amount if @durability != nil
  402.     @durability = 0 if @durability != nil && @durability < 0
  403.   end
  404. end
  405.  
  406. #============================================================================
  407. # **  RPG::Skill
  408. #============================================================================
  409. class RPG::Skill < RPG::UsableItem
  410.   #--------------------------------------------------------------------------
  411.   # * Set Memory Slot Required to be Learned
  412.   #--------------------------------------------------------------------------
  413.   def set_memory_slot_required
  414.     self.note =~ /<MS: (\d+)>/
  415.     @memory_slot_required = $1.to_i if @memory_slot_required == nil
  416.   end
  417.   #--------------------------------------------------------------------------
  418.   # * Get Memory Slot Required to be Learned
  419.   #--------------------------------------------------------------------------
  420.   def get_memory_slot_required
  421.     set_memory_slot_required  if @memory_slot_required == nil
  422.     return @memory_slot_required
  423.   end
  424.   attr_accessor :memory_slot_required
  425. end
  426.  
  427. #============================================================================
  428. # **  RPG::Item
  429. #============================================================================
  430. class RPG::Item < RPG::UsableItem
  431.   attr_accessor   :skill_id
  432.   #--------------------------------------------------------------------------
  433.   # * Check if Item Linked To Skill
  434.   #--------------------------------------------------------------------------
  435.   def is_skill?
  436.     return true if get_skill_id
  437.     return false
  438.   end
  439.   #--------------------------------------------------------------------------
  440.   # * Get Skill ID Linked To This Item
  441.   #--------------------------------------------------------------------------
  442.   def get_skill_id
  443.     set_skill_id if @skill_id == nil
  444.     return @skill_id
  445.   end
  446.   #--------------------------------------------------------------------------
  447.   # * Set Skill ID Linked To This Item
  448.   #--------------------------------------------------------------------------
  449.   def set_skill_id
  450.     if self.note =~ /<Skill (\d+)>/
  451.       @skill_id = $1.to_i
  452.     else
  453.       @skill_id = 0
  454.     end
  455.   end
  456. end
  457.  
  458. #============================================================================
  459. # **  RPG::BaseItem::Feature
  460. #============================================================================
  461. class RPG::BaseItem::Feature
  462.   alias ggslayer_dark_souls_system_rpg_baseitem_feature_initialize   initialize
  463.   def initialize(code = 0, data_id = 0, value = 0, added = false)
  464.     ggslayer_dark_souls_system_rpg_baseitem_feature_initialize(code, data_id, value)
  465.     @added = added
  466.   end
  467.   attr_accessor :added
  468. end
  469.  
  470. #==============================================================================
  471. # ** Game_BaseItem
  472. #------------------------------------------------------------------------------
  473. #  This class uniformly handles skills, items, weapons, and armor. References
  474. # to the database object itself are not retained to enable inclusion in save
  475. # data.
  476. #==============================================================================
  477.  
  478. class Game_BaseItem
  479.   #--------------------------------------------------------------------------
  480.   # * Object Initialization
  481.   #--------------------------------------------------------------------------
  482.   alias ggslayer_dark_souls_system_Game_BaseItem_initialize   initialize
  483.   def initialize
  484.     ggslayer_dark_souls_system_Game_BaseItem_initialize()
  485.     @durability = 0
  486.   end
  487.   #--------------------------------------------------------------------------
  488.   # * Set Item Object
  489.   #--------------------------------------------------------------------------
  490.   def object=(item)
  491.     @class = item ? item.class : nil
  492.     @item_id = item ? item.id : 0
  493.     item.set_durability if item != nil && item.class.superclass == RPG::EquipItem
  494.   end
  495. end
  496.  
  497. #==============================================================================
  498. # ** Game_Battler
  499. #------------------------------------------------------------------------------
  500. #  A battler class with methods for sprites and actions added. This class
  501. # is used as a super class of the Game_Actor class and Game_Enemy class.
  502. #==============================================================================
  503.  
  504. class Game_Battler < Game_BattlerBase
  505.   #--------------------------------------------------------------------------
  506.   # * Test Skill/Item Application
  507.   #    Used to determine, for example, if a character is already fully healed
  508.   #   and so cannot recover anymore.
  509.   #--------------------------------------------------------------------------
  510.   def item_test(user, item)
  511.     return false if item.for_dead_friend? != dead?
  512.     return true if $game_party.in_battle
  513.     return true if item.for_opponent?
  514.     return true if item.damage.recover? && item.damage.to_hp? && hp < mhp
  515.     return true if item.damage.recover? && item.damage.to_mp? && mp < mmp
  516.     return true if item_has_any_valid_effects?(user, item)
  517.     return true if item.note =~ /<Repair (\d+)>/
  518.     return false
  519.   end
  520.   #--------------------------------------------------------------------------
  521.   # * Apply Effect of Skill/Item
  522.   #--------------------------------------------------------------------------
  523.   def item_apply(user, item)
  524.     @result.clear
  525.     @result.used = item_test(user, item)
  526.     @result.missed = (@result.used && rand >= item_hit(user, item))
  527.     @result.evaded = (!@result.missed && rand < item_eva(user, item))
  528.     if @result.hit?
  529.       unless item.damage.none?
  530.         @result.critical = (rand < item_cri(user, item))
  531.         make_damage_value(user, item)
  532.         execute_damage(user)
  533.         effect_item_on_armor(user, self, item)             if ($game_party.members).include? self
  534.         effect_item_on_armor(user, user, item)             if ($game_party.members).include? user
  535.         decrease_weapon_durability(user, item)       if ($game_party.members).include? user
  536.         check_weapon_armor_condition(user)           if ($game_party.members).include? user
  537.         check_weapon_armor_condition(self)           if ($game_party.members).include? self
  538.       else
  539.         decrease_weapon_durability(user, item)       if ($game_party.members).include? user
  540.         effect_item_on_armor(user, self, item)             if ($game_party.members).include? self
  541.         effect_item_on_armor(user, user, item)             if ($game_party.members).include? user
  542.         check_weapon_armor_condition(self)           if ($game_party.members).include? self
  543.       end
  544.       item.effects.each {|effect| item_effect_apply(user, item, effect) }
  545.       item_user_effect(user, item)
  546.     end
  547.   end
  548.   #--------------------------------------------------------------------------
  549.   # * new Method: Check Weapon Armor Condition
  550.   #--------------------------------------------------------------------------
  551.   def check_weapon_armor_condition(actor)
  552.     actor.change_destroyed_equip(0, nil) if (actor.equips[0]) != nil && (actor.equips[0]).get_durability == 0
  553.     actor.change_destroyed_equip(1, nil) if (actor.equips[1]) != nil && (actor.equips[1]).get_durability == 0
  554.     actor.change_destroyed_equip(2, nil) if (actor.equips[2]) != nil && (actor.equips[2]).get_durability == 0  
  555.     actor.change_destroyed_equip(3, nil) if (actor.equips[3]) != nil && (actor.equips[3]).get_durability == 0
  556.     actor.change_destroyed_equip(4, nil) if (actor.equips[4]) != nil && (actor.equips[4]).get_durability == 0
  557.     actor.change_destroyed_equip(5, nil) if (actor.equips[5]) != nil && (actor.equips[5]).get_durability == 0
  558.     actor.change_destroyed_equip(6, nil) if (actor.equips[6]) != nil && (actor.equips[6]).get_durability == 0  
  559.   end
  560.   #--------------------------------------------------------------------------
  561.   # * new Method: Decrease Weapon Durability
  562.   #--------------------------------------------------------------------------
  563.   def decrease_weapon_durability(user, item)
  564.     if item.note =~ /<(\w)_(\d+) (\d+)>/
  565.       if $1.to_s == "w"
  566.         (user.equips[0]).decrease_durability($3.to_i) if (user.equips[0]) != nil && (user.equips[0].template_id) == $2.to_i
  567.         (user.equips[1]).decrease_durability($3.to_i) if (user.equips[1]) != nil && (user.equips[1].template_id) == $2.to_i
  568.       elsif $1.to_s == "a"
  569.         (user.equips[2]).decrease_durability($3.to_i) if (user.equips[2]) != nil && (user.equips[2].template_id) == $2.to_i
  570.         (user.equips[3]).decrease_durability($3.to_i) if (user.equips[3]) != nil && (user.equips[3].template_id) == $2.to_i
  571.         (user.equips[4]).decrease_durability($3.to_i) if (user.equips[4]) != nil && (user.equips[4].template_id) == $2.to_i
  572.         (user.equips[5]).decrease_durability($3.to_i) if (user.equips[5]) != nil && (user.equips[5].template_id) == $2.to_i
  573.         (user.equips[6]).decrease_durability($3.to_i) if (user.equips[6]) != nil && (user.equips[6].template_id) == $2.to_i
  574.       end
  575.     else
  576.       (user.equips[0]).decrease_durability(1) if (($game_party.members).include? user)  && (user.equips[0]) != nil
  577.       (user.equips[1]).decrease_durability(1) if (($game_party.members).include? user)  && (user.equips[1]) != nil
  578.     end
  579.   end
  580.   #--------------------------------------------------------------------------
  581.   # * new Method: Increase Equipment Durability
  582.   #--------------------------------------------------------------------------
  583.   def increase_equipment_durability(actor, amount)
  584.     (actor.equips[0]).repair((actor.equips[0].get_original_durability * amount).to_i) if (actor.equips[0]) != nil
  585.     (actor.equips[1]).repair((actor.equips[1].get_original_durability * amount).to_i) if (actor.equips[1]) != nil
  586.     (actor.equips[2]).repair((actor.equips[2].get_original_durability * amount).to_i) if (actor.equips[2]) != nil
  587.     (actor.equips[3]).repair((actor.equips[3].get_original_durability * amount).to_i) if (actor.equips[3]) != nil
  588.     (actor.equips[4]).repair((actor.equips[4].get_original_durability * amount).to_i) if (actor.equips[4]) != nil
  589.     (actor.equips[5]).repair((actor.equips[5].get_original_durability * amount).to_i) if (actor.equips[5]) != nil
  590.     (actor.equips[6]).repair((actor.equips[6].get_original_durability * amount).to_i) if (actor.equips[6]) != nil
  591.   end
  592.   #--------------------------------------------------------------------------
  593.   # * new Method: Decrease Armor Durability
  594.   #--------------------------------------------------------------------------
  595.   def effect_item_on_armor(user, actor, item)
  596.     if item.note =~ /<Effect (\d+)>/
  597.       decrease_armor_durability(actor, $1.to_i)
  598.     elsif item.note =~ /<Repair (\d+)>/
  599.       increase_equipment_durability(actor, $1.to_f/100.0)
  600.     elsif !(item.is_a?(RPG::Item)) && !(($game_party.members).include? user)
  601.       decrease_armor_durability(actor, 1)
  602.     end
  603.   end
  604.   #--------------------------------------------------------------------------
  605.   # * new Method: Decrease Armor Durability
  606.   #--------------------------------------------------------------------------
  607.   def decrease_armor_durability(actor, amount)
  608.     (actor.equips[0]).decrease_durability(amount) if (actor.equips[0]) != nil && (actor.equips[1]) == nil && (actor.equips[2]) == nil && actor.guard?
  609.     (actor.equips[1]).decrease_durability(amount) if (actor.equips[1]) != nil && actor.guard?
  610.     (actor.equips[2]).decrease_durability(amount) if (actor.equips[2]) != nil && actor.guard?
  611.     (actor.equips[3]).decrease_durability(amount) if (actor.equips[3]) != nil
  612.     (actor.equips[4]).decrease_durability(amount) if (actor.equips[4]) != nil
  613.     (actor.equips[5]).decrease_durability(amount) if (actor.equips[5]) != nil
  614.     (actor.equips[6]).decrease_durability(amount) if (actor.equips[6]) != nil
  615.   end
  616. end
  617.  
  618. #==============================================================================
  619. # ** Game_Actor
  620. #------------------------------------------------------------------------------
  621. #  This class handles actors. It is used within the Game_Actors class
  622. # ($game_actors) and is also referenced from the Game_Party class ($game_party).
  623. #==============================================================================
  624.  
  625. class Game_Actor < Game_Battler
  626.   include GGSlayer::Dark_Souls_System
  627.  
  628.   attr_accessor   :dk_actor_stat
  629.   attr_reader     :physical_attribute # Make Actor do Physical Attack
  630.   attr_reader     :magical_attribute  # Make Actor do Magical Attack
  631.   attr_reader     :faith_attribute    # Make Actor do Faith Attack
  632.   attr_accessor   :memory_slot        # number Of Memory Slot that actor have
  633.   attr_accessor   :used_memory_slot   # number Of Memory Slot that actor used
  634.   #--------------------------------------------------------------------------
  635.   # * Object Initialization
  636.   #--------------------------------------------------------------------------
  637.   alias ggslayer_dark_souls_stat_point_game_actor_initialize   initialize
  638.   def initialize(actor_id)
  639.     ggslayer_dark_souls_stat_point_game_actor_initialize(actor_id)
  640.    
  641.     @dk_actor_stat =
  642.     {
  643.             :level  =>  Start_Class_Stat[self.class.name][:start_level],  # Level
  644.             :exp    =>  Start_Class_Stat[self.class.name][:start_exp],    # Exp
  645.             :vit    =>  Start_Class_Stat[self.class.name][:start_vit],    # Vit
  646.             :int    =>  Start_Class_Stat[self.class.name][:start_int],    # Int
  647.             :fth    =>  Start_Class_Stat[self.class.name][:start_fth],    # Fth
  648.             :str    =>  Start_Class_Stat[self.class.name][:start_str],    # Str
  649.             :dex    =>  Start_Class_Stat[self.class.name][:start_dex],    # Dex
  650.             :luk    =>  Start_Class_Stat[self.class.name][:start_luck],   # Luck
  651.             :atn    =>  Start_Class_Stat[self.class.name][:start_atn]     # Attunement
  652.     }
  653.    
  654.     @physical_attribute = Start_Class_Stat[self.class.name][:physical_att]
  655.     @magical_attribute  = Start_Class_Stat[self.class.name][:magical_att]
  656.     @faith_attribute    = Start_Class_Stat[self.class.name][:faith_att]
  657.     @memory_slot        = @dk_actor_stat[:atn] % 5 == 0 || @dk_actor_stat[:atn] % 5 >= 1 ? (@dk_actor_stat[:atn] / 5).floor : 0
  658.   end
  659.   #--------------------------------------------------------------------------
  660.   # * New Method: Return Original Character Stat
  661.   #--------------------------------------------------------------------------
  662.   def return_original_stat
  663.     $game_party.gain_exp(dk_actor_stat[:exp])
  664.     self.clear_param_plus
  665.     forget_all_skill
  666.     clear_equipments
  667.     deactivate_physical_attribute
  668.     deactivate_magical_attribute
  669.     deactivate_faith_attribute
  670.     @dk_actor_stat =
  671.     {
  672.             :level  =>  Start_Class_Stat[self.class.name][:start_level],  # Level
  673.             :exp    =>  Start_Class_Stat[self.class.name][:start_exp],    # Exp
  674.             :vit    =>  Start_Class_Stat[self.class.name][:start_vit],    # Vit
  675.             :int    =>  Start_Class_Stat[self.class.name][:start_int],    # Int
  676.             :fth    =>  Start_Class_Stat[self.class.name][:start_fth],    # Fth
  677.             :str    =>  Start_Class_Stat[self.class.name][:start_str],    # Str
  678.             :dex    =>  Start_Class_Stat[self.class.name][:start_dex],    # Dex
  679.             :luk    =>  Start_Class_Stat[self.class.name][:start_luck],   # Luck
  680.             :atn    =>  Start_Class_Stat[self.class.name][:start_atn]     # Attunement
  681.     }
  682.   end
  683.   #--------------------------------------------------------------------------
  684.   # * New Method: Forget All Skill
  685.   #--------------------------------------------------------------------------
  686.   def forget_all_skill
  687.     if @skills != nil
  688.       @skills.each do |skill_id|
  689.         @skills.delete(skill_id)
  690.       end
  691.     end
  692.     @used_memory_slot = 0
  693.   end
  694.   #--------------------------------------------------------------------------
  695.   # * Determine Maximum Level
  696.   #--------------------------------------------------------------------------
  697.   def max_level?
  698.     @dk_actor_stat[:level] >= max_level
  699.   end
  700.   #--------------------------------------------------------------------------
  701.   # * New Method: Determine Maximum Level When Level Up
  702.   #--------------------------------------------------------------------------
  703.   def max_level_at_level_up?(current_lv)
  704.     current_lv >= max_level
  705.   end
  706.   #--------------------------------------------------------------------------
  707.   # * Maximum Level
  708.   #--------------------------------------------------------------------------
  709.   def max_level
  710.     return 687
  711.   end
  712.   #--------------------------------------------------------------------------
  713.   # * Get EXP for Next Level
  714.   #--------------------------------------------------------------------------
  715.  def next_level_exp
  716.       exp_for_level(@dk_actor_stat[:level] + 1)
  717.   end
  718.   #--------------------------------------------------------------------------
  719.   # * Get Total EXP Required for Rising to Specified Level
  720.   #--------------------------------------------------------------------------
  721.   def exp_for_level(level)
  722.       if level > 599
  723.         lv_increased_above_600 = level - 599
  724.         return (self.class.exp_for_level(lv_increased_above_600) +  2547133 + ((50744 + 250) * lv_increased_above_600 * 6))
  725.       elsif level > 499
  726.         lv_increased_above_500 = level - 499
  727.         return (self.class.exp_for_level(lv_increased_above_500) +  2547133 + ((50744 + 250) * lv_increased_above_500 * 5))
  728.       elsif level > 399
  729.         lv_increased_above_400 = level - 399
  730.         return (self.class.exp_for_level(lv_increased_above_400) +  2547133 + ((50744 + 250) * lv_increased_above_400 * 4))
  731.       elsif level > 299
  732.         lv_increased_above_300 = level - 299
  733.         return (self.class.exp_for_level(lv_increased_above_300) +  2547133 + ((50744 + 250) * lv_increased_above_300 * 3))
  734.       elsif level > 199
  735.         lv_increased_above_200 = level - 199
  736.         return (self.class.exp_for_level(lv_increased_above_200) +  2547133 + ((50744 + 250) * lv_increased_above_200 * 2))
  737.       elsif level > 99
  738.         lv_increased_above_100 = level - 99
  739.         return (self.class.exp_for_level(lv_increased_above_100) +  2547133 + ((50744 + 250) * lv_increased_above_100))
  740.       else
  741.         self.class.exp_for_level(level)
  742.       end
  743.   end
  744.   #--------------------------------------------------------------------------
  745.   # * New Method: Get Actor Level
  746.   #--------------------------------------------------------------------------
  747.   def get_dk_actor_level
  748.     return @dk_actor_stat[:level]
  749.   end
  750.   #--------------------------------------------------------------------------
  751.   # * New Method: Get Actor EXP
  752.   #--------------------------------------------------------------------------
  753.   def get_dk_actor_exp
  754.     return @dk_actor_stat[:exp]
  755.   end
  756.   #--------------------------------------------------------------------------
  757.   # * New Method: Get Actor Vitality Point
  758.   #--------------------------------------------------------------------------
  759.   def get_dk_actor_vit
  760.     return @dk_actor_stat[:vit]
  761.   end
  762.   #--------------------------------------------------------------------------
  763.   # * New Method: Get Actor Intelligent Point
  764.   #--------------------------------------------------------------------------
  765.   def get_dk_actor_int
  766.     return @dk_actor_stat[:int]
  767.   end
  768.   #--------------------------------------------------------------------------
  769.   # * New Method: Get Actor Faith Point
  770.   #--------------------------------------------------------------------------
  771.   def get_dk_actor_fth
  772.     return @dk_actor_stat[:fth]
  773.   end
  774.   #--------------------------------------------------------------------------
  775.   # * New Method: Get Actor Strength
  776.   #--------------------------------------------------------------------------
  777.   def get_dk_actor_str
  778.     return @dk_actor_stat[:str]
  779.   end
  780.   #--------------------------------------------------------------------------
  781.   # * New Method: Get Actor Dexterity
  782.   #--------------------------------------------------------------------------
  783.   def get_dk_actor_dex
  784.     return @dk_actor_stat[:dex]
  785.   end
  786.   #--------------------------------------------------------------------------
  787.   # * New Method: Get Actor Luck
  788.   #--------------------------------------------------------------------------
  789.   def get_dk_actor_luck
  790.     return @dk_actor_stat[:luk]
  791.   end
  792.   #--------------------------------------------------------------------------
  793.   # * New Method: Get Actor Attunement
  794.   #--------------------------------------------------------------------------
  795.   def get_dk_actor_atn
  796.     return @dk_actor_stat[:atn]
  797.   end
  798.   #--------------------------------------------------------------------------
  799.   # * New Method: Get Number of Memory Slot
  800.   #--------------------------------------------------------------------------
  801.   def get_number_of_slot
  802.     @memory_slot = update_number_of_slot  if @memory_slot == nil
  803.     return @memory_slot
  804.   end
  805.   #--------------------------------------------------------------------------
  806.   # * New Method: Get Number of Used Memory Slot
  807.   #--------------------------------------------------------------------------
  808.   def get_used_memory_slot
  809.     @used_memory_slot = 0 if @used_memory_slot == nil
  810.     return @used_memory_slot
  811.   end
  812.   #--------------------------------------------------------------------------
  813.   # * New Method: Update Number of Memory Slot
  814.   #--------------------------------------------------------------------------
  815.   def update_number_of_slot
  816.     @memory_slot = (@dk_actor_stat[:atn] / 5).floor if @dk_actor_stat[:atn] % 5 == 0  || @dk_actor_stat[:atn] % 5 >= 1
  817.     @memory_slot = 0 if @memory_slot == nil
  818.   end
  819.   #--------------------------------------------------------------------------
  820.   # * New Method: Increase Actor Level
  821.   #--------------------------------------------------------------------------
  822.   def dk_level_up(increase)
  823.     @dk_actor_stat[:level] += increase
  824.   end
  825.   #--------------------------------------------------------------------------
  826.   # * New Method: Increase Actor Total Exp
  827.   #--------------------------------------------------------------------------
  828.   def increase_dk_actor_exp(increase)
  829.     @dk_actor_stat[:exp] += increase
  830.   end
  831.   #--------------------------------------------------------------------------
  832.   # * New Method: Increase Actor Vitality
  833.   #--------------------------------------------------------------------------
  834.   def increase_dk_actor_vit(increase)
  835.     @dk_actor_stat[:vit] += increase
  836.   end
  837.   #--------------------------------------------------------------------------
  838.   # * New Method: Increase Actor Intelligent
  839.   #--------------------------------------------------------------------------
  840.   def increase_dk_actor_int(increase)
  841.     @dk_actor_stat[:int] += increase
  842.   end
  843.   #--------------------------------------------------------------------------
  844.   # * New Method: Increase Actor Faith
  845.   #--------------------------------------------------------------------------
  846.   def increase_dk_actor_fth(increase)
  847.     @dk_actor_stat[:fth] += increase
  848.   end
  849.   #--------------------------------------------------------------------------
  850.   # * New Method: Increase Actor Strength
  851.   #--------------------------------------------------------------------------
  852.   def increase_dk_actor_str(increase)
  853.     @dk_actor_stat[:str] += increase
  854.   end
  855.   #--------------------------------------------------------------------------
  856.   # * New Method: Increase Actor Dexterity
  857.   #--------------------------------------------------------------------------
  858.   def increase_dk_actor_dex(increase)
  859.     @dk_actor_stat[:dex] += increase
  860.   end
  861.   #--------------------------------------------------------------------------
  862.   # * New Method: Increase Actor Luck
  863.   #--------------------------------------------------------------------------
  864.   def increase_dk_actor_luck(increase)
  865.     @dk_actor_stat[:luk] += increase
  866.   end
  867.   #--------------------------------------------------------------------------
  868.   # * New Method: Increase Actor Attunement
  869.   #--------------------------------------------------------------------------
  870.   def increase_dk_actor_atn(increase)
  871.     @dk_actor_stat[:atn] += increase
  872.     update_number_of_slot
  873.   end
  874.   #--------------------------------------------------------------------------
  875.   # * Learn Skill
  876.   #--------------------------------------------------------------------------
  877.   def learn_skill(skill_id)
  878.     @skills.push(skill_id)
  879.     @used_memory_slot = 0 if used_memory_slot == nil
  880.     @used_memory_slot += $data_skills[skill_id].get_memory_slot_required
  881.     @skills.sort!
  882.   end
  883.   #--------------------------------------------------------------------------
  884.   # * Forget Skill
  885.   #--------------------------------------------------------------------------
  886.   def forget_skill(skill_id)
  887.     @skills.delete(skill_id)
  888.     @used_memory_slot -= $data_skills[skill_id].get_memory_slot_required
  889.     @skills.sort!
  890.   end
  891.   #--------------------------------------------------------------------------
  892.   # * Check Skill if Learned
  893.   #--------------------------------------------------------------------------
  894.   def is_learned?(skill)
  895.     return @skills.include?(skill)
  896.   end
  897.   #--------------------------------------------------------------------------
  898.   # * New Method: Enable Physical Attack
  899.   #--------------------------------------------------------------------------
  900.   def activate_physical_attribute
  901.     @physical_attribute = true
  902.   end
  903.   #--------------------------------------------------------------------------
  904.   # * New Method: Enable Magical Attack
  905.   #--------------------------------------------------------------------------
  906.   def activate_magical_attribute
  907.     @magical_attribute = true
  908.   end
  909.   #--------------------------------------------------------------------------
  910.   # * New Method: Enable Magical Attack
  911.   #--------------------------------------------------------------------------
  912.   def activate_faith_attribute
  913.     @faith_attribute = true
  914.   end
  915.   #--------------------------------------------------------------------------
  916.   # * New Method: Disable Physical Attack
  917.   #--------------------------------------------------------------------------
  918.   def deactivate_physical_attribute
  919.     @physical_attribute = false
  920.   end
  921.   #--------------------------------------------------------------------------
  922.   # * New Method: Disable Magical Attack
  923.   #--------------------------------------------------------------------------
  924.   def deactivate_magical_attribute
  925.     @magical_attribute = false
  926.   end
  927.   #--------------------------------------------------------------------------
  928.   # * New Method: Disable Faith Attack
  929.   #--------------------------------------------------------------------------
  930.   def deactivate_faith_attribute
  931.     @faith_attribute = false
  932.   end
  933.   #--------------------------------------------------------------------------
  934.   # * Get Equipment Slot Array
  935.   #--------------------------------------------------------------------------
  936.   def equip_slots
  937.     return [0,0,1,2,3,4,4] # Show Weapon ,Shield, and Two Accessory Slots
  938.   end
  939.   #--------------------------------------------------------------------------
  940.   # * New Method: Deactive Physical, Magical, and Faith Attribute
  941.   #--------------------------------------------------------------------------
  942.   def deactivate_previous_attribute(slot_id)
  943.     item = @equips[slot_id].object
  944.     if item != nil && item.note =~ /Physical/
  945.       deactivate_physical_attribute
  946.     end
  947.     if item != nil && item.note =~ /Magical/
  948.       deactivate_magical_attribute
  949.     end
  950.     if item != nil && item.note =~ /Faith/
  951.       deactivate_faith_attribute
  952.     end
  953.     if slot_id == 1
  954.       item = @equips[2].object
  955.       if item != nil && item.note =~ /Physical/
  956.         deactivate_physical_attribute
  957.       end
  958.       if item != nil && item.note =~ /Magical/
  959.         deactivate_magical_attribute
  960.       end
  961.       if item != nil && item.note =~ /Faith/
  962.       deactivate_faith_attribute
  963.       end
  964.     end
  965.     if slot_id == 2
  966.       item = @equips[1].object
  967.       if item != nil && item.note =~ /Physical/
  968.         deactivate_physical_attribute
  969.       end
  970.       if item != nil && item.note =~ /Magical/
  971.         deactivate_magical_attribute
  972.       end
  973.       if item != nil && item.note =~ /Faith/
  974.       deactivate_faith_attribute
  975.     end
  976.     end
  977.   end
  978.   #--------------------------------------------------------------------------
  979.   # * Initialize Equipment
  980.   #     equips:  An array of initial equipment
  981.   #--------------------------------------------------------------------------
  982.   def init_equips(equips)
  983.     @equips = Array.new(equip_slots.size) { Game_BaseItem.new }
  984.     equips.each_with_index do |item_id, i|
  985.       etype_id = index_to_etype_id(i)
  986.       slot_id = empty_slot(etype_id)
  987.       @equips[slot_id].set_equip(etype_id == 0, item_id) if slot_id
  988.     end
  989.     refresh
  990.   end
  991.   #--------------------------------------------------------------------------
  992.   # * Change Equipment
  993.   #     slot_id:  Equipment slot ID
  994.   #     item:    Weapon/armor (remove equipment if nil)
  995.   #--------------------------------------------------------------------------
  996.   def change_equip(slot_id, item)
  997.     return unless trade_item_with_party(item, equips[slot_id])
  998.     return if item && equip_slots[slot_id] != item.etype_id
  999.     @equips[slot_id].object = item
  1000.     refresh
  1001.   end
  1002.   #--------------------------------------------------------------------------
  1003.   # * New Method: Change Destroyed Equipment
  1004.   #     slot_id:  Equipment slot ID
  1005.   #     item:    Weapon/armor (remove equipment if nil)
  1006.   #--------------------------------------------------------------------------
  1007.   def change_destroyed_equip(slot_id, item)
  1008.     return unless trade_item_with_party(item, equips[slot_id])
  1009.     return if item && equip_slots[slot_id] != item.etype_id
  1010.     @equips[slot_id].object = item
  1011.     RPG::SE.new("Break", 100, 100).play
  1012.     refresh
  1013.   end
  1014.   #--------------------------------------------------------------------------
  1015.   # * Processing Performed When Player Takes 1 Step
  1016.   #--------------------------------------------------------------------------
  1017.   alias ggslayer_dark_souls_system_Game_Actor_on_player_walk   on_player_walk
  1018.   def on_player_walk
  1019.     ggslayer_dark_souls_system_Game_Actor_on_player_walk
  1020.     check_floor_region
  1021.   end
  1022.   #--------------------------------------------------------------------------
  1023.   # * Determine Floor Region Effect
  1024.   #--------------------------------------------------------------------------
  1025.   def check_floor_region
  1026.     execute_floor_durability_damage if $game_player.on_region_floor? == Durability_Effect_Region_ID
  1027.   end
  1028.   #--------------------------------------------------------------------------
  1029.   # * Floor Damage Processing
  1030.   #--------------------------------------------------------------------------
  1031.   def execute_floor_durability_damage
  1032.     (self.equips[3]).decrease_durability(Durability_Decrease_from_Field) if (self.equips[3])  != nil
  1033.     (self.equips[4]).decrease_durability(Durability_Decrease_from_Field) if (self.equips[4])  != nil
  1034.     (self.equips[5]).decrease_durability(Durability_Decrease_from_Field) if (self.equips[5])  != nil
  1035.     (self.equips[6]).decrease_durability(Durability_Decrease_from_Field) if (self.equips[6])  != nil
  1036.     perform_map_damage_effect
  1037.     check_armor_condition
  1038.   end
  1039.   #--------------------------------------------------------------------------
  1040.   # * new Method: Check Armor Condition
  1041.   #--------------------------------------------------------------------------
  1042.   def check_armor_condition
  1043.     self.change_destroyed_equip(3, nil) if (self.equips[3]) != nil && (self.equips[3]).get_durability == 0
  1044.     self.change_destroyed_equip(4, nil) if (self.equips[4]) != nil && (self.equips[4]).get_durability == 0
  1045.     self.change_destroyed_equip(5, nil) if (self.equips[5]) != nil && (self.equips[5]).get_durability == 0
  1046.     self.change_destroyed_equip(6, nil) if (self.equips[6]) != nil && (self.equips[6]).get_durability == 0  
  1047.   end
  1048. end
  1049. #==============================================================================
  1050. # ** Game_Player
  1051. #------------------------------------------------------------------------------
  1052. #  This class handles the player. It includes event starting determinants and
  1053. # map scrolling functions. The instance of this class is referenced by
  1054. # $game_player.
  1055. #==============================================================================
  1056.  
  1057. class Game_Player < Game_Character
  1058.   #--------------------------------------------------------------------------
  1059.   # * Determine if Damage Floor
  1060.   #--------------------------------------------------------------------------
  1061.   def on_region_floor?
  1062.     if !in_airship?
  1063.       $game_map.region_id(@x, @y)
  1064.     end
  1065.   end
  1066. end
  1067. #==============================================================================
  1068. # ** Game_Party
  1069. #------------------------------------------------------------------------------
  1070. #  This class handles parties. Information such as gold and items is included.
  1071. # Instances of this class are referenced by $game_party.
  1072. #==============================================================================
  1073.  
  1074. class Game_Party < Game_Unit
  1075.   attr_reader   :exp
  1076.   #--------------------------------------------------------------------------
  1077.   # * Object Initialization
  1078.   #--------------------------------------------------------------------------
  1079.   alias dk_dark_souls_stat_point_game_party_initialize    initialize
  1080.   def initialize
  1081.     dk_dark_souls_stat_point_game_party_initialize
  1082.     @exp = 0
  1083.   end
  1084.   #--------------------------------------------------------------------------
  1085.   # * New Method: Increase Exp
  1086.   #--------------------------------------------------------------------------
  1087.   def gain_exp(amount)
  1088.     @exp = [[@exp + amount, 0].max, max_exp].min
  1089.   end
  1090.   #--------------------------------------------------------------------------
  1091.   # * New Method: Decrease Exp
  1092.   #--------------------------------------------------------------------------
  1093.   def lose_exp(amount)
  1094.     gain_exp(-amount)
  1095.   end
  1096.   #--------------------------------------------------------------------------
  1097.   # * New Method: Get Maximum Value of Exp
  1098.   #--------------------------------------------------------------------------
  1099.   def max_exp
  1100.     return 99999999
  1101.   end
  1102. end
  1103.  
  1104. #==============================================================================
  1105. # ** Window_Base
  1106. #------------------------------------------------------------------------------
  1107. #  This is a super class of all windows within the game.
  1108. #==============================================================================
  1109.  
  1110. class Window_Base < Window
  1111.   include GGSlayer::Dark_Souls_System
  1112.   #--------------------------------------------------------------------------
  1113.   # * Draw Icon
  1114.   #     enabled : Enabled flag. When false, draw semi-transparently.
  1115.   #--------------------------------------------------------------------------
  1116.   alias ggslayer_dark_souls_system_window_base_draw_icon   draw_icon
  1117.   def draw_icon(icon_index, x, y, enabled = true, ds_used = false)
  1118.     if ds_used
  1119.       bitmap = Cache.system(DS_ICONS)
  1120.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  1121.       contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  1122.     else
  1123.       ggslayer_dark_souls_system_window_base_draw_icon(icon_index, x, y, enabled)
  1124.     end
  1125.   end
  1126. end
  1127.  
  1128. #==============================================================================
  1129. # ** Window_Exp
  1130. #------------------------------------------------------------------------------
  1131. #  This window displays the party's exp.
  1132. #==============================================================================
  1133. class Window_Exp  < Window_Base
  1134.   include GGSlayer::Dark_Souls_System
  1135.   #--------------------------------------------------------------------------
  1136.   # * Object Initialization
  1137.   #--------------------------------------------------------------------------
  1138.   def initialize
  1139.     super(0, 0, window_width, fitting_height(1))
  1140.     refresh
  1141.   end
  1142.   #--------------------------------------------------------------------------
  1143.   # * Get Window Width
  1144.   #--------------------------------------------------------------------------
  1145.   def window_width
  1146.     return 160
  1147.   end
  1148.   #--------------------------------------------------------------------------
  1149.   # * Refresh
  1150.   #--------------------------------------------------------------------------
  1151.   def refresh
  1152.     contents.clear
  1153.     draw_exp_value(exp_value, 4, 0, contents.width - 8)
  1154.   end
  1155.   #--------------------------------------------------------------------------
  1156.   # * Draw Exp
  1157.   #--------------------------------------------------------------------------
  1158.   def draw_exp_value(value, x, y, width)
  1159.     draw_icon(EXP_ICON, width - 15, y, true, true)
  1160.     change_color(normal_color)
  1161.     draw_text(x, y, width - 17, line_height, value, 2)
  1162.   end
  1163.   #--------------------------------------------------------------------------
  1164.   # * Get Party Exp
  1165.   #--------------------------------------------------------------------------
  1166.   def exp_value
  1167.     return $game_party.exp
  1168.   end
  1169.   #--------------------------------------------------------------------------
  1170.   # * Open Window
  1171.   #--------------------------------------------------------------------------
  1172.   def open
  1173.     refresh
  1174.     super
  1175.   end
  1176. end
  1177. #==============================================================================
  1178. # ** Window_Status_Point
  1179. #------------------------------------------------------------------------------
  1180. #  This window displays full status specs on the status screen
  1181. #  Also, Level Up Chosen Actor.
  1182. #==============================================================================
  1183.  
  1184. class Window_Status_Point < Window_Selectable
  1185.   #--------------------------------------------------------------------------
  1186.   # * Object Initialization
  1187.   #--------------------------------------------------------------------------
  1188.   def initialize(actor)
  1189.     super(0, 0, Graphics.width, Graphics.height)
  1190.     @actor = actor
  1191.     refresh
  1192.     activate
  1193.   end
  1194.   #--------------------------------------------------------------------------
  1195.   # * Set Actor
  1196.   #--------------------------------------------------------------------------
  1197.   def actor=(actor)
  1198.     return if @actor == actor
  1199.     @actor = actor
  1200.     refresh
  1201.   end
  1202.   #--------------------------------------------------------------------------
  1203.   # * Refresh
  1204.   #--------------------------------------------------------------------------
  1205.   def refresh
  1206.     contents.clear
  1207.     draw_block1   (line_height * 0)
  1208.     draw_horz_line(line_height * 1)
  1209.     draw_block2   (line_height * 2)
  1210.     draw_horz_line(line_height * 6)
  1211.     draw_block3   (line_height * 7)
  1212.   end
  1213.   #--------------------------------------------------------------------------
  1214.   # * Draw Block 1
  1215.   #--------------------------------------------------------------------------
  1216.   def draw_block1(y)
  1217.     draw_actor_name(@actor, 4, y)
  1218.     draw_actor_class(@actor, 128, y)
  1219.     draw_actor_nickname(@actor, 288, y)
  1220.   end
  1221.   #--------------------------------------------------------------------------
  1222.   # * Draw Block 2
  1223.   #--------------------------------------------------------------------------
  1224.   def draw_block2(y)
  1225.     draw_actor_face(@actor, 8, y)
  1226.     draw_basic_info(136, y)
  1227.     draw_exp_info(304, y)
  1228.   end
  1229.   #--------------------------------------------------------------------------
  1230.   # * Draw Block 3
  1231.   #--------------------------------------------------------------------------
  1232.   def draw_block3(y)
  1233.     draw_parameters(288, y)
  1234.   end
  1235.   #--------------------------------------------------------------------------
  1236.   # * Draw Horizontal Line
  1237.   #--------------------------------------------------------------------------
  1238.   def draw_horz_line(y)
  1239.     line_y = y + line_height / 2 - 1
  1240.     contents.fill_rect(0, line_y, contents_width, 2, line_color)
  1241.   end
  1242.   #--------------------------------------------------------------------------
  1243.   # * Get Color of Horizontal Line
  1244.   #--------------------------------------------------------------------------
  1245.   def line_color
  1246.     color = normal_color
  1247.     color.alpha = 48
  1248.     color
  1249.   end
  1250.   #--------------------------------------------------------------------------
  1251.   # * Draw Basic Information
  1252.   #--------------------------------------------------------------------------
  1253.   def draw_basic_info(x, y)
  1254.     draw_actor_level(@actor, x, y + line_height * 0)
  1255.     draw_actor_icons(@actor, x, y + line_height * 1)
  1256.     draw_actor_hp(@actor, x, y + line_height * 2)
  1257.     draw_actor_mp(@actor, x, y + line_height * 3)
  1258.   end
  1259.   #--------------------------------------------------------------------------
  1260.   # * Draw Level
  1261.   #--------------------------------------------------------------------------
  1262.   def draw_actor_level(actor, x, y)
  1263.     change_color(system_color)
  1264.     draw_text(x, y, 32, line_height, Vocab::level_a)
  1265.     change_color(normal_color)
  1266.     draw_text(x + 32, y, 24, line_height, actor.get_dk_actor_level, 2)
  1267.   end
  1268.   #--------------------------------------------------------------------------
  1269.   # * Draw HP
  1270.   #--------------------------------------------------------------------------
  1271.   def draw_actor_hp(actor, x, y, width = 124)
  1272.     draw_gauge(x, y - 6, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  1273.     change_color(system_color)
  1274.     draw_text(x, y - 11, 30, line_height, Vocab::hp_a)
  1275.     draw_current_and_max_values(x, y - 11, width, actor.hp, actor.mhp,
  1276.       hp_color(actor), normal_color)
  1277.   end
  1278.   #--------------------------------------------------------------------------
  1279.   # * Draw MP
  1280.   #--------------------------------------------------------------------------
  1281.   def draw_actor_mp(actor, x, y, width = 124)
  1282.     draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  1283.     change_color(system_color)
  1284.     draw_text(x, y - 5, 30, line_height, Vocab::mp_a)
  1285.     draw_current_and_max_values(x, y - 5, width, actor.mp, actor.mmp,
  1286.       mp_color(actor), normal_color)
  1287.   end
  1288.   #--------------------------------------------------------------------------
  1289.   # * New Method: Draw Increase and Decrease of HP
  1290.   #--------------------------------------------------------------------------
  1291.   def draw_actor_hp_change(actor, x, y, change, width = 124)
  1292.     contents.clear_rect(x + width - 42, y, 42, line_height)
  1293.     change_color(system_color)
  1294.     change_color(normal_color) if change == 0
  1295.     if actor.mhp + change > 9999
  1296.       draw_text(x + width - 42, y + 3, 42, line_height, 9999, 2)
  1297.     else  
  1298.       draw_text(x + width - 42, y + 3, 42, line_height, actor.mhp + change, 2)
  1299.     end
  1300.   end
  1301.   #--------------------------------------------------------------------------
  1302.   # * New Method: Draw Increase and Decrease of MP
  1303.   #--------------------------------------------------------------------------
  1304.   def draw_actor_mp_change(actor, x, y, change, width = 124)
  1305.     contents.clear_rect(x + width - 42, y, 42, line_height)
  1306.     change_color(system_color)
  1307.     change_color(normal_color) if change == 0
  1308.     draw_text(x + width - 42, y + 3, 42, line_height, actor.mmp + change, 2)
  1309.   end
  1310.   #--------------------------------------------------------------------------
  1311.   # * New Method: Draw Increase and Decrease of Level
  1312.   #--------------------------------------------------------------------------
  1313.   def draw_actor_level_change(actor, x, y, change)
  1314.     contents.clear_rect(x + 32, y, 24, line_height)
  1315.     change_color(system_color)
  1316.     change_color(normal_color) if change == 0
  1317.     draw_text(x + 32, y, 24, line_height, actor.get_dk_actor_level + change, 2)
  1318.   end
  1319.   #--------------------------------------------------------------------------
  1320.   # * New Method: Draw Increase and Decrease of Exp
  1321.   #--------------------------------------------------------------------------
  1322.   def draw_actor_level_exp_change(x, y, actor_exp, actor_lv)
  1323.     s1 = @actor.max_level_at_level_up?(actor_lv) ? "-------" : actor_exp
  1324.     s2 = @actor.max_level_at_level_up?(actor_lv) ? "-------" : @actor.exp_for_level(actor_lv + 1) - @actor.exp_for_level(actor_lv)
  1325.     contents.clear_rect(x, y + line_height * 1, 180, line_height)
  1326.     contents.clear_rect(x, y + line_height * 3, 180, line_height)
  1327.     change_color(system_color)
  1328.     change_color(normal_color) if actor_exp == @actor.get_dk_actor_exp
  1329.     draw_text(x, y + line_height * 1, 180, line_height, s1, 2)
  1330.     draw_text(x, y + line_height * 3, 180, line_height, s2, 2)
  1331.   end
  1332.   #--------------------------------------------------------------------------
  1333.   # * Draw Parameters
  1334.   #--------------------------------------------------------------------------
  1335.   def draw_actor_param(actor, x, y, param_id)
  1336.     change_color(system_color)
  1337.     draw_text(x, y + 17, 120, line_height, Vocab::param(param_id))
  1338.     change_color(normal_color)
  1339.     draw_text(x + 100, y + 17, 36, line_height, actor.param(param_id), 2)
  1340.   end
  1341.   #--------------------------------------------------------------------------
  1342.   # * Draw Actor Memory Slot
  1343.   #--------------------------------------------------------------------------
  1344.   def draw_actor_memory_slot(actor, x, y)
  1345.     change_color(system_color)
  1346.     draw_text(x, y + 17, 120, line_height, "ATN")
  1347.     change_color(normal_color)
  1348.     draw_text(x + 100, y + 17, 36, line_height, actor.get_number_of_slot, 2)
  1349.   end
  1350.   #--------------------------------------------------------------------------
  1351.   # * Draw Parameters
  1352.   #--------------------------------------------------------------------------
  1353.   def draw_parameters(x, y)
  1354.     6.times {|i| draw_actor_param(@actor, x, y + line_height * i, i + 2) }
  1355.     draw_actor_memory_slot(@actor, x, y + line_height * 6)
  1356.   end
  1357.   #--------------------------------------------------------------------------
  1358.   # * New Method: Draw Increase and Decrease of Parameters
  1359.   #--------------------------------------------------------------------------
  1360.   def draw_actor_param_change(actor, x, y, location, change, param_id)
  1361.     contents.clear_rect(x + 100, y + line_height * location + 17, 36, line_height)
  1362.     change_color(system_color)
  1363.     change_color(normal_color) if change == 0
  1364.     draw_text(x + 100, y + line_height * location + 17, 36, line_height, actor.param(param_id) + change, 2) if param_id != 8
  1365.     draw_text(x + 100, y + line_height * location + 17, 36, line_height, change, 2) if param_id == 8
  1366.   end
  1367.   #--------------------------------------------------------------------------
  1368.   # * Draw Experience Information
  1369.   #--------------------------------------------------------------------------
  1370.   def draw_exp_info(x, y)
  1371.     s1 = @actor.max_level? ? "-------" : @actor.get_dk_actor_exp
  1372.     s2 = @actor.max_level? ? "-------" : @actor.next_level_exp - @actor.exp_for_level(@actor.get_dk_actor_level)
  1373.     s_next = sprintf(Vocab::ExpNext, Vocab::level)
  1374.     change_color(system_color)
  1375.     draw_text(x, y + line_height * 0, 180, line_height, Vocab::ExpTotal)
  1376.     draw_text(x, y + line_height * 2, 180, line_height, s_next)
  1377.     change_color(normal_color)
  1378.     draw_text(x, y + line_height * 1, 180, line_height, s1, 2)
  1379.     draw_text(x, y + line_height * 3, 180, line_height, s2, 2)
  1380.   end
  1381.   #--------------------------------------------------------------------------
  1382.   # * New Method: Redraw Exp With Normal Color After Increase
  1383.   #--------------------------------------------------------------------------
  1384.   def return_exp_color(x = 304, y = 48)
  1385.     s1 = @actor.max_level? ? "-------" : @actor.get_dk_actor_exp
  1386.     s2 = @actor.max_level? ? "-------" : @actor.next_level_exp - @actor.exp_for_level(@actor.get_dk_actor_level)
  1387.     contents.clear_rect(x, y + line_height * 1, 180, line_height)
  1388.     contents.clear_rect(x, y + line_height * 3, 180, line_height)
  1389.     change_color(normal_color)
  1390.     draw_text(x, y + line_height * 1, 180, line_height, s1, 2)
  1391.     draw_text(x, y + line_height * 3, 180, line_height, s2, 2)
  1392.   end
  1393.   #--------------------------------------------------------------------------
  1394.   # * New Method: Redraw Parameters With Normal Color After Increase
  1395.   #--------------------------------------------------------------------------
  1396.   def return_parameters_color(x = 288, y = 168)
  1397.     contents.clear_rect(x, y, x, y + line_height * 6)
  1398.     draw_parameters(x, y)
  1399.   end
  1400.   #--------------------------------------------------------------------------
  1401.   # * New Method: Redraw Level With Normal Color After Increase
  1402.   #--------------------------------------------------------------------------
  1403.   def return_actor_level_normal_color(actor, x = 136, y = 48)
  1404.     contents.clear_rect(x + 32, y, 24, line_height)
  1405.     change_color(normal_color)
  1406.     draw_text(x + 32, y, 24, line_height, actor.get_dk_actor_level, 2)
  1407.   end
  1408.   #--------------------------------------------------------------------------
  1409.   # * New Method: Redraw HP With Normal Color After Increase
  1410.   #--------------------------------------------------------------------------
  1411.   def return_actor_hp_normal_color(actor, x = 136, y = 82, width = 124)
  1412.     contents.clear_rect(x + width - 42, y, 42, line_height)
  1413.     change_color(normal_color)
  1414.     draw_text(x + width - 42, y + 3, 42, line_height, actor.mhp, 2)
  1415.   end
  1416.   #--------------------------------------------------------------------------
  1417.   # * New Method: Redraw MP With Normal Color After Increase
  1418.   #--------------------------------------------------------------------------
  1419.   def return_actor_mp_normal_color(actor, x = 136, y = 112, width = 124)
  1420.     contents.clear_rect(x + width - 42, y, 42, line_height)
  1421.     change_color(normal_color)
  1422.     draw_text(x + width - 42, y + 3, 42, line_height, actor.mmp, 2)
  1423.   end
  1424.   #--------------------------------------------------------------------------
  1425.   # * Handling Processing for OK and Cancel Etc.
  1426.   #--------------------------------------------------------------------------
  1427.   def process_handling
  1428.     return unless open? && active
  1429.     return process_cancel   if cancel_enabled?    && Input.trigger?(:B)
  1430.   end
  1431. end
  1432. #==============================================================================
  1433. # ** Window_MenuStatus
  1434. #------------------------------------------------------------------------------
  1435. #  This window displays party member status on the menu screen.
  1436. #==============================================================================
  1437.  
  1438. class Window_MenuStatus < Window_Selectable
  1439.   #--------------------------------------------------------------------------
  1440.   # * Draw Level
  1441.   #--------------------------------------------------------------------------
  1442.   alias ggslayer_Dark_souls_stat_points_window_menustatus_draw_actor_level   draw_actor_level
  1443.   def draw_actor_level(actor, x, y)
  1444.     change_color(system_color)
  1445.     draw_text(x, y, 32, line_height, Vocab::level_a)
  1446.     change_color(normal_color)
  1447.     draw_text(x + 32, y, 24, line_height, actor.get_dk_actor_level, 2)
  1448.   end
  1449. end
  1450. #==============================================================================
  1451. # ** Stat_Commands
  1452. #------------------------------------------------------------------------------
  1453. #  This window deals with Actor Status command choices.
  1454. #==============================================================================
  1455. class Stat_Commands < Window_Command
  1456.   include GGSlayer::Dark_Souls_System
  1457.     attr_accessor       :exp
  1458.     attr_accessor       :last_vit
  1459.     attr_accessor       :last_int
  1460.     attr_accessor       :last_fth
  1461.     attr_accessor       :last_str
  1462.     attr_accessor       :lat_dex
  1463.     attr_accessor       :last_luck
  1464.     attr_accessor       :last_atn
  1465.   #--------------------------------------------------------------------------
  1466.   # * Object Initialization
  1467.   #--------------------------------------------------------------------------
  1468.   def initialize(x, y, actor)
  1469.     super(x, y)
  1470.     @actor = actor
  1471.     @exp = $game_party.exp
  1472.     @last_vit   = @actor.get_dk_actor_vit
  1473.     @last_int   = @actor.get_dk_actor_int
  1474.     @last_fth   = @actor.get_dk_actor_fth
  1475.     @last_str   = @actor.get_dk_actor_str
  1476.     @last_dex   = @actor.get_dk_actor_dex
  1477.     @last_luck  = @actor.get_dk_actor_luck
  1478.     @last_atn   = @actor.get_dk_actor_atn
  1479.     draw_party_exp
  1480.     draw_stat(@actor)
  1481.   end
  1482.   #--------------------------------------------------------------------------
  1483.   # * Get Window Width
  1484.   #--------------------------------------------------------------------------
  1485.   def window_width
  1486.     return 200
  1487.   end
  1488.   #--------------------------------------------------------------------------
  1489.   # * Get Window Height
  1490.   #--------------------------------------------------------------------------
  1491.   def window_height
  1492.     return 250
  1493.   end
  1494.   #--------------------------------------------------------------------------
  1495.   # * Get Rectangle for Drawing Items
  1496.   #--------------------------------------------------------------------------
  1497.   def item_rect(index)
  1498.     rect = Rect.new
  1499.     rect.width = 158
  1500.     rect.height = item_height
  1501.     rect.x = index % col_max * (item_width + spacing)
  1502.     rect.y = (index / col_max * item_height) + 24
  1503.     rect
  1504.   end
  1505.   #--------------------------------------------------------------------------
  1506.   # * New Method: Draw Temporary Increase Of Vitality
  1507.   #--------------------------------------------------------------------------
  1508.   def draw_increase_vit(y, next_level_exp)
  1509.     contents.clear_rect(50,0, 150, line_height)
  1510.     contents.clear_rect(100,y, 100, line_height)
  1511.     change_color(system_color)
  1512.     draw_text(4,0, 155, line_height, @exp -= next_level_exp, 2)
  1513.     draw_text(4,y, 155, line_height, @last_vit += 1, 2)
  1514.   end
  1515.   #--------------------------------------------------------------------------
  1516.   # * New Method: Draw Temporary Increase Of Intelligent
  1517.   #--------------------------------------------------------------------------
  1518.   def draw_increase_int(y, next_level_exp)
  1519.     contents.clear_rect(50,0, 150, line_height)
  1520.     contents.clear_rect(100,y, 100, line_height)
  1521.     change_color(system_color)
  1522.     draw_text(4,0, 155, line_height, @exp -= next_level_exp, 2)
  1523.     draw_text(4,y, 155, line_height, @last_int += 1, 2)
  1524.   end
  1525.   #--------------------------------------------------------------------------
  1526.   # * New Method: Draw Temporary Increase Of Faith
  1527.   #--------------------------------------------------------------------------
  1528.   def draw_increase_fth(y, next_level_exp)
  1529.     contents.clear_rect(50,0, 150, line_height)
  1530.     contents.clear_rect(100,y, 100, line_height)
  1531.     change_color(system_color)
  1532.     draw_text(4,0, 155, line_height, @exp -= next_level_exp, 2)
  1533.     draw_text(4,y, 155, line_height, @last_fth += 1, 2)
  1534.   end
  1535.   #--------------------------------------------------------------------------
  1536.   # * New Method: Draw Temporary Increase Of Strength
  1537.   #--------------------------------------------------------------------------
  1538.   def draw_increase_str(y, next_level_exp)
  1539.     contents.clear_rect(50,0, 150, line_height)
  1540.     contents.clear_rect(100,y, 100, line_height)
  1541.     change_color(system_color)
  1542.     draw_text(4,0, 155, line_height, @exp -= next_level_exp, 2)
  1543.     draw_text(4,y, 155, line_height, @last_str += 1, 2)
  1544.   end
  1545.   #--------------------------------------------------------------------------
  1546.   # * New Method: Draw Temporary Increase Of Dexterity
  1547.   #--------------------------------------------------------------------------
  1548.   def draw_increase_dex(y, next_level_exp)
  1549.     contents.clear_rect(50,0, 150, line_height)
  1550.     contents.clear_rect(100,y, 100, line_height)
  1551.     change_color(system_color)
  1552.     draw_text(4,0, 155, line_height, @exp -= next_level_exp, 2)
  1553.     draw_text(4,y, 155, line_height, @last_dex += 1, 2)
  1554.   end
  1555.   #--------------------------------------------------------------------------
  1556.   # * New Method: Draw Temporary Increase Of Luck
  1557.   #--------------------------------------------------------------------------
  1558.   def draw_increase_luck(y, next_level_exp)
  1559.     contents.clear_rect(50,0, 150, line_height)
  1560.     contents.clear_rect(100,y, 100, line_height)
  1561.     change_color(system_color)
  1562.     draw_text(4,0, 155, line_height, @exp -= next_level_exp, 2)
  1563.     draw_text(4,y, 155, line_height, @last_luck += 1, 2)
  1564.   end
  1565.   #--------------------------------------------------------------------------
  1566.   # * New Method: Draw Temporary Increase Of Attunement
  1567.   #--------------------------------------------------------------------------
  1568.   def draw_increase_atn(y, next_level_exp)
  1569.     contents.clear_rect(50,0, 150, line_height)
  1570.     contents.clear_rect(100,y, 100, line_height)
  1571.     change_color(system_color)
  1572.     draw_text(4,0, 155, line_height, @exp -= next_level_exp, 2)
  1573.     draw_text(4,y, 155, line_height, @last_atn += 1, 2)
  1574.   end
  1575.   #--------------------------------------------------------------------------
  1576.   # * New Method: Draw Temporary Decrease Of Vitality
  1577.   #--------------------------------------------------------------------------
  1578.   def draw_decrease_vit(y, previous_level_exp)
  1579.     @last_vit -= 1
  1580.     contents.clear_rect(50,0, 150, line_height)
  1581.     contents.clear_rect(100,y, 100, line_height)
  1582.     change_color(system_color)
  1583.     change_color(normal_color) if @last_vit == @actor.get_dk_actor_vit
  1584.     draw_text(4,0, 155, line_height, @exp += previous_level_exp, 2)
  1585.     draw_text(4,y, 155, line_height, @last_vit, 2)
  1586.   end
  1587.   #--------------------------------------------------------------------------
  1588.   # * New Method: Draw Temporary Decrease Of intelligent
  1589.   #--------------------------------------------------------------------------
  1590.   def draw_decrease_int(y, previous_level_exp)
  1591.     @last_int -= 1
  1592.     contents.clear_rect(50,0, 150, line_height)
  1593.     contents.clear_rect(100,y, 100, line_height)
  1594.     change_color(system_color)
  1595.     change_color(normal_color) if @last_int == @actor.get_dk_actor_int
  1596.     draw_text(4,0, 155, line_height, @exp += previous_level_exp, 2)
  1597.     draw_text(4,y, 155, line_height, @last_int, 2)
  1598.   end
  1599.   #--------------------------------------------------------------------------
  1600.   # * New Method: Draw Temporary Decrease Of Faith
  1601.   #--------------------------------------------------------------------------
  1602.   def draw_decrease_fth(y, previous_level_exp)
  1603.     @last_fth -= 1
  1604.     contents.clear_rect(50,0, 150, line_height)
  1605.     contents.clear_rect(100,y, 100, line_height)
  1606.     change_color(system_color)
  1607.     change_color(normal_color) if @last_fth == @actor.get_dk_actor_fth
  1608.     draw_text(4,0, 155, line_height, @exp += previous_level_exp, 2)
  1609.     draw_text(4,y, 155, line_height, @last_fth, 2)
  1610.   end
  1611.   #--------------------------------------------------------------------------
  1612.   # * New Method: Draw Temporary Decrease Of Strength
  1613.   #--------------------------------------------------------------------------
  1614.   def draw_decrease_str(y, previous_level_exp)
  1615.     @last_str -= 1
  1616.     contents.clear_rect(50,0, 150, line_height)
  1617.     contents.clear_rect(100,y, 100, line_height)
  1618.     change_color(system_color)
  1619.     change_color(normal_color) if @last_str == @actor.get_dk_actor_str
  1620.     draw_text(4,0, 155, line_height, @exp += previous_level_exp, 2)
  1621.     draw_text(4,y, 155, line_height, @last_str, 2)
  1622.   end
  1623.   #--------------------------------------------------------------------------
  1624.   # * New Method: Draw Temporary Decrease Of Dexterity
  1625.   #--------------------------------------------------------------------------
  1626.   def draw_decrease_dex(y, previous_level_exp)
  1627.     @last_dex -= 1
  1628.     contents.clear_rect(50,0, 150, line_height)
  1629.     contents.clear_rect(100,y, 100, line_height)
  1630.     change_color(system_color)
  1631.     change_color(normal_color) if @last_dex == @actor.get_dk_actor_dex
  1632.     draw_text(4,0, 155, line_height, @exp += previous_level_exp, 2)
  1633.     draw_text(4,y, 155, line_height, @last_dex, 2)
  1634.   end
  1635.   #--------------------------------------------------------------------------
  1636.   # * New Method: Draw Temporary Decrease Of Luck
  1637.   #--------------------------------------------------------------------------
  1638.   def draw_decrease_luck(y, previous_level_exp)
  1639.     @last_luck -= 1
  1640.     contents.clear_rect(50,0, 150, line_height)
  1641.     contents.clear_rect(100,y, 100, line_height)
  1642.     change_color(system_color)
  1643.     change_color(normal_color) if @last_luck == @actor.get_dk_actor_luck
  1644.     draw_text(4,0, 155, line_height, @exp += previous_level_exp, 2)
  1645.     draw_text(4,y, 155, line_height, @last_luck, 2)
  1646.   end
  1647.   #--------------------------------------------------------------------------
  1648.   # * New Method: Draw Temporary Decrease Of Attumenet
  1649.   #--------------------------------------------------------------------------
  1650.   def draw_decrease_atn(y, previous_level_exp)
  1651.     @last_atn -= 1
  1652.     contents.clear_rect(50,0, 150, line_height)
  1653.     contents.clear_rect(100,y, 100, line_height)
  1654.     change_color(system_color)
  1655.     change_color(normal_color) if @last_atn == @actor.get_dk_actor_atn
  1656.     draw_text(4,0, 155, line_height, @exp += previous_level_exp, 2)
  1657.     draw_text(4,y, 155, line_height, @last_atn, 2)
  1658.   end
  1659.   #--------------------------------------------------------------------------
  1660.   # * Create Command List
  1661.   #--------------------------------------------------------------------------
  1662.   def make_command_list
  1663.     @list.push({:name=>"",  :symbol=>:vit, :enabled=>true, :ext=>nil})
  1664.     @list.push({:name=>"",  :symbol=>:int, :enabled=>true, :ext=>nil})
  1665.     @list.push({:name=>"",  :symbol=>:fth, :enabled=>true, :ext=>nil})
  1666.     @list.push({:name=>"",  :symbol=>:str, :enabled=>true, :ext=>nil})
  1667.     @list.push({:name=>"",  :symbol=>:dex, :enabled=>true, :ext=>nil})
  1668.     @list.push({:name=>"", :symbol=>:luck, :enabled=>true, :ext=>nil})
  1669.     @list.push({:name=>"", :symbol=>:atn, :enabled=>true, :ext=>nil})
  1670.   end
  1671.   #--------------------------------------------------------------------------
  1672.   # * New Method: Draw Party Exp
  1673.   #--------------------------------------------------------------------------
  1674.   def draw_party_exp
  1675.     draw_icon(EXP_ICON, 4, 0, true, true)
  1676.     change_color(normal_color)
  1677.     draw_text(4, 0, 155, line_height, @exp, 2)
  1678.   end
  1679.   #--------------------------------------------------------------------------
  1680.   # * New Method: Draw Actor Stat
  1681.   #--------------------------------------------------------------------------
  1682.   def draw_stat(actor)
  1683.     draw_icon(VIT_ICON, 4, line_height, true, true)
  1684.     draw_icon(INT_ICON, 4, line_height * 2, true, true)
  1685.     draw_icon(FTH_ICON, 4, line_height * 3, true, true)
  1686.     draw_icon(STR_ICON, 4, line_height * 4, true, true)
  1687.     draw_icon(DEX_ICON, 4, line_height * 5, true, true)
  1688.     draw_icon(LUK_ICON, 4, line_height * 6, true, true)
  1689.     draw_icon(ATN_ICON, 4, line_height * 7, true, true)
  1690.     change_color(normal_color)
  1691.     draw_text(4, line_height,  155, line_height, actor.get_dk_actor_vit, 2)
  1692.     draw_text(4, line_height * 2, 155, line_height, actor.get_dk_actor_int, 2)
  1693.     draw_text(4, line_height * 3, 155, line_height, actor.get_dk_actor_fth, 2)
  1694.     draw_text(4, line_height * 4, 155, line_height, actor.get_dk_actor_str, 2)
  1695.     draw_text(4, line_height * 5, 155, line_height, actor.get_dk_actor_dex, 2)
  1696.     draw_text(4, line_height * 6, 155, line_height, actor.get_dk_actor_luck, 2)
  1697.     draw_text(4, line_height * 7, 155, line_height, actor.get_dk_actor_atn, 2)
  1698.   end
  1699.   #--------------------------------------------------------------------------
  1700.   # * New Method: Redraw Actor Stat After
  1701.   #--------------------------------------------------------------------------
  1702.   def return_actor_stat_normal_color(actor)
  1703.     contents.clear_rect(100, 0, 155, line_height)
  1704.     contents.clear_rect(100, 24,  155, line_height)
  1705.     contents.clear_rect(100, 48, 155, line_height)
  1706.     contents.clear_rect(100, 72, 155, line_height)
  1707.     contents.clear_rect(100, 98, 155, line_height)
  1708.     contents.clear_rect(100, 122, 155, line_height)
  1709.     contents.clear_rect(100, 146, 155, line_height)
  1710.     contents.clear_rect(100, 170, 155, line_height)
  1711.     change_color(normal_color)
  1712.     draw_text(4, 0, 155, line_height, @exp, 2)
  1713.     draw_text(4, 24,  155, line_height, actor.get_dk_actor_vit, 2)
  1714.     draw_text(4, 48, 155, line_height, actor.get_dk_actor_int, 2)
  1715.     draw_text(4, 72, 155, line_height, actor.get_dk_actor_fth, 2)
  1716.     draw_text(4, 98, 155, line_height, actor.get_dk_actor_str, 2)
  1717.     draw_text(4, 122, 155, line_height, actor.get_dk_actor_dex, 2)
  1718.     draw_text(4, 146, 155, line_height, actor.get_dk_actor_luck, 2)
  1719.     draw_text(4, 170, 155, line_height, actor.get_dk_actor_atn, 2)
  1720.   end
  1721.   #--------------------------------------------------------------------------
  1722.   # * Handling Processing for OK and Cancel Etc.
  1723.   #--------------------------------------------------------------------------
  1724.   def process_handling
  1725.     return unless open? && active
  1726.     return process_ok       if ok_enabled?        && Input.trigger?(:C)
  1727.     return process_cancel   if cancel_enabled?    && Input.trigger?(:B)
  1728.     return process_increase if handle?(:increase) && Input.trigger?(:RIGHT)
  1729.     return process_decrease if handle?(:decrease) && Input.trigger?(:LEFT)
  1730.   end
  1731.   #--------------------------------------------------------------------------
  1732.   # * Call Increase Handler
  1733.   #--------------------------------------------------------------------------
  1734.   def call_increase_handler
  1735.     call_handler(:increase)
  1736.   end
  1737.   #--------------------------------------------------------------------------
  1738.   # * Call Decrease Handler
  1739.   #--------------------------------------------------------------------------
  1740.   def call_decrease_handler
  1741.     call_handler(:decrease)
  1742.   end
  1743.   #--------------------------------------------------------------------------
  1744.   # * Call Level UP Handler
  1745.   #--------------------------------------------------------------------------
  1746.   def call_level_up_handler
  1747.     call_handler(:ok)
  1748.   end
  1749.   #--------------------------------------------------------------------------
  1750.   # * Processing When Increase Button Is Pressed
  1751.   #--------------------------------------------------------------------------
  1752.   def process_increase
  1753.     Sound.play_buzzer if call_increase_handler == false
  1754.   end
  1755.   #--------------------------------------------------------------------------
  1756.   # * Processing When Decrease Button Is Pressed
  1757.   #--------------------------------------------------------------------------
  1758.   def process_decrease
  1759.     Sound.play_buzzer if call_decrease_handler == false
  1760.   end
  1761.   #--------------------------------------------------------------------------
  1762.   # * Processing When OK Button Is Pressed
  1763.   #--------------------------------------------------------------------------
  1764.   def process_ok
  1765.     if call_level_up_handler
  1766.       Sound.play_ok
  1767.     else
  1768.       Sound.play_buzzer
  1769.     end
  1770.   end
  1771. end
  1772. #==============================================================================
  1773. # ** Window_Equip_Stat
  1774. #------------------------------------------------------------------------------
  1775. #  This window displays choices when opting to change equipment on the
  1776. # equipment screen.
  1777. #==============================================================================
  1778.  
  1779. class Window_Equip_Stat < Window_Base
  1780.   def initialize(x, y, width, height)
  1781.     super
  1782.     @equipment_stat = 0
  1783.     draw_icon(STR_ICON, 0, 0, true, true) # Strength Icon
  1784.     draw_icon(DEX_ICON, 100, 0, true, true) # Dexterity Icon
  1785.     draw_icon(INT_ICON, 200, 0, true, true)  # Intelligent Icon
  1786.     draw_icon(FTH_ICON, 300, 0, true, true)  # Faith Icon
  1787.     draw_icon(DURABILITY_ICON, 400, 0, true, true)  # Durability Icon
  1788.   end
  1789.   #--------------------------------------------------------------------------
  1790.   # * Draw Equipment Stat
  1791.   #--------------------------------------------------------------------------
  1792.   def draw_equipment_stat(stat_name, stat, slot_id)
  1793.     change_color(knockout_color)
  1794.     change_color(tp_gauge_color1) if stat_compatible?(stat_name, stat, slot_id)
  1795.     draw_text(0, 0, 70, line_height, @equipment_stat.to_s, 2) if stat_name.to_s == "str"
  1796.     draw_text(100, 0, 70, line_height, @equipment_stat.to_s, 2) if stat_name.to_s == "dex"
  1797.     draw_text(200, 0, 70, line_height, @equipment_stat.to_s, 2) if stat_name.to_s == "int"
  1798.     draw_text(300, 0, 70, line_height, @equipment_stat.to_s, 2) if stat_name.to_s == "fth"
  1799.   end
  1800.   #--------------------------------------------------------------------------
  1801.   # * Draw Equipment Durability
  1802.   #--------------------------------------------------------------------------
  1803.   def draw_equipment_durability(equipment)
  1804.     change_color(tp_gauge_color1)
  1805.     change_color(knockout_color) if equipment.get_durability <= 0
  1806.     draw_text(400, 0, 70, line_height, equipment.get_durability.to_s, 2)
  1807.   end
  1808.   #--------------------------------------------------------------------------
  1809.   # * Clear Previous Stat
  1810.   #--------------------------------------------------------------------------
  1811.   def clear_previous_stat
  1812.     contents.clear_rect(30, 0,  50, line_height)
  1813.     contents.clear_rect(130, 0, 50, line_height)
  1814.     contents.clear_rect(230, 0, 50, line_height)
  1815.     contents.clear_rect(330, 0, 50, line_height)
  1816.     contents.clear_rect(430, 0, 50, line_height)
  1817.   end
  1818.   #--------------------------------------------------------------------------
  1819.   # * Show Weapon Neaded Stat
  1820.   #--------------------------------------------------------------------------
  1821.   def show_weapon_stat(equipment, slot_id)
  1822.     clear_previous_stat
  1823.     if equipment != nil && equipment.note != ""
  1824.       if equipment.note =~ /<(\w+):\s(\d+)>/
  1825.         draw_equipment_stat($1, $2, slot_id)
  1826.         draw_equipment_durability(equipment)
  1827.       elsif equipment.note =~ /<(\w+):\s(\d+),\s(\w+):\s(\d+)>/
  1828.         draw_equipment_stat($1, $2, slot_id)
  1829.         draw_equipment_stat($3, $4, slot_id)
  1830.         draw_equipment_durability(equipment)
  1831.       elsif equipment.note =~  /<(\w+):\s(\d+),\s(\w+):\s(\d+),\s(\w+):\s(\d+)>/
  1832.         draw_equipment_stat($1, $2, slot_id)
  1833.         draw_equipment_stat($3, $4, slot_id)
  1834.         draw_equipment_stat($5, $6, slot_id)
  1835.         draw_equipment_durability(equipment)
  1836.       elsif equipment.note =~ /<(\w+):\s(\d+),\s(\w+):\s(\d+),\s(\w+):\s(\d+),\s(\w+):\s(\d+)>/
  1837.         draw_equipment_stat($1, $2, slot_id)
  1838.         draw_equipment_stat($3, $4, slot_id)
  1839.         draw_equipment_stat($5, $6, slot_id)
  1840.         draw_equipment_stat($7, $8, slot_id)
  1841.         draw_equipment_durability(equipment)
  1842.       else
  1843.         draw_equipment_durability(equipment) # for accessory
  1844.       end
  1845.     end
  1846.   end
  1847.   #--------------------------------------------------------------------------
  1848.   # * Check Weapon Stats Compatibility
  1849.   #--------------------------------------------------------------------------
  1850.   def stat_compatible?(stat_name, stat, slot_id)
  1851.     if slot_id == 1 && (stat_name.to_s == "str" || stat_name.to_s == "dex")
  1852.       @equipment_stat = (stat.to_i * 1.5).ceil
  1853.       @equipment_stat = 99 if @equipment_stat > 99
  1854.       return @actor.dk_actor_stat[stat_name.to_sym] >= @equipment_stat
  1855.     else
  1856.       @equipment_stat = stat.to_i
  1857.       return @actor.dk_actor_stat[stat_name.to_sym] >= @equipment_stat
  1858.     end
  1859.   end
  1860.   #--------------------------------------------------------------------------
  1861.   # * Set Actor
  1862.   #--------------------------------------------------------------------------
  1863.   def actor=(actor)
  1864.     return if @actor == actor
  1865.     @actor = actor
  1866.   end
  1867. end
  1868.  
  1869. #==============================================================================
  1870. # ** Window_EquipItem
  1871. #------------------------------------------------------------------------------
  1872. #  This window displays choices when opting to change equipment on the
  1873. # equipment screen.
  1874. #==============================================================================
  1875.  
  1876. class Window_EquipItem < Window_ItemList
  1877.   #--------------------------------------------------------------------------
  1878.   # * New Method: Set Stat Window
  1879.   #--------------------------------------------------------------------------
  1880.   def stat_window=(stat_wind)
  1881.     @stat_window = stat_wind
  1882.     call_update_help
  1883.   end
  1884.   #--------------------------------------------------------------------------
  1885.   # * Update Help Text
  1886.   #--------------------------------------------------------------------------
  1887.   def update_help
  1888.     super
  1889.     if @actor && @status_window && @stat_window
  1890.       temp_actor = Marshal.load(Marshal.dump(@actor))
  1891.       temp_actor.force_change_equip(@slot_id, item)
  1892.       @status_window.set_temp_actor(temp_actor)
  1893.       @stat_window.show_weapon_stat(item, @slot_id) # To Show Weapon Stat Needed
  1894.     end
  1895.   end
  1896. end
  1897.  
  1898. #==============================================================================
  1899. # ** Window_EquipSlot
  1900. #------------------------------------------------------------------------------
  1901. #  This window displays items the actor is currently equipped with on the
  1902. # equipment screen.
  1903. #==============================================================================
  1904.  
  1905. class Window_EquipSlot < Window_Selectable
  1906.   #--------------------------------------------------------------------------
  1907.   # * Get Number of Lines to Show
  1908.   #--------------------------------------------------------------------------
  1909.   def visible_line_number
  1910.     return 7 # To Show All Slots
  1911.   end
  1912.   #--------------------------------------------------------------------------
  1913.   # * New Method: Show Selected Slot
  1914.   #--------------------------------------------------------------------------
  1915.   def show_slot
  1916.     return index
  1917.   end
  1918. end
  1919.  
  1920. #==============================================================================
  1921. # ** Window_Equip_Skill_Status
  1922. #------------------------------------------------------------------------------
  1923. #  This window displays full status specs on the status screen.
  1924. #==============================================================================
  1925.  
  1926. class Window_Equip_Skill_Status < Window_Selectable
  1927.   #--------------------------------------------------------------------------
  1928.   # * Object Initialization
  1929.   #--------------------------------------------------------------------------
  1930.   def initialize(actor, y, height)
  1931.     super(0, y, Graphics.width, height)
  1932.     @actor = actor
  1933.     refresh
  1934.     activate
  1935.   end
  1936.   #--------------------------------------------------------------------------
  1937.   # * Set Actor
  1938.   #--------------------------------------------------------------------------
  1939.   def actor=(actor)
  1940.     return if @actor == actor
  1941.     @actor = actor
  1942.     refresh
  1943.   end
  1944.   #--------------------------------------------------------------------------
  1945.   # * Refresh
  1946.   #--------------------------------------------------------------------------
  1947.   def refresh
  1948.     contents.clear
  1949.     draw_block   (0)
  1950.   end
  1951.   #--------------------------------------------------------------------------
  1952.   # * Draw Block
  1953.   #--------------------------------------------------------------------------
  1954.   def draw_block(y)
  1955.     draw_actor_face(@actor, 8, y + line_height)
  1956.     draw_actor_name(@actor, 4, y)
  1957.     draw_basic_info(136, y)
  1958.     draw_actor_memory_slot(304, y)
  1959.   end
  1960.   #--------------------------------------------------------------------------
  1961.   # * Draw Actor Memory Slot
  1962.   #--------------------------------------------------------------------------
  1963.   def draw_actor_memory_slot(x, y)
  1964.     draw_text_ex(x, y + line_height * 2, "Memory Slot = " + (@actor.get_number_of_slot - @actor.get_used_memory_slot).to_s)
  1965.   end
  1966.   #--------------------------------------------------------------------------
  1967.   # * Draw Basic Information
  1968.   #--------------------------------------------------------------------------
  1969.   def draw_basic_info(x, y)
  1970.     draw_actor_level(@actor, x, y + line_height * 0)
  1971.     draw_actor_icons(@actor, x, y + line_height * 1)
  1972.     draw_actor_hp(@actor, x, y + line_height * 2)
  1973.     draw_actor_mp(@actor, x, y + line_height * 3)
  1974.   end
  1975. end
  1976.  
  1977. #==============================================================================
  1978. # ** Window_SkillList
  1979. #------------------------------------------------------------------------------
  1980. #  This window is for displaying a list of available skills on the skill window.
  1981. #==============================================================================
  1982.  
  1983. class Window_Equip_SkillList < Window_ItemList
  1984.   #--------------------------------------------------------------------------
  1985.   # * Object Initialization
  1986.   #--------------------------------------------------------------------------
  1987.   def initialize(x, y, width, height)
  1988.     super
  1989.     @actor = nil
  1990.   end
  1991.   #--------------------------------------------------------------------------
  1992.   # * Set Actor
  1993.   #--------------------------------------------------------------------------
  1994.   def actor=(actor)
  1995.     return if @actor == actor
  1996.     @actor = actor
  1997.     refresh
  1998.     self.oy = 0
  1999.   end
  2000.   #--------------------------------------------------------------------------
  2001.   # * Include in Item List?
  2002.   #--------------------------------------------------------------------------
  2003.   def include?(item)
  2004.     return true if item == nil
  2005.     return true if item.is_a?(RPG::Item) && item.key_item? && item.is_skill?
  2006.     return false
  2007.   end
  2008.   #--------------------------------------------------------------------------
  2009.   # * Display in Enabled State?
  2010.   #--------------------------------------------------------------------------
  2011.   def enable?(item)
  2012.     return true
  2013.   end
  2014.   #--------------------------------------------------------------------------
  2015.   # * Create Item List
  2016.   #--------------------------------------------------------------------------
  2017.   def make_item_list
  2018.     @data = $game_party.items.select {|item| include?(item) }
  2019.     @data.push(nil) if include?(nil)
  2020.   end
  2021.   #--------------------------------------------------------------------------
  2022.   # * Draw Item
  2023.   #--------------------------------------------------------------------------
  2024.   def draw_item(index)
  2025.     item = @data[index]
  2026.     if item
  2027.       rect = item_rect(index)
  2028.       rect.width -= 4
  2029.       draw_item_name(item, rect.x, rect.y, enable?(item))
  2030.       draw_item_condition(rect, item)
  2031.     end
  2032.   end
  2033.   #--------------------------------------------------------------------------
  2034.   # * Draw Number of Items
  2035.   #--------------------------------------------------------------------------
  2036.   def draw_item_condition(rect, item)
  2037.    
  2038.     if @actor.is_learned?(item.get_skill_id)
  2039.       draw_text(rect, "L", 2)
  2040.     else
  2041.       draw_text(rect, "NL", 2)
  2042.     end
  2043.   end
  2044.   #--------------------------------------------------------------------------
  2045.   # * New Method: Set Stat Window
  2046.   #--------------------------------------------------------------------------
  2047.   def stat_window=(stat_wind)
  2048.     @stat_window = stat_wind
  2049.     call_update_help
  2050.   end
  2051.   #--------------------------------------------------------------------------
  2052.   # * Update Help Text
  2053.   #--------------------------------------------------------------------------
  2054.   def update_help
  2055.     super
  2056.     if @actor && @stat_window
  2057.       @stat_window.show_skill_stat($data_skills[item.skill_id]) if item  # To Show Skill Stat Needed
  2058.     end
  2059.   end
  2060. end
  2061.  
  2062. #==============================================================================
  2063. # ** Window_Skill_Stat
  2064. #------------------------------------------------------------------------------
  2065. #  This window displays Stats Needed for Skill To be Learned
  2066. #==============================================================================
  2067.  
  2068. class Window_Skill_Stat < Window_Base
  2069.   def initialize(x, y, width, height)
  2070.     super
  2071.     @skill_stat = 0    
  2072.     draw_icon(STR_ICON, 0, 0, true, true) # Strength Icon
  2073.     draw_icon(DEX_ICON, 100, 0, true, true) # Dexterity Icon
  2074.     draw_icon(INT_ICON, 200, 0, true, true)  # Intelligent Icon
  2075.     draw_icon(FTH_ICON, 300, 0, true, true)  # Faith Icon
  2076.     draw_icon(MS_ICON, 400, 0, true, true)  # Memory Slot Icon    
  2077.   end
  2078.   #--------------------------------------------------------------------------
  2079.   # * Draw Skill Stat
  2080.   #--------------------------------------------------------------------------
  2081.   def draw_skill_stat(stat_name, stat)
  2082.     change_color(knockout_color)
  2083.     change_color(tp_gauge_color1) if stat_compatible?(stat_name, stat)
  2084.     draw_text(0, 0, 70, line_height, @skill_stat.to_s, 2) if stat_name.to_s == "str"
  2085.     draw_text(100, 0, 70, line_height, @skill_stat.to_s, 2) if stat_name.to_s == "dex"
  2086.     draw_text(200, 0, 70, line_height, @skill_stat.to_s, 2) if stat_name.to_s == "int"
  2087.     draw_text(300, 0, 70, line_height, @skill_stat.to_s, 2) if stat_name.to_s == "fth"
  2088.   end
  2089.   #--------------------------------------------------------------------------
  2090.   # * Clear Previous Stat
  2091.   #--------------------------------------------------------------------------
  2092.   def clear_previous_stat
  2093.     contents.clear_rect(30,  0, 50, line_height)
  2094.     contents.clear_rect(130, 0, 50, line_height)
  2095.     contents.clear_rect(230, 0, 50, line_height)
  2096.     contents.clear_rect(330, 0, 50, line_height)
  2097.     contents.clear_rect(430, 0, 100, line_height)
  2098.   end
  2099.   #--------------------------------------------------------------------------
  2100.   # * Draw Skill Memory Slot Required
  2101.   #--------------------------------------------------------------------------
  2102.   def draw_skill_slot_required(skill)
  2103.     change_color(knockout_color)
  2104.     change_color(tp_gauge_color1) if @actor.memory_slot >= skill.get_memory_slot_required
  2105.     draw_text(400, 0, 70, line_height, skill.get_memory_slot_required, 2)
  2106.   end
  2107.   #--------------------------------------------------------------------------
  2108.   # * Show Skill Neaded Stat
  2109.   #--------------------------------------------------------------------------
  2110.   def show_skill_stat(skill)
  2111.     clear_previous_stat
  2112.     if skill != nil && skill.note != ""
  2113.       if skill.note =~ /<(\w+):\s(\d+)>/
  2114.         draw_skill_stat($1, $2)
  2115.         draw_skill_slot_required(skill)
  2116.       elsif skill.note =~ /<(\w+):\s(\d+),\s(\w+):\s(\d+)>/
  2117.         draw_skill_stat($1, $2)
  2118.         draw_skill_stat($3, $4)
  2119.         draw_skill_slot_required(skill)
  2120.       elsif skill.note =~  /<(\w+):\s(\d+),\s(\w+):\s(\d+),\s(\w+):\s(\d+)>/
  2121.         draw_skill_stat($1, $2)
  2122.         draw_skill_stat($3, $4)
  2123.         draw_skill_stat($5, $6)
  2124.         draw_skill_slot_required(skill)
  2125.       elsif skill.note =~ /<(\w+):\s(\d+),\s(\w+):\s(\d+),\s(\w+):\s(\d+),\s(\w+):\s(\d+)>/
  2126.         draw_skill_stat($1, $2)
  2127.         draw_skill_stat($3, $4)
  2128.         draw_skill_stat($5, $6)
  2129.         draw_skill_stat($7, $8)
  2130.         draw_skill_slot_required(skill)
  2131.       end
  2132.     end
  2133.   end
  2134.   #--------------------------------------------------------------------------
  2135.   # * Check Skill Stats Compatibility
  2136.   #--------------------------------------------------------------------------
  2137.   def stat_compatible?(stat_name, stat)
  2138.     @skill_stat = stat.to_i
  2139.     return @actor.dk_actor_stat[stat_name.to_sym] >= @skill_stat
  2140.   end
  2141.   #--------------------------------------------------------------------------
  2142.   # * Set Actor
  2143.   #--------------------------------------------------------------------------
  2144.   def actor=(actor)
  2145.     return if @actor == actor
  2146.     @actor = actor
  2147.   end
  2148. end
  2149.  
  2150. #==============================================================================
  2151. # ** Window_BlackSmith_Command
  2152. #------------------------------------------------------------------------------
  2153. #  This window is for selecting buy/sell on the shop screen.
  2154. #==============================================================================
  2155.  
  2156. class Window_blacksmith_Command < Window_HorzCommand
  2157.   #--------------------------------------------------------------------------
  2158.   # * Object Initialization
  2159.   #--------------------------------------------------------------------------
  2160.   def initialize(window_width)
  2161.     @window_width = window_width
  2162.     super(0, 0)
  2163.   end
  2164.   #--------------------------------------------------------------------------
  2165.   # * Get Window Width
  2166.   #--------------------------------------------------------------------------
  2167.   def window_width
  2168.     @window_width
  2169.   end
  2170.   #--------------------------------------------------------------------------
  2171.   # * Get Digit Count
  2172.   #--------------------------------------------------------------------------
  2173.   def col_max
  2174.     return 3
  2175.   end
  2176.   #--------------------------------------------------------------------------
  2177.   # * Create Command List
  2178.   #--------------------------------------------------------------------------
  2179.   def make_command_list
  2180.     add_command("Upgrade",    :upgrade)
  2181.     add_command("Infuse",     :infuse)
  2182.     add_command("Repair",     :repair)
  2183.   end
  2184. end
  2185.  
  2186. #==============================================================================
  2187. # ** Window_Blacksmith_ItemCategory
  2188. #------------------------------------------------------------------------------
  2189. #  This window is for selecting a category of equipment
  2190. # on the Blacksmith screen.
  2191. #==============================================================================
  2192.  
  2193. class Window_Blacksmith_ItemCategory < Window_ItemCategory
  2194.   #--------------------------------------------------------------------------
  2195.   # * Create Command List
  2196.   #--------------------------------------------------------------------------
  2197.   def make_command_list
  2198.     add_command(Vocab::weapon,   :weapon)
  2199.     add_command(Vocab::armor,    :armor)
  2200.   end
  2201.   #--------------------------------------------------------------------------
  2202.   # * Get Digit Count
  2203.   #--------------------------------------------------------------------------
  2204.   def col_max
  2205.     return 2
  2206.   end
  2207. end
  2208.  
  2209. #==============================================================================
  2210. # ** Window_Upgrade_Status
  2211. #------------------------------------------------------------------------------
  2212. #  This window displays the actor's equipment on the Blacksmith After Update.
  2213. #==============================================================================
  2214.  
  2215. class Window_Upgrade_Status < Window_Base
  2216.   #--------------------------------------------------------------------------
  2217.   # * Object Initialization
  2218.   #--------------------------------------------------------------------------
  2219.   def initialize(x, y, width, height)
  2220.     super(x, y, width, height)
  2221.     @item = nil
  2222.     @page_index = 0
  2223.     refresh
  2224.   end
  2225.   #--------------------------------------------------------------------------
  2226.   # * Refresh
  2227.   #--------------------------------------------------------------------------
  2228.   def refresh
  2229.     contents.clear
  2230.     draw_equip_info(4, line_height * 2) if @item.is_a?(RPG::EquipItem)
  2231.   end
  2232.   #--------------------------------------------------------------------------
  2233.   # * Set Item
  2234.   #--------------------------------------------------------------------------
  2235.   def item=(item)
  2236.     @item = item
  2237.     refresh
  2238.   end
  2239.   #--------------------------------------------------------------------------
  2240.   # * Draw Equipment Information
  2241.   #--------------------------------------------------------------------------
  2242.   def draw_equip_info(x, y)
  2243.     status_members.each_with_index do |actor, i|
  2244.       draw_actor_equip_info(x, y + line_height * (i * 2.4), actor)
  2245.     end
  2246.   end
  2247.   #--------------------------------------------------------------------------
  2248.   # * Array of Actors for Which to Draw Equipment Information
  2249.   #--------------------------------------------------------------------------
  2250.   def status_members
  2251.     $game_party.members[@page_index * page_size, page_size]
  2252.   end
  2253.   #--------------------------------------------------------------------------
  2254.   # * Number of Actors Displayable at Once
  2255.   #--------------------------------------------------------------------------
  2256.   def page_size
  2257.     return 4
  2258.   end
  2259.   #--------------------------------------------------------------------------
  2260.   # * Get Maximum Number of Pages
  2261.   #--------------------------------------------------------------------------
  2262.   def page_max
  2263.     ($game_party.members.size + page_size - 1) / page_size
  2264.   end
  2265.   #--------------------------------------------------------------------------
  2266.   # * Draw Actor Equipment Information
  2267.   #--------------------------------------------------------------------------
  2268.   def draw_actor_equip_info(x, y, actor)
  2269.     enabled = actor.equippable?(@item)
  2270.     change_color(normal_color, enabled)
  2271.     draw_text(x, y, 112, line_height, actor.name)
  2272.     item1 = current_equipped_item(actor, @item.etype_id)
  2273.     draw_actor_param_change(x, y, actor, item1) if enabled
  2274.     draw_item_name(item1, x, y + line_height, enabled)
  2275.   end
  2276.   #--------------------------------------------------------------------------
  2277.   # * Draw Actor Parameter Change
  2278.   #--------------------------------------------------------------------------
  2279.   def draw_actor_param_change(x, y, actor, item1)
  2280.     rect = Rect.new(x, y, contents.width - 4 - x, line_height)
  2281.     change = @item.fake_upgrade(param_id) - (item1 ? item1.params[param_id] : 0)
  2282.     change_color(param_change_color(change))
  2283.     draw_text(rect, sprintf("%+d", change), 2)
  2284.   end
  2285.   #--------------------------------------------------------------------------
  2286.   # * Get Parameter ID Corresponding to Selected Item
  2287.   #    By default, ATK if weapon and DEF if armor.
  2288.   #--------------------------------------------------------------------------
  2289.   def param_id
  2290.     @item.is_a?(RPG::Weapon) ? 2 : 3
  2291.   end
  2292.   #--------------------------------------------------------------------------
  2293.   # * Get Current Equipment
  2294.   #    Returns the weaker equipment if there is more than one of the same type,
  2295.   #    such as with dual wield.
  2296.   #--------------------------------------------------------------------------
  2297.   def current_equipped_item(actor, etype_id)
  2298.     list = []
  2299.     actor.equip_slots.each_with_index do |slot_etype_id, i|
  2300.       list.push(actor.equips[i]) if slot_etype_id == etype_id
  2301.     end
  2302.     list.max_by {|item| item ? item.params[param_id] : 0}
  2303.   end
  2304.   #--------------------------------------------------------------------------
  2305.   # * Frame Update
  2306.   #--------------------------------------------------------------------------
  2307.   def update
  2308.     super
  2309.     update_page
  2310.   end
  2311.   #--------------------------------------------------------------------------
  2312.   # * Update Page
  2313.   #--------------------------------------------------------------------------
  2314.   def update_page
  2315.     if visible && Input.trigger?(:A) && page_max > 1
  2316.       @page_index = (@page_index + 1) % page_max
  2317.       refresh
  2318.     end
  2319.   end
  2320. end
  2321.  
  2322. #==============================================================================
  2323. # ** Window_Blacksmith_Upgrade
  2324. #------------------------------------------------------------------------------
  2325. #  This window displays a list of Equipment in possession for repair on the
  2326. #   Blacksmith screen.
  2327. #==============================================================================
  2328.  
  2329. class Window_Blacksmith_Upgrade < Window_ItemList
  2330.   attr_reader   :status_window            # Status window
  2331.   #--------------------------------------------------------------------------
  2332.   # * Object Initialization
  2333.   #--------------------------------------------------------------------------
  2334.   def initialize(x, y, height)
  2335.     super(x, y, window_width, height)
  2336.   end
  2337.   #--------------------------------------------------------------------------
  2338.   # * Get Window Width
  2339.   #--------------------------------------------------------------------------
  2340.   def window_width
  2341.     return 304
  2342.   end
  2343.   #--------------------------------------------------------------------------
  2344.   # * Get Digit Count
  2345.   #--------------------------------------------------------------------------
  2346.   def col_max
  2347.     return 1
  2348.   end
  2349.   #--------------------------------------------------------------------------
  2350.   # * Get Activation State of Selection Item
  2351.   #--------------------------------------------------------------------------
  2352.   def current_item_enabled?
  2353.     enable?(@data[index])
  2354.   end
  2355.   #--------------------------------------------------------------------------
  2356.   # * Display in Enabled State?
  2357.   #--------------------------------------------------------------------------
  2358.   def enable?(item)
  2359.     item && calculate_upgrade_cost(item) <= $game_party.gold
  2360.   end
  2361.   #--------------------------------------------------------------------------
  2362.   # * Draw Reapir Cost of Items
  2363.   #--------------------------------------------------------------------------
  2364.   def draw_item_upgrade_cost(rect, item)
  2365.     draw_text(rect, calculate_upgrade_cost(item), 2)
  2366.   end
  2367.   #--------------------------------------------------------------------------
  2368.   # * New Methof: Calculate Repair Cost
  2369.   #--------------------------------------------------------------------------
  2370.   def calculate_upgrade_cost(item)
  2371.     return ((1 + item.equip_lv) * 0.1 * item.price).to_i
  2372.   end
  2373.   #--------------------------------------------------------------------------
  2374.   # * Draw Item
  2375.   #--------------------------------------------------------------------------
  2376.   def draw_item(index)
  2377.     item = @data[index]
  2378.     if item
  2379.       rect = item_rect(index)
  2380.       rect.width -= 4
  2381.       draw_item_name(item, rect.x, rect.y, enable?(item))
  2382.       draw_item_upgrade_cost(rect, item)
  2383.     end
  2384.   end
  2385.   #--------------------------------------------------------------------------
  2386.   # * Draw Item Name
  2387.   #     enabled : Enabled flag. When false, draw semi-transparently.
  2388.   #--------------------------------------------------------------------------
  2389.   def draw_item_name(item, x, y, enabled = true, width = 172)
  2390.     return unless item
  2391.     contents.font.size = 15
  2392.     contents.font.bold = true
  2393.     change_color(normal_color, enabled)
  2394.     draw_text(x + 2, y, 15, 15, "E") unless $game_party.has_item?(item)
  2395.     contents.font.size = Font.default_size
  2396.     contents.font.bold = Font.default_bold
  2397.     draw_icon(item.icon_index, x + 10, y, enabled)
  2398.     change_color(normal_color, enabled)
  2399.     draw_text(x + 34, y, width, line_height, item.name)
  2400.   end
  2401.   #--------------------------------------------------------------------------
  2402.   # * Create Item List
  2403.   #--------------------------------------------------------------------------
  2404.   def make_item_list
  2405.     @data = $game_party.equip_items.select {|item| include?(item) if (item.get_equip_lv < 10) }
  2406.     $game_party.members.each do |actor|
  2407.       actor.equips.each do |equipment|
  2408.         @data.push(equipment) if include?(equipment) && equipment.get_equip_lv < 10
  2409.       end
  2410.     end
  2411.     @data.push(nil) if include?(nil)
  2412.   end
  2413.   #--------------------------------------------------------------------------
  2414.   # * Set Status Window
  2415.   #--------------------------------------------------------------------------
  2416.   def status_window=(status_window)
  2417.     @status_window = status_window
  2418.     call_update_help
  2419.   end
  2420.   #--------------------------------------------------------------------------
  2421.   # * Update Help Text
  2422.   #--------------------------------------------------------------------------
  2423.   def update_help
  2424.     @help_window.set_item(item) if @help_window
  2425.     @status_window.item = item if @status_window
  2426.   end
  2427. end
  2428.  
  2429. #==============================================================================
  2430. # ** Window_Blacksmith_Repair
  2431. #------------------------------------------------------------------------------
  2432. #  This window displays a list of Equipment in possession for repair on the
  2433. #   Blacksmith screen.
  2434. #==============================================================================
  2435.  
  2436. class Window_Blacksmith_Repair < Window_ItemList
  2437.   #--------------------------------------------------------------------------
  2438.   # * Object Initialization
  2439.   #--------------------------------------------------------------------------
  2440.   def initialize(x, y, width, height)
  2441.     super(x, y, width, height)
  2442.   end
  2443.   #--------------------------------------------------------------------------
  2444.   # * Get Activation State of Selection Item
  2445.   #--------------------------------------------------------------------------
  2446.   def current_item_enabled?
  2447.     enable?(@data[index])
  2448.   end
  2449.   #--------------------------------------------------------------------------
  2450.   # * Display in Enabled State?
  2451.   #--------------------------------------------------------------------------
  2452.   def enable?(item)
  2453.     item && calculate_repair_cost(item) <= $game_party.gold
  2454.   end
  2455.   #--------------------------------------------------------------------------
  2456.   # * Draw Reapir Cost of Items
  2457.   #--------------------------------------------------------------------------
  2458.   def draw_item_repair_cost(rect, item)
  2459.     draw_text(rect, calculate_repair_cost(item), 2)
  2460.   end
  2461.   #--------------------------------------------------------------------------
  2462.   # * New Methof: Calculate Repair Cost
  2463.   #--------------------------------------------------------------------------
  2464.   def calculate_repair_cost(item)
  2465.     return ((1.0 - (item.get_durability.to_f / item.get_original_durability.to_f)) * 0.75 * item.price).to_i
  2466.   end
  2467.   #--------------------------------------------------------------------------
  2468.   # * Draw Item
  2469.   #--------------------------------------------------------------------------
  2470.   def draw_item(index)
  2471.     item = @data[index]
  2472.     if item
  2473.       rect = item_rect(index)
  2474.       rect.width -= 4
  2475.       draw_item_name(item, rect.x, rect.y, enable?(item))
  2476.       draw_item_repair_cost(rect, item)
  2477.     end
  2478.   end
  2479.   #--------------------------------------------------------------------------
  2480.   # * Draw Item Name
  2481.   #     enabled : Enabled flag. When false, draw semi-transparently.
  2482.   #--------------------------------------------------------------------------
  2483.   def draw_item_name(item, x, y, enabled = true, width = 172)
  2484.     return unless item
  2485.     contents.font.size = 15
  2486.     contents.font.bold = true
  2487.     change_color(normal_color, enabled)
  2488.     draw_text(x + 2, y, 15, 15, "E") unless $game_party.has_item?(item)
  2489.     contents.font.size = Font.default_size
  2490.     contents.font.bold = Font.default_bold
  2491.     draw_icon(item.icon_index, x + 10, y, enabled)
  2492.     change_color(normal_color, enabled)
  2493.     draw_text(x + 34, y, width, line_height, item.name)
  2494.   end
  2495.   #--------------------------------------------------------------------------
  2496.   # * Create Item List
  2497.   #--------------------------------------------------------------------------
  2498.   def make_item_list
  2499.     @data = $game_party.equip_items.select {|item| include?(item) if (item.get_original_durability > item.get_durability) }
  2500.     $game_party.members.each do |actor|
  2501.       actor.equips.each do |equipment|
  2502.         @data.push(equipment) if include?(equipment) && (equipment.get_original_durability > equipment.get_durability)
  2503.       end
  2504.     end
  2505.     @data.push(nil) if include?(nil)
  2506.   end
  2507. end
  2508.  
  2509. #==============================================================================
  2510. # ** Window_Blacksmith_Infuse
  2511. #------------------------------------------------------------------------------
  2512. #  This window displays a list of Equipment in possession for Infuse on the
  2513. #   Blacksmith screen.
  2514. #==============================================================================
  2515.  
  2516. class Window_Blacksmith_Infuse < Window_ItemList
  2517.   include GGSlayer::Dark_Souls_System
  2518.   #--------------------------------------------------------------------------
  2519.   # * Object Initialization
  2520.   #--------------------------------------------------------------------------
  2521.   def initialize(x, y, width, height)
  2522.     super(x, y, width, height)
  2523.   end
  2524.   #--------------------------------------------------------------------------
  2525.   # * Get Activation State of Selection Item
  2526.   #--------------------------------------------------------------------------
  2527.   def current_item_enabled?
  2528.     enable?(@data[index])
  2529.   end
  2530.   #--------------------------------------------------------------------------
  2531.   # * Display in Enabled State?
  2532.   #--------------------------------------------------------------------------
  2533.   def enable?(item)
  2534.     item && infuse_cost(item) <= $game_party.gold
  2535.   end
  2536.   #--------------------------------------------------------------------------
  2537.   # * Draw Infuse Cost
  2538.   #--------------------------------------------------------------------------
  2539.   def draw_infuse_cost(rect, item)
  2540.     draw_text(rect, infuse_cost(item), 2)
  2541.   end
  2542.   #--------------------------------------------------------------------------
  2543.   # * New Methof: Calculate Repair Cost
  2544.   #--------------------------------------------------------------------------
  2545.   def infuse_cost(item)
  2546.     return INFUSE_COST
  2547.   end
  2548.   #--------------------------------------------------------------------------
  2549.   # * Draw Item Name
  2550.   #     enabled : Enabled flag. When false, draw semi-transparently.
  2551.   #--------------------------------------------------------------------------
  2552.   def draw_item_name(item, x, y, enabled = true, width = 172)
  2553.     return unless item
  2554.     contents.font.size = 15
  2555.     contents.font.bold = true
  2556.     change_color(normal_color, enabled)
  2557.     draw_text(x + 2, y, 15, 15, "E") unless $game_party.has_item?(item)
  2558.     contents.font.size = Font.default_size
  2559.     contents.font.bold = Font.default_bold
  2560.     draw_icon(item.icon_index, x + 10, y, enabled)
  2561.     change_color(normal_color, enabled)
  2562.     draw_text(x + 34, y, width, line_height, item.name)
  2563.   end
  2564.   #--------------------------------------------------------------------------
  2565.   # * Draw Item
  2566.   #--------------------------------------------------------------------------
  2567.   def draw_item(index)
  2568.     item = @data[index]
  2569.     if item
  2570.       rect = item_rect(index)
  2571.       rect.width -= 4
  2572.       draw_item_name(item, rect.x, rect.y, enable?(item))
  2573.       draw_infuse_cost(rect, item)
  2574.     end
  2575.   end
  2576.   #--------------------------------------------------------------------------
  2577.   # * Create Item List
  2578.   #--------------------------------------------------------------------------
  2579.   def make_item_list
  2580.     @data = $game_party.weapons.select {|item| include?(item)}
  2581.     $game_party.armors.select {|item| @data.push(item) if include?(item) && item.etype_id == 1}
  2582.    
  2583.     $game_party.members.each do |actor|
  2584.       slot_number = 0
  2585.       actor.equips.each do |equipment|
  2586.         @data.push(equipment) if include?(equipment) && slot_number < 3
  2587.         slot_number += 1
  2588.       end
  2589.     end
  2590.     @data.push(nil) if include?(nil)
  2591.   end
  2592. end
  2593.  
  2594. #==============================================================================
  2595. # ** Window_Element
  2596. #------------------------------------------------------------------------------
  2597. #  This window displays a list of Equipment in possession for Infuse on the
  2598. #   Blacksmith screen.
  2599. #==============================================================================
  2600.  
  2601. class Window_Element < Window_Command
  2602.   include GGSlayer::Dark_Souls_System
  2603.   #--------------------------------------------------------------------------
  2604.   # * Object Initialization
  2605.   #--------------------------------------------------------------------------
  2606.   def initialize(x, y)
  2607.     super(x, y)
  2608.     element_pic
  2609.   end
  2610.   #--------------------------------------------------------------------------
  2611.   # * Get Window Width
  2612.   #--------------------------------------------------------------------------
  2613.   def window_width
  2614.     return 300
  2615.   end
  2616.   #--------------------------------------------------------------------------
  2617.   # * Get Window Height
  2618.   #--------------------------------------------------------------------------
  2619.   def window_height
  2620.     fitting_height(visible_line_number)
  2621.   end
  2622.   #--------------------------------------------------------------------------
  2623.   # * Get Number of Lines to Show
  2624.   #--------------------------------------------------------------------------
  2625.   def visible_line_number
  2626.     return 4
  2627.   end
  2628.   #--------------------------------------------------------------------------
  2629.   # * Get Digit Count
  2630.   #--------------------------------------------------------------------------
  2631.   def col_max
  2632.     return 5
  2633.   end
  2634.   #--------------------------------------------------------------------------
  2635.   # * Get Spacing for Items Arranged Side by Side
  2636.   #--------------------------------------------------------------------------
  2637.   def spacing
  2638.     return 0
  2639.   end
  2640.   #--------------------------------------------------------------------------
  2641.   # * Get Alignment
  2642.   #--------------------------------------------------------------------------
  2643.   def alignment
  2644.     return 1
  2645.   end
  2646.   #--------------------------------------------------------------------------
  2647.   # * Create Command List
  2648.   #--------------------------------------------------------------------------
  2649.   def make_command_list
  2650.     add_command("", :none)
  2651.     add_command("", :fire)
  2652.     add_command("", :ice)
  2653.     add_command("", :thunder)
  2654.     add_command("", :water)
  2655.     add_command("", :earth)
  2656.     add_command("", :wind)
  2657.     add_command("", :holy)
  2658.     add_command("", :dark)
  2659.   end
  2660.   #--------------------------------------------------------------------------
  2661.   # * Create Images for Element
  2662.   #--------------------------------------------------------------------------
  2663.   def element_pic
  2664.     pos_x = (item_width - 25) / 2
  2665.     pos_y = (item_width - 10)
  2666.     draw_icon(NO_ELEMENT_ICON, pos_x + item_width * 0, 5, true, true)
  2667.     draw_icon(FIRE_ELEMENT_ICON, pos_x + (item_width) * 1, 5, true, true)
  2668.     draw_icon(ICE_ELEMENT_ICON, pos_x + (item_width) * 2, 5, true, true)
  2669.     draw_icon(THUNDER_ELEMENT_ICON, pos_x + (item_width) * 3, 5, true, true)
  2670.     draw_icon(WATER_ELEMENT_ICON, pos_x + (item_width) * 4, 5, true, true)
  2671.     draw_icon(EARTH_ELEMENT_ICON, pos_x + (item_width) * 0, pos_y, true, true)
  2672.     draw_icon(WIND_ELEMENT_ICON, pos_x + (item_width) * 1, pos_y, true, true)
  2673.     draw_icon(HOLY_ELEMNT_ICON, pos_x + (item_width) * 2, pos_y, true, true)
  2674.     draw_icon(DARK_ELEMENT_ICON, pos_x + (item_width) * 3, pos_y, true, true)
  2675.   end
  2676.   #--------------------------------------------------------------------------
  2677.   # * Get Rectangle for Drawing Items
  2678.   #--------------------------------------------------------------------------
  2679.   def item_rect(index)
  2680.     rect = Rect.new
  2681.     rect.width = item_width
  2682.     rect.height = item_width - 15  
  2683.     rect.x = index % col_max * (item_width  + spacing)
  2684.     rect.y = index / col_max * (item_width - 15)
  2685.     rect
  2686.   end
  2687. end
  2688.  
  2689. #==============================================================================
  2690. # ** Window_SkillList
  2691. #------------------------------------------------------------------------------
  2692. #  This window is for displaying a list of available skills on the skill window.
  2693. #==============================================================================
  2694.  
  2695. class Window_SkillList < Window_Selectable
  2696.   attr_accessor     :actor
  2697.   #--------------------------------------------------------------------------
  2698.   # * Display Skill in Active State?
  2699.   #--------------------------------------------------------------------------
  2700.   def enable?(item)
  2701.     @actor && @actor.usable?(item) && item_attribute_active?(item)
  2702.   end
  2703.   #--------------------------------------------------------------------------
  2704.   # * New Method: Check Skill Attribute is Active
  2705.   #--------------------------------------------------------------------------
  2706.   def item_attribute_active?(item)
  2707.     return true if item.note =~ /Physical/ && @actor.physical_attribute
  2708.     return true if item.note =~ /Magical/ && @actor.magical_attribute
  2709.     return true if item.note =~ /Faith/ && @actor.faith_attribute
  2710.     return false
  2711.   end  
  2712. end
  2713. #==============================================================================
  2714. # ** Window_Status
  2715. #------------------------------------------------------------------------------
  2716. #  This window displays full status specs on the status screen.
  2717. #==============================================================================
  2718.  
  2719. class Window_Status < Window_Selectable
  2720.   #--------------------------------------------------------------------------
  2721.   # * Refresh
  2722.   #--------------------------------------------------------------------------
  2723.   def refresh
  2724.     contents.clear
  2725.     draw_block1   (line_height * 0)
  2726.     draw_horz_line(line_height * 1)
  2727.     draw_block2   (line_height * 2 - 15)
  2728.     draw_horz_line(line_height * 6 - 5)
  2729.     draw_block3   (line_height * 6 + 5)
  2730.     draw_horz_line(line_height * 13 + 15)
  2731.     draw_block4   (line_height * 14)
  2732.   end
  2733.   #--------------------------------------------------------------------------
  2734.   # * Draw Level
  2735.   #--------------------------------------------------------------------------
  2736.   def draw_actor_level(actor, x, y)
  2737.     change_color(system_color)
  2738.     draw_text(x, y, 32, line_height, Vocab::level_a)
  2739.     change_color(normal_color)
  2740.     draw_text(x + 32, y, 24, line_height, actor.get_dk_actor_level, 2)
  2741.   end
  2742.   #--------------------------------------------------------------------------
  2743.   # * Draw Block 3
  2744.   #--------------------------------------------------------------------------
  2745.   def draw_block3(y)
  2746.     draw_stats(32, y)
  2747.     draw_parameters(160, y)
  2748.     draw_equipments(320, y)
  2749.   end
  2750.   #--------------------------------------------------------------------------
  2751.   # * Draw Horizontal Line
  2752.   #--------------------------------------------------------------------------
  2753.   def draw_horz_line(y)
  2754.     contents.fill_rect(0, y, contents_width, 2, line_color)
  2755.   end
  2756.   #--------------------------------------------------------------------------
  2757.   # * Draw Experience Information
  2758.   #--------------------------------------------------------------------------
  2759.   def draw_exp_info(x, y)
  2760.     s1 = @actor.max_level? ? "-------" : @actor.get_dk_actor_exp
  2761.     s2 = @actor.max_level? ? "-------" : @actor.next_level_exp - @actor.exp_for_level(@actor.get_dk_actor_level)
  2762.     s_next = sprintf(Vocab::ExpNext, Vocab::level)
  2763.     change_color(system_color)
  2764.     draw_text(x, y + line_height * 0, 180, line_height, Vocab::ExpTotal)
  2765.     draw_text(x, y + line_height * 2, 180, line_height, s_next)
  2766.     change_color(normal_color)
  2767.     draw_text(x, y + line_height * 1, 180, line_height, s1, 2)
  2768.     draw_text(x, y + line_height * 3, 180, line_height, s2, 2)
  2769.   end
  2770.   #--------------------------------------------------------------------------
  2771.   # * Draw Parameters
  2772.   #--------------------------------------------------------------------------
  2773.   def draw_parameters(x, y)
  2774.     6.times {|i| draw_actor_param(@actor, x, y + line_height * i, i + 2) }
  2775.     draw_actor_memory_slot(@actor, x, y + line_height * 6)
  2776.   end
  2777.   #--------------------------------------------------------------------------
  2778.   # * Draw Parameters
  2779.   #--------------------------------------------------------------------------
  2780.   def draw_actor_param(actor, x, y, param_id)
  2781.     change_color(system_color)
  2782.     draw_text(x, y, 120, line_height, Vocab::param(param_id))
  2783.     change_color(normal_color)
  2784.     draw_text(x + 100, y, 36, line_height, actor.param(param_id), 1)
  2785.   end
  2786.   #--------------------------------------------------------------------------
  2787.   # * Draw Actor Memory Slot
  2788.   #--------------------------------------------------------------------------
  2789.   def draw_actor_memory_slot(actor, x, y)
  2790.     change_color(system_color)
  2791.     draw_text(x, y, 120, line_height, "ATN")
  2792.     change_color(normal_color)
  2793.     draw_text(x + 100, y, 36, line_height, actor.get_number_of_slot, 1)
  2794.   end
  2795.   #--------------------------------------------------------------------------
  2796.   # * Draw Stats
  2797.   #--------------------------------------------------------------------------
  2798.   def draw_stats(x, y)
  2799.     change_color(system_color)
  2800.     draw_icon(VIT_ICON, x, y, true, true)
  2801.     draw_icon(INT_ICON, x, y + line_height, true, true)
  2802.     draw_icon(FTH_ICON, x, y + line_height * 2, true, true)
  2803.     draw_icon(STR_ICON, x, y + line_height * 3, true, true)
  2804.     draw_icon(DEX_ICON, x, y + line_height * 4, true, true)
  2805.     draw_icon(LUK_ICON, x, y + line_height * 5, true, true)
  2806.     draw_icon(ATN_ICON, x, y + line_height * 6, true, true)
  2807.     change_color(normal_color)
  2808.     draw_text(x, y, 155, line_height, @actor.get_dk_actor_vit, 1)
  2809.     draw_text(x, y + line_height, 155, line_height, @actor.get_dk_actor_int, 1)
  2810.     draw_text(x, y + line_height * 2, 155, line_height, @actor.get_dk_actor_fth, 1)
  2811.     draw_text(x, y + line_height * 3, 155, line_height, @actor.get_dk_actor_str, 1)
  2812.     draw_text(x, y + line_height * 4, 155, line_height, @actor.get_dk_actor_dex, 1)
  2813.     draw_text(x, y + line_height * 5, 155, line_height, @actor.get_dk_actor_luck, 1)
  2814.     draw_text(x, y + line_height * 6, 155, line_height, @actor.get_dk_actor_atn, 1)
  2815.   end
  2816. end
  2817. #==============================================================================
  2818. # ** Scene_Menu
  2819. #------------------------------------------------------------------------------
  2820. #  This class performs the menu screen processing.
  2821. #==============================================================================
  2822. class Scene_Menu < Scene_MenuBase
  2823.   #--------------------------------------------------------------------------
  2824.   # * Start Processing
  2825.   #--------------------------------------------------------------------------
  2826.   alias ggslayer_dark_souls_stat_points_Scene_Menu_start   start
  2827.   def start
  2828.     ggslayer_dark_souls_stat_points_Scene_Menu_start()
  2829.     create_exp_window
  2830.   end
  2831.   #--------------------------------------------------------------------------
  2832.   # * New Method: Create Exp Window
  2833.   #--------------------------------------------------------------------------
  2834.   def create_exp_window
  2835.     @exp_window = Window_Exp.new
  2836.     @exp_window.x = 0
  2837.     @exp_window.y = Graphics.height - (2 * @exp_window.height)
  2838.   end
  2839. end
  2840.  
  2841. #==============================================================================
  2842. # ** Scene_Status_Point
  2843. #------------------------------------------------------------------------------
  2844. #  This class performs the Actor Status Point screen processing.
  2845. #==============================================================================
  2846. class Scene_Status_Point < Scene_MenuBase
  2847.   include GGSlayer::Dark_Souls_System
  2848.   #--------------------------------------------------------------------------
  2849.   # * Start Processing
  2850.   #--------------------------------------------------------------------------
  2851.   def start
  2852.     super
  2853.     @actor = get_actor($actor_name)
  2854.     @lv = 1
  2855.     @total_exp = @actor.get_dk_actor_exp
  2856.     @vit_called = 0
  2857.     @int_called = 0
  2858.     @fth_called = 0
  2859.     @str_called = 0
  2860.     @dex_called = 0
  2861.     @luck_called = 0
  2862.     @atn_called = 0
  2863.     @status_point_window = Window_Status_Point.new(@actor)
  2864.     @commands = Stat_Commands.new(28, 160, @actor)
  2865.     @commands.opacity = 0
  2866.     @status_point_window.set_handler(:cancel,   method(:return_scene))
  2867.     @status_point_window.set_handler(:pagedown, method(:next_actor))
  2868.     @status_point_window.set_handler(:pageup,   method(:prev_actor))
  2869.     @commands.set_handler(:increase,            method(:increase_state))
  2870.     @commands.set_handler(:decrease,            method(:decrease_state))
  2871.     @commands.set_handler(:ok,                  method(:level_up_character))
  2872.   end
  2873.   #--------------------------------------------------------------------------
  2874.   # * New Method: Get Actor
  2875.   #--------------------------------------------------------------------------
  2876.   def get_actor(name)
  2877.     $game_party.members.each  do  |actor|
  2878.       if actor.name == name
  2879.         return actor
  2880.       end
  2881.     end
  2882.   end
  2883.   #--------------------------------------------------------------------------
  2884.   # * New Method: Submit Actor Level UP Points
  2885.   #--------------------------------------------------------------------------
  2886.   def level_up_character
  2887.     if @lv > 1
  2888.       @actor.dk_level_up(@lv - 1)
  2889.       @actor.increase_dk_actor_exp(get_total_exp)
  2890.       if @vit_called > 0
  2891.         @actor.increase_dk_actor_vit(@vit_called)
  2892.         @actor.add_param(0, @vit_called * Parameter_Increase_Per_Stat[:mhp]) if @actor.mhp < 9999
  2893.         @actor.add_param(3, @vit_called * Parameter_Increase_Per_Stat[:def])
  2894.       end
  2895.       if @int_called > 0
  2896.         @actor.increase_dk_actor_int(@int_called)
  2897.         @actor.add_param(1, @int_called * Parameter_Increase_Per_Stat[:mmp])
  2898.         @actor.add_param(4, @int_called * Parameter_Increase_Per_Stat[:mat])
  2899.         @actor.add_param(5, @int_called * Parameter_Increase_Per_Stat[:mdf])
  2900.       end
  2901.       if @fth_called > 0
  2902.         @actor.increase_dk_actor_fth(@fth_called)
  2903.         @actor.add_param(1, @fth_called * Parameter_Increase_Per_Stat[:mmp])
  2904.         @actor.add_param(3, @fth_called * Parameter_Increase_Per_Stat[:def])
  2905.         @actor.add_param(5, @fth_called * Parameter_Increase_Per_Stat[:mdf])
  2906.       end
  2907.       if @str_called > 0
  2908.         @actor.increase_dk_actor_str(@str_called)
  2909.         @actor.add_param(2, @str_called * Parameter_Increase_Per_Stat[:att])
  2910.         @actor.add_param(3, @str_called * Parameter_Increase_Per_Stat[:def])
  2911.       end
  2912.       if @dex_called > 0
  2913.         @actor.increase_dk_actor_dex(@dex_called)
  2914.         @actor.add_param(2, @dex_called * Parameter_Increase_Per_Stat[:att])
  2915.         @actor.add_param(6, @dex_called * Parameter_Increase_Per_Stat[:agi])
  2916.       end
  2917.       if @luck_called > 0
  2918.         @actor.increase_dk_actor_luck(@luck_called)
  2919.         @actor.add_param(0, @luck_called * Parameter_Increase_Per_Stat[:mhp]) if @actor.mhp < 9999
  2920.         @actor.add_param(7, @luck_called * Parameter_Increase_Per_Stat[:luk])
  2921.       end
  2922.       if @atn_called > 0
  2923.         @actor.increase_dk_actor_atn(@atn_called)
  2924.         @actor.add_param(6, @atn_called * Parameter_Increase_Per_Stat[:agi])
  2925.       end
  2926.       $game_party.lose_exp(@total_exp)
  2927.       @total_exp = @actor.get_dk_actor_exp
  2928.       @lv = 1
  2929.       @vit_called  = 0
  2930.       @int_called  = 0
  2931.       @fth_called  = 0
  2932.       @str_called  = 0
  2933.       @dex_called  = 0
  2934.       @luck_called = 0
  2935.       @atn_called  = 0
  2936.       return_normal_color
  2937.       return true
  2938.     else
  2939.       return false
  2940.     end
  2941.   end
  2942.   #--------------------------------------------------------------------------
  2943.   # * New Method: Increase Actor Stat
  2944.   #--------------------------------------------------------------------------
  2945.   def increase_state
  2946.     @lv = 1 if @lv == 0
  2947.     if get_exp_increase_value  < @commands.exp
  2948.       if @commands.current_symbol == :vit && (@actor.get_dk_actor_vit + @vit_called) < 99  
  2949.         @vit_called += 1
  2950.         @vit_called += @luck_called if @luck_called > 0
  2951.         @commands.draw_increase_vit(24, get_exp_increase_value)
  2952.         @status_point_window.draw_actor_level_change(@actor, 136, 48, @lv)
  2953.         @status_point_window.draw_actor_hp_change(@actor, 136, 82, Parameter_Increase_Per_Stat[:mhp] * @vit_called)
  2954.         @vit_called -= @luck_called if @luck_called > 0
  2955.         @vit_called += @str_called if @str_called > 0
  2956.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 1, Parameter_Increase_Per_Stat[:def] * @vit_called, 3)
  2957.         @vit_called -= @str_called if @str_called > 0      
  2958.         @status_point_window.draw_actor_level_exp_change(304, 48, increase_total_exp, (@actor.get_dk_actor_level) + @lv)
  2959.         @lv += 1
  2960.       elsif @commands.current_symbol == :int  && (@actor.get_dk_actor_int + @int_called) < 99
  2961.         @int_called += 1
  2962.         @commands.draw_increase_int(48, get_exp_increase_value)
  2963.         @status_point_window.draw_actor_level_change(@actor, 136, 48, @lv)
  2964.         @int_called += @fth_called if @fth_called > 0
  2965.         @status_point_window.draw_actor_mp_change(@actor, 136, 112, Parameter_Increase_Per_Stat[:mmp] * @int_called)
  2966.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 2, Parameter_Increase_Per_Stat[:mat] * @int_called, 4)
  2967.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 3, Parameter_Increase_Per_Stat[:mdf] * @int_called, 5)
  2968.         @int_called -= @fth_called if @fth_called > 0
  2969.         @status_point_window.draw_actor_level_exp_change(304, 48, increase_total_exp, (@actor.get_dk_actor_level) + @lv)
  2970.         @lv += 1
  2971.       elsif @commands.current_symbol == :fth  && (@actor.get_dk_actor_fth + @fth_called) < 99
  2972.         @fth_called += 1
  2973.         @commands.draw_increase_fth(72, get_exp_increase_value)
  2974.         @status_point_window.draw_actor_level_change(@actor, 136, 48, @lv)
  2975.         @fth_called += @int_called if @int_called > 0
  2976.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 2, Parameter_Increase_Per_Stat[:mat] * @fth_called, 4)
  2977.         @status_point_window.draw_actor_mp_change(@actor, 136, 112, Parameter_Increase_Per_Stat[:mmp] * @fth_called)
  2978.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 3, Parameter_Increase_Per_Stat[:mdf] * @fth_called, 5)
  2979.         @fth_called -= @int_called if @int_called > 0
  2980.         @status_point_window.draw_actor_level_exp_change(304, 48, increase_total_exp, (@actor.get_dk_actor_level) + @lv)
  2981.         @lv += 1
  2982.       elsif @commands.current_symbol == :str && (@actor.get_dk_actor_str + @str_called) < 99
  2983.         @str_called += 1
  2984.         @commands.draw_increase_str(98, get_exp_increase_value)
  2985.         @status_point_window.draw_actor_level_change(@actor, 136, 48, @lv)
  2986.         @str_called += @dex_called if @dex_called > 0
  2987.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 0, Parameter_Increase_Per_Stat[:att] * @str_called, 2)
  2988.         @str_called -= @dex_called if @dex_called > 0
  2989.         @str_called += @vit_called if @vit_called > 0
  2990.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 1, Parameter_Increase_Per_Stat[:def] * @str_called, 3)
  2991.         @str_called -= @vit_called if @vit_called > 0
  2992.         @status_point_window.draw_actor_level_exp_change(304, 48, increase_total_exp, (@actor.get_dk_actor_level) + @lv)
  2993.         @lv += 1
  2994.       elsif @commands.current_symbol == :dex && (@actor.get_dk_actor_dex + @dex_called) < 99
  2995.         @dex_called += 1
  2996.         @commands.draw_increase_dex(122, get_exp_increase_value)
  2997.         @status_point_window.draw_actor_level_change(@actor, 136, 48, @lv)
  2998.         @dex_called += @str_called if @str_called > 0
  2999.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 0, Parameter_Increase_Per_Stat[:att] * @dex_called, 2)
  3000.         @dex_called -= @str_called if @str_called > 0
  3001.         @dex_called += @atn_called if @atn_called > 0
  3002.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 4, Parameter_Increase_Per_Stat[:agi] * @dex_called, 6)
  3003.         @dex_called -= @atn_called if @atn_called > 0
  3004.         @status_point_window.draw_actor_level_exp_change(304, 48, increase_total_exp, (@actor.get_dk_actor_level) + @lv)
  3005.         @lv += 1
  3006.       elsif @commands.current_symbol == :luck && (@actor.get_dk_actor_luck + @luck_called) < 99
  3007.         @luck_called += 1
  3008.         @commands.draw_increase_luck(146, get_exp_increase_value)
  3009.         @status_point_window.draw_actor_level_change(@actor, 136, 48, @lv)
  3010.         @luck_called += @vit_called if @vit_called > 0
  3011.         @status_point_window.draw_actor_hp_change(@actor, 136, 82, Parameter_Increase_Per_Stat[:mhp] * @luck_called)
  3012.         @luck_called -= @vit_called if @vit_called > 0
  3013.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 5, Parameter_Increase_Per_Stat[:luk] * @luck_called, 7)
  3014.         @status_point_window.draw_actor_level_exp_change(304, 48, increase_total_exp, (@actor.get_dk_actor_level) + @lv)
  3015.         @lv += 1
  3016.       elsif @commands.current_symbol == :atn && (@actor.get_dk_actor_atn + @atn_called) < 99
  3017.         @atn_called += 1
  3018.         @commands.draw_increase_atn(170, get_exp_increase_value)
  3019.         @status_point_window.draw_actor_level_change(@actor, 136, 48, @lv)
  3020.         @atn_called += @dex_called if @dex_called > 0
  3021.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 4, Parameter_Increase_Per_Stat[:agi] * @atn_called, 6)
  3022.         @atn_called -= @dex_called if @dex_called > 0
  3023.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 6, ((@actor.get_dk_actor_atn + @atn_called) / 5), 8) if ((@actor.get_dk_actor_atn + @atn_called) % 5 == 0)
  3024.         @status_point_window.draw_actor_level_exp_change(304, 48, increase_total_exp, (@actor.get_dk_actor_level) + @lv)
  3025.         @lv += 1
  3026.       else
  3027.         return false
  3028.       end
  3029.     else
  3030.       return false
  3031.     end
  3032.   end
  3033.   #--------------------------------------------------------------------------
  3034.   # * New Method: Decraese Actor Stat
  3035.   #--------------------------------------------------------------------------
  3036.   def decrease_state
  3037.     if @lv > 0
  3038.       if @commands.current_symbol == :vit && @vit_called > 0
  3039.         @vit_called -= 1
  3040.         @lv -= 1
  3041.         @vit_called += @luck_called if @luck_called > 0
  3042.         @commands.draw_decrease_vit(24, get_exp_increase_value)
  3043.         @status_point_window.draw_actor_level_change(@actor, 136, 48, @lv - 1)
  3044.         @status_point_window.draw_actor_hp_change(@actor, 136, 82, Parameter_Increase_Per_Stat[:mhp] * @vit_called)
  3045.         @vit_called -= @luck_called if @luck_called > 0
  3046.         @vit_called += @str_called if @str_called > 0
  3047.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 1, Parameter_Increase_Per_Stat[:def] * @vit_called, 3)
  3048.         @vit_called -= @str_called if @str_called > 0
  3049.         @status_point_window.draw_actor_level_exp_change(304, 48, decrease_total_exp, (@actor.get_dk_actor_level) + @lv - 1)
  3050.       elsif @commands.current_symbol == :int && @int_called > 0
  3051.         @int_called -= 1
  3052.         @lv -= 1
  3053.         @commands.draw_decrease_int(48, get_exp_increase_value)
  3054.         @status_point_window.draw_actor_level_change(@actor, 136, 48, @lv - 1)
  3055.         @int_called += @fth_called if @fth_called > 0
  3056.         @status_point_window.draw_actor_mp_change(@actor, 136, 112, Parameter_Increase_Per_Stat[:mmp] * @int_called)
  3057.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 2, Parameter_Increase_Per_Stat[:mat] * @int_called, 4)
  3058.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 3, Parameter_Increase_Per_Stat[:mdf] * @int_called, 5)
  3059.         @int_called -= @fth_called if @fth_called > 0
  3060.         @status_point_window.draw_actor_level_exp_change(304, 48, decrease_total_exp, (@actor.get_dk_actor_level) + @lv - 1)
  3061.       elsif @commands.current_symbol == :fth && @fth_called > 0
  3062.         @fth_called -= 1
  3063.         @lv -= 1
  3064.         @commands.draw_decrease_fth(72, get_exp_increase_value)
  3065.         @status_point_window.draw_actor_level_change(@actor, 136, 48, @lv - 1)
  3066.         @fth_called += @int_called if @int_called > 0
  3067.         @status_point_window.draw_actor_mp_change(@actor, 136, 112, Parameter_Increase_Per_Stat[:mmp] * @fth_called)
  3068.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 2, Parameter_Increase_Per_Stat[:mat] * @fth_called, 4)
  3069.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 3, Parameter_Increase_Per_Stat[:mdf] * @fth_called, 5)
  3070.         @fth_called -= @int_called if @int_called > 0
  3071.         @status_point_window.draw_actor_level_exp_change(304, 48, decrease_total_exp, (@actor.get_dk_actor_level) + @lv - 1)
  3072.       elsif @commands.current_symbol == :str && @str_called > 0
  3073.         @str_called -= 1
  3074.         @lv -= 1
  3075.         @commands.draw_decrease_str(98, get_exp_increase_value)
  3076.         @status_point_window.draw_actor_level_change(@actor, 136, 48, @lv - 1)
  3077.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 0, Parameter_Increase_Per_Stat[:att] * @str_called, 2)
  3078.         @str_called += @vit_called if @vit_called > 0
  3079.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 1, Parameter_Increase_Per_Stat[:def] * @str_called, 3)
  3080.         @str_called -= @vit_called if @vit_called > 0
  3081.         @status_point_window.draw_actor_level_exp_change(304, 48, decrease_total_exp, (@actor.get_dk_actor_level) + @lv - 1)
  3082.       elsif @commands.current_symbol == :dex && @dex_called > 0
  3083.         @dex_called -= 1
  3084.         @lv -= 1
  3085.         @commands.draw_decrease_dex(122, get_exp_increase_value)
  3086.         @status_point_window.draw_actor_level_change(@actor, 136, 48, @lv - 1)
  3087.         @dex_called += @str_called if @str_called > 0
  3088.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 0, Parameter_Increase_Per_Stat[:att] * @dex_called, 2)
  3089.         @dex_called -= @str_called if @str_called > 0
  3090.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 4, Parameter_Increase_Per_Stat[:agi] * @dex_called, 6)
  3091.         @status_point_window.draw_actor_level_exp_change(304, 48, decrease_total_exp, (@actor.get_dk_actor_level) + @lv - 1)
  3092.       elsif @commands.current_symbol == :luck && @luck_called > 0
  3093.         @luck_called -= 1
  3094.         @lv -= 1
  3095.         @commands.draw_decrease_luck(146, get_exp_increase_value)
  3096.         @status_point_window.draw_actor_level_change(@actor, 136, 48, @lv - 1)
  3097.         @luck_called += @vit_called if @vit_called > 0
  3098.         @status_point_window.draw_actor_hp_change(@actor, 136, 82, Parameter_Increase_Per_Stat[:mhp] * @luck_called)
  3099.         @luck_called -= @vit_called if @vit_called > 0
  3100.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 5, Parameter_Increase_Per_Stat[:luk] * @luck_called, 7)
  3101.         @status_point_window.draw_actor_level_exp_change(304, 48, decrease_total_exp, (@actor.get_dk_actor_level) + @lv - 1)
  3102.       elsif @commands.current_symbol == :atn && @atn_called > 0
  3103.         @atn_called -= 1
  3104.         @lv -= 1
  3105.         @commands.draw_decrease_atn(170, get_exp_increase_value)
  3106.         @status_point_window.draw_actor_level_change(@actor, 136, 48, @lv - 1)
  3107.         @atn_called += @dex_called if @dex_called > 0
  3108.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 4, Parameter_Increase_Per_Stat[:agi] * @atn_called, 6)
  3109.         @atn_called -= @dex_called if @dex_called > 0
  3110.         @status_point_window.draw_actor_param_change(@actor, 288, 168, 6, ((@actor.get_dk_actor_atn + @atn_called) / 5), 8) if !((@actor.get_dk_actor_atn + @atn_called) % 5 == 0)
  3111.         @status_point_window.draw_actor_level_exp_change(304, 48, decrease_total_exp, (@actor.get_dk_actor_level) + @lv - 1)
  3112.       else
  3113.         return false
  3114.       end
  3115.     else
  3116.       return false
  3117.     end
  3118.   end
  3119.   #--------------------------------------------------------------------------
  3120.   # * New Method: Call Redraw Methods
  3121.   #--------------------------------------------------------------------------
  3122.   def return_normal_color
  3123.     @status_point_window.return_actor_level_normal_color(@actor)
  3124.     @status_point_window.return_actor_hp_normal_color(@actor)
  3125.     @status_point_window.return_actor_mp_normal_color(@actor)
  3126.     @status_point_window.return_exp_color
  3127.     @status_point_window.return_parameters_color
  3128.     @commands.return_actor_stat_normal_color(@actor)
  3129.   end
  3130.   #--------------------------------------------------------------------------
  3131.   # * New Method: Increase Temporary Exp
  3132.   #--------------------------------------------------------------------------
  3133.   def increase_total_exp
  3134.     @total_exp += get_exp_increase_value
  3135.   end
  3136.   #--------------------------------------------------------------------------
  3137.   # * New Method: Decrease Temporary Exp
  3138.   #--------------------------------------------------------------------------
  3139.   def decrease_total_exp
  3140.     @total_exp -= get_exp_increase_value
  3141.   end
  3142.   #--------------------------------------------------------------------------
  3143.   # * New Method: Return Temporary Exp
  3144.   #--------------------------------------------------------------------------
  3145.   def get_total_exp
  3146.     @total_exp -= @actor.get_dk_actor_exp
  3147.   end
  3148.   #--------------------------------------------------------------------------
  3149.   # * New Method: Return Increase In Temporary Exp
  3150.   #--------------------------------------------------------------------------
  3151.   def get_exp_increase_value
  3152.     (@actor.exp_for_level(@actor.get_dk_actor_level + @lv) - @actor.exp_for_level(@actor.get_dk_actor_level + @lv - 1))
  3153.   end
  3154. end
  3155. #==============================================================================
  3156. # ** Scene_Equip
  3157. #------------------------------------------------------------------------------
  3158. #  This class performs the equipment screen processing.
  3159. #==============================================================================
  3160.  
  3161. class Scene_Equip < Scene_MenuBase
  3162.   #--------------------------------------------------------------------------
  3163.   # * Start Processing
  3164.   #--------------------------------------------------------------------------
  3165.   alias ggslayer_dark_souls_stat_points_Scene_Equip_start    start
  3166.   def start
  3167.     super
  3168.     create_help_window
  3169.     create_status_window
  3170.     create_slot_window
  3171.     create_weapon_stat_window
  3172.     create_item_window
  3173.   end
  3174.   #--------------------------------------------------------------------------
  3175.   # * Create Slot Window
  3176.   #--------------------------------------------------------------------------
  3177.   def create_slot_window
  3178.     wx = @status_window.width
  3179.     wy = @help_window.height
  3180.     ww = Graphics.width - @status_window.width
  3181.     @slot_window = Window_EquipSlot.new(wx, wy, ww)
  3182.     @slot_window.viewport = @viewport
  3183.     @slot_window.help_window = @help_window
  3184.     @slot_window.status_window = @status_window
  3185.     @slot_window.actor = @actor
  3186.     @slot_window.set_handler(:ok,       method(:on_slot_ok))
  3187.     @slot_window.set_handler(:cancel,   method(:return_scene))
  3188.     @slot_window.activate
  3189.     @slot_window.select(0)
  3190.   end
  3191.   #--------------------------------------------------------------------------
  3192.   # * Create Item Window
  3193.   #--------------------------------------------------------------------------
  3194.   def create_item_window
  3195.     wx = 0
  3196.     wy = @slot_window.y + @slot_window.height
  3197.     ww = Graphics.width
  3198.     wh = Graphics.height - wy - 50
  3199.     @item_window = Window_EquipItem.new(wx, wy, ww, wh)
  3200.     @item_window.viewport = @viewport
  3201.     @item_window.help_window = @help_window
  3202.     @item_window.status_window = @status_window
  3203.     @item_window.stat_window = @stat_weapon
  3204.     @item_window.actor = @actor
  3205.     @item_window.set_handler(:ok,     method(:on_item_ok))
  3206.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  3207.     @slot_window.item_window = @item_window
  3208.   end
  3209.   #--------------------------------------------------------------------------
  3210.   # * New Method: Create Weapon Stat Window
  3211.   #--------------------------------------------------------------------------
  3212.   def create_weapon_stat_window
  3213.     y = Graphics.height - 50
  3214.     @stat_weapon = Window_Equip_Stat.new(0, y, Graphics.width, 50)
  3215.     @stat_weapon.actor = @actor
  3216.   end
  3217.   #--------------------------------------------------------------------------
  3218.   # * Slot [OK]
  3219.   #--------------------------------------------------------------------------
  3220.   def on_slot_ok
  3221.     @item_window.activate
  3222.     @item_window.select(0)
  3223.   end
  3224.   #--------------------------------------------------------------------------
  3225.   # * Item [OK]
  3226.   #--------------------------------------------------------------------------
  3227.   def on_item_ok
  3228.    
  3229.     if @item_window.item != nil && @item_window.item.note != ""
  3230.       if @item_window.item.note =~ /<(\w+):\s(\d+)>/
  3231.         if @stat_weapon.stat_compatible?($1, $2, @slot_window.show_slot) &&
  3232.                 @item_window.item.get_durability > 0
  3233.           Sound.play_equip
  3234.           @actor.deactivate_previous_attribute(@slot_window.index)
  3235.           @actor.change_equip(@slot_window.index, @item_window.item)
  3236.           @actor.change_equip(2, nil) if @slot_window.index == 1
  3237.           @actor.change_equip(1, nil) if @slot_window.index == 2
  3238.           @actor.activate_physical_attribute if @item_window.item.note =~ /Physical/
  3239.           @actor.activate_magical_attribute  if @item_window.item.note =~ /Magical/
  3240.           @actor.activate_faith_attribute    if @item_window.item.note =~ /Faith/
  3241.           @slot_window.activate
  3242.           @slot_window.refresh
  3243.           @item_window.unselect
  3244.           @item_window.refresh
  3245.         else
  3246.           Sound.play_buzzer
  3247.           @item_window.activate
  3248.           @item_window.refresh
  3249.         end
  3250.       elsif @item_window.item.note =~ /<(\w+):\s(\d+),\s(\w+):\s(\d+)>/
  3251.           if @stat_weapon.stat_compatible?($1, $2, @slot_window.show_slot) &&
  3252.               @stat_weapon.stat_compatible?($3, $4, @slot_window.show_slot) &&
  3253.                 @item_window.item.get_durability > 0
  3254.             Sound.play_equip
  3255.             @actor.deactivate_previous_attribute(@slot_window.index)
  3256.             @actor.change_equip(@slot_window.index, @item_window.item)
  3257.             @actor.change_equip(2, nil) if @slot_window.index == 1
  3258.             @actor.change_equip(1, nil) if @slot_window.index == 2
  3259.             @actor.activate_physical_attribute if @item_window.item.note =~ /Physical/
  3260.             @actor.activate_magical_attribute  if @item_window.item.note =~ /Magical/
  3261.             @actor.activate_faith_attribute    if @item_window.item.note =~ /Faith/
  3262.             @slot_window.activate
  3263.             @slot_window.refresh
  3264.             @item_window.unselect
  3265.             @item_window.refresh
  3266.         else
  3267.             Sound.play_buzzer
  3268.             @item_window.activate
  3269.             @item_window.refresh
  3270.         end
  3271.       elsif @item_window.item.note =~  /<(\w+):\s(\d+),\s(\w+):\s(\d+),\s(\w+):\s(\d+)>/
  3272.           if @stat_weapon.stat_compatible?($1, $2, @slot_window.show_slot) &&
  3273.               @stat_weapon.stat_compatible?($3, $4, @slot_window.show_slot) &&
  3274.                 @stat_weapon.stat_compatible?($5, $6, @slot_window.show_slot) &&
  3275.                   @item_window.item.get_durability > 0
  3276.             Sound.play_equip
  3277.             @actor.deactivate_previous_attribute(@slot_window.index)
  3278.             @actor.change_equip(@slot_window.index, @item_window.item)
  3279.             @actor.change_equip(2, nil) if @slot_window.index == 1
  3280.             @actor.change_equip(1, nil) if @slot_window.index == 2
  3281.             @actor.activate_physical_attribute if @item_window.item.note =~ /Physical/
  3282.             @actor.activate_magical_attribute  if @item_window.item.note =~ /Magical/
  3283.             @actor.activate_faith_attribute    if @item_window.item.note =~ /Faith/
  3284.             @slot_window.activate
  3285.             @slot_window.refresh
  3286.             @item_window.unselect
  3287.             @item_window.refresh
  3288.         else
  3289.             Sound.play_buzzer
  3290.             @item_window.activate
  3291.             @item_window.refresh
  3292.         end
  3293.       elsif @item_window.item.note =~ /<(\w+):\s(\d+),\s(\w+):\s(\d+),\s(\w+):\s(\d+),\s(\w+):\s(\d+)>/
  3294.           if @stat_weapon.stat_compatible?($1, $2, @slot_window.show_slot) &&
  3295.               @stat_weapon.stat_compatible?($3, $4, @slot_window.show_slot) &&
  3296.                 @stat_weapon.stat_compatible?($5, $6, @slot_window.show_slot) &&
  3297.                   @stat_weapon.stat_compatible?($7, $8, @slot_window.show_slot) &&
  3298.                     @item_window.item.get_durability > 0
  3299.             Sound.play_equip
  3300.             @actor.deactivate_previous_attribute(@slot_window.index)
  3301.             @actor.change_equip(@slot_window.index, @item_window.item)
  3302.             @actor.change_equip(2, nil) if @slot_window.index == 1
  3303.             @actor.change_equip(1, nil) if @slot_window.index == 2
  3304.             @actor.activate_physical_attribute if @item_window.item.note =~ /Physical/
  3305.             @actor.activate_magical_attribute  if @item_window.item.note =~ /Magical/
  3306.             @actor.activate_faith_attribute    if @item_window.item.note =~ /Faith/
  3307.             @slot_window.activate
  3308.             @slot_window.refresh
  3309.             @item_window.unselect
  3310.             @item_window.refresh
  3311.         else
  3312.             Sound.play_buzzer
  3313.             @item_window.activate
  3314.             @item_window.refresh
  3315.         end
  3316.       elsif @item_window.item.get_durability > 0
  3317.         Sound.play_equip
  3318.         @actor.deactivate_previous_attribute(@slot_window.index)
  3319.         @actor.change_equip(@slot_window.index, @item_window.item)
  3320.         @actor.change_equip(2, nil) if @slot_window.index == 1 && @item_window.item != nil
  3321.         @actor.change_equip(1, nil) if @slot_window.index == 2 && @item_window.item != nil
  3322.         @actor.activate_physical_attribute if @item_window.item.note =~ /Physical/
  3323.         @actor.activate_magical_attribute  if @item_window.item.note =~ /Magical/
  3324.         @actor.activate_faith_attribute    if @item_window.item.note =~ /Faith/
  3325.         @slot_window.activate
  3326.         @slot_window.refresh
  3327.         @item_window.unselect
  3328.         @item_window.refresh
  3329.       else
  3330.         Sound.play_buzzer
  3331.         @item_window.activate
  3332.         @item_window.refresh
  3333.       end
  3334.     else
  3335.       Sound.play_equip
  3336.       @actor.deactivate_previous_attribute(@slot_window.index)
  3337.       @actor.change_equip(@slot_window.index, @item_window.item)
  3338.       @actor.change_equip(2, nil) if @slot_window.index == 1 && @item_window.item != nil
  3339.       @actor.change_equip(1, nil) if @slot_window.index == 2 && @item_window.item != nil
  3340.       @slot_window.activate
  3341.       @slot_window.refresh
  3342.       @item_window.unselect
  3343.       @item_window.refresh
  3344.     end
  3345.   end
  3346. end
  3347.  
  3348. #==============================================================================
  3349. # ** Scene_Skill_Equip
  3350. #------------------------------------------------------------------------------
  3351. #  This class performs the Skill screen processing.
  3352. #==============================================================================
  3353.  
  3354. class Scene_Skill_Equip < Scene_MenuBase
  3355.   #--------------------------------------------------------------------------
  3356.   # * Start Processing
  3357.   #--------------------------------------------------------------------------
  3358.   def start
  3359.     super
  3360.     @actor = get_actor($actor_name)
  3361.     create_help_window
  3362.     create_status_window
  3363.     create_skill_stat_window
  3364.     create_skill_window
  3365.   end
  3366.   #--------------------------------------------------------------------------
  3367.   # * Create Status Window
  3368.   #--------------------------------------------------------------------------
  3369.   def create_status_window
  3370.     wy = @help_window.y + @help_window.height
  3371.     @status_window = Window_Equip_Skill_Status.new(@actor, wy, 150)
  3372.   end
  3373.   #--------------------------------------------------------------------------
  3374.   # * Create Item Window
  3375.   #--------------------------------------------------------------------------
  3376.   def create_skill_window
  3377.     wx = 0
  3378.     wy = @status_window.y + @status_window.height
  3379.     ww = Graphics.width
  3380.     wh = Graphics.height - wy - 50
  3381.     @item_window = Window_Equip_SkillList.new(wx, wy, ww, wh)
  3382.     @item_window.viewport = @viewport
  3383.     @item_window.help_window = @help_window
  3384.     @item_window.stat_window = @stat_skill
  3385.     @item_window.actor = @actor
  3386.     @item_window.activate
  3387.     @item_window.select(0)
  3388.     @item_window.set_handler(:ok,     method(:on_item_ok))
  3389.     @item_window.set_handler(:cancel, method(:return_scene))
  3390.   end
  3391.   #--------------------------------------------------------------------------
  3392.   # * Create Skill Stat Window
  3393.   #--------------------------------------------------------------------------
  3394.   def create_skill_stat_window
  3395.     y = Graphics.height - 50
  3396.     @stat_skill = Window_Skill_Stat.new(0, y, Graphics.width, 50)
  3397.     @stat_skill.actor = @actor
  3398.   end
  3399.   #--------------------------------------------------------------------------
  3400.   # * Item [OK]
  3401.   #--------------------------------------------------------------------------
  3402.   def on_item_ok
  3403.     if @item_window.item != nil && !@actor.is_learned?(@item_window.item.skill_id)
  3404.       equip_skill
  3405.     elsif @item_window.item != nil
  3406.       unequip_skill(@item_window.item.skill_id)
  3407.     else
  3408.       Sound.play_buzzer
  3409.       @item_window.activate
  3410.       @item_window.refresh
  3411.     end
  3412.   end
  3413.   #--------------------------------------------------------------------------
  3414.   # * New Method: Equip Skill For Actor
  3415.   #--------------------------------------------------------------------------
  3416.   def equip_skill
  3417.     if @item_window.item != nil && @item_window.item.note != ""
  3418.         if $data_skills[@item_window.item.skill_id].note =~ /<(\w+):\s(\d+)>/
  3419.           if @stat_skill.stat_compatible?($1, $2) &&
  3420.               @actor.memory_slot >= (@actor.get_used_memory_slot + $data_skills[@item_window.item.skill_id].get_memory_slot_required)
  3421.             Sound.play_equip
  3422.             @actor.learn_skill(@item_window.item.skill_id)
  3423.             @status_window.refresh
  3424.             @item_window.activate
  3425.             @item_window.refresh
  3426.           else
  3427.             Sound.play_buzzer
  3428.             @item_window.activate
  3429.             @item_window.refresh
  3430.           end
  3431.         elsif $data_skills[@item_window.item.skill_id].note =~ /<(\w+):\s(\d+),\s(\w+):\s(\d+)>/
  3432.           if @stat_skill.stat_compatible?($1, $2) &&
  3433.                 @stat_skill.stat_compatible?($3, $4) &&
  3434.                   @actor.memory_slot >= (@actor.get_used_memory_slot + $data_skills[@item_window.item.skill_id].get_memory_slot_required)
  3435.               Sound.play_equip
  3436.               @actor.learn_skill(@item_window.item.skill_id)
  3437.               @status_window.refresh
  3438.               @item_window.activate
  3439.               @item_window.refresh
  3440.           else
  3441.               Sound.play_buzzer
  3442.               @item_window.activate
  3443.               @item_window.refresh
  3444.           end
  3445.         elsif $data_skills[@item_window.item.skill_id].note =~  /<(\w+):\s(\d+),\s(\w+):\s(\d+),\s(\w+):\s(\d+)>/
  3446.           if @stat_skill.stat_compatible?($1, $2) &&
  3447.                 @stat_skill.stat_compatible?($3, $4) &&
  3448.                   @stat_skill.stat_compatible?($5, $6) &&
  3449.                     @actor.memory_slot >= (@actor.get_used_memory_slot + $data_skills[@item_window.item.skill_id].get_memory_slot_required)
  3450.               Sound.play_equip
  3451.               @actor.learn_skill(@item_window.item.skill_id)
  3452.               @status_window.refresh
  3453.               @item_window.activate
  3454.               @item_window.refresh
  3455.           else
  3456.               Sound.play_buzzer
  3457.               @item_window.activate
  3458.               @item_window.refresh
  3459.           end
  3460.         elsif $data_skills[@item_window.item.skill_id].note =~ /<(\w+):\s(\d+),\s(\w+):\s(\d+),\s(\w+):\s(\d+),\s(\w+):\s(\d+)>/
  3461.           if @stat_skill.stat_compatible?($1, $2) &&
  3462.                 @stat_skill.stat_compatible?($3, $4) &&
  3463.                   @stat_skill.stat_compatible?($5, $6) &&
  3464.                     @stat_skill.stat_compatible?($7, $8) &&
  3465.                       @actor.memory_slot >= (@actor.get_used_memory_slot + $data_skills[@item_window.item.skill_id].get_memory_slot_required)
  3466.              Sound.play_equip
  3467.               @actor.learn_skill(@item_window.item.skill_id)
  3468.               @status_window.refresh
  3469.               @item_window.activate
  3470.               @item_window.refresh
  3471.           else
  3472.               Sound.play_buzzer
  3473.               @item_window.activate
  3474.               @item_window.refresh
  3475.           end
  3476.         else
  3477.           Sound.play_buzzer
  3478.           @item_window.activate
  3479.           @item_window.refresh
  3480.         end
  3481.       else
  3482.         Sound.play_buzzer
  3483.         @item_window.activate
  3484.         @item_window.refresh
  3485.       end
  3486.   end
  3487.   #--------------------------------------------------------------------------
  3488.   # * New Method: Unequip Skill For Actor
  3489.   #--------------------------------------------------------------------------
  3490.   def unequip_skill(skill_id)
  3491.     @actor.forget_skill(skill_id)
  3492.     @status_window.refresh
  3493.     @item_window.activate
  3494.     @item_window.refresh
  3495.   end
  3496.   #--------------------------------------------------------------------------
  3497.   # * New Method: Get Actor
  3498.   #--------------------------------------------------------------------------
  3499.   def get_actor(name)
  3500.     $game_party.members.each  do  |actor|
  3501.       if actor.name == name
  3502.         return actor
  3503.       end
  3504.     end
  3505.   end
  3506. end
  3507.  
  3508. #==============================================================================
  3509. # ** Scene_Blacksmith
  3510. #------------------------------------------------------------------------------
  3511. #  This class performs Repair screen processing.
  3512. #==============================================================================
  3513.  
  3514. class Scene_Blacksmith < Scene_MenuBase
  3515.   #--------------------------------------------------------------------------
  3516.   # * Start Processing
  3517.   #--------------------------------------------------------------------------
  3518.   def start
  3519.     super
  3520.     create_help_window
  3521.     create_gold_window
  3522.     create_command_window
  3523.     create_dummy_window
  3524.     create_category_window
  3525.     create_status_window
  3526.     create_blacksmith_upgrade_window
  3527.     create_blacksmith_repair_window
  3528.     create_blacksmith_infuse_window
  3529.     create_element_select_window
  3530.   end
  3531.    #--------------------------------------------------------------------------
  3532.   # * Create Command Window
  3533.   #--------------------------------------------------------------------------
  3534.   def create_command_window
  3535.     @command_window = Window_blacksmith_Command.new(@gold_window.x)
  3536.     @command_window.viewport = @viewport
  3537.     @command_window.y = @help_window.height
  3538.     @command_window.set_handler(:upgrade,    method(:command_upgrade))
  3539.     @command_window.set_handler(:infuse,    method(:command_infuse))
  3540.     @command_window.set_handler(:repair,   method(:command_repair))
  3541.     @command_window.set_handler(:cancel, method(:return_scene))
  3542.   end
  3543.   #--------------------------------------------------------------------------
  3544.   # * Create Category Window
  3545.   #--------------------------------------------------------------------------
  3546.   def create_category_window
  3547.     #For Infuse Equipment
  3548.     @category_window = Window_Blacksmith_ItemCategory.new
  3549.     @category_window.viewport = @viewport
  3550.     @category_window.help_window = @help_window
  3551.     @category_window.y = @dummy_window.y
  3552.     @category_window.hide.deactivate
  3553.     @category_window.set_handler(:ok,     method(:on_category_ok))
  3554.     @category_window.set_handler(:cancel, method(:on_category_cancel))
  3555.     #For Repair Equipment
  3556.     @category_window_r = Window_Blacksmith_ItemCategory.new
  3557.     @category_window_r.viewport = @viewport
  3558.     @category_window_r.help_window = @help_window
  3559.     @category_window_r.y = @dummy_window.y
  3560.     @category_window_r.hide.deactivate
  3561.     @category_window_r.set_handler(:ok,     method(:on_category_ok))
  3562.     @category_window_r.set_handler(:cancel, method(:on_category_cancel))
  3563.     #For Upgrade Equipment
  3564.     @category_window_up = Window_Blacksmith_ItemCategory.new
  3565.     @category_window_up.viewport = @viewport
  3566.     @category_window_up.help_window = @help_window
  3567.     @category_window_up.y = @dummy_window.y
  3568.     @category_window_up.hide.deactivate
  3569.     @category_window_up.set_handler(:ok,     method(:on_category_ok))
  3570.     @category_window_up.set_handler(:cancel, method(:on_category_cancel))
  3571.   end
  3572.   #--------------------------------------------------------------------------
  3573.   # * Create Status Window
  3574.   #--------------------------------------------------------------------------
  3575.   def create_status_window
  3576.     wx = 304
  3577.     wy = @category_window.y + @category_window.height
  3578.     ww = Graphics.width - wx
  3579.     wh = Graphics.height - wy
  3580.     @status_window = Window_Upgrade_Status.new(wx, wy, ww, wh)
  3581.     @status_window.viewport = @viewport
  3582.     @status_window.hide
  3583.   end
  3584.   #--------------------------------------------------------------------------
  3585.   # * Create Blacksmith Infuse Window
  3586.   #--------------------------------------------------------------------------
  3587.   def create_blacksmith_upgrade_window
  3588.     wy = @category_window.y + @category_window.height
  3589.     wh = Graphics.height - wy
  3590.     @blacksmith_upgrade_window = Window_Blacksmith_Upgrade.new(0, wy, wh)
  3591.     @blacksmith_upgrade_window.viewport = @viewport
  3592.     @blacksmith_upgrade_window.help_window = @help_window
  3593.     @blacksmith_upgrade_window.status_window = @status_window
  3594.     @blacksmith_upgrade_window.hide
  3595.     @blacksmith_upgrade_window.set_handler(:ok,     method(:on_upgrade_ok))
  3596.     @blacksmith_upgrade_window.set_handler(:cancel, method(:on_upgrade_cancel))
  3597.     @category_window_up.item_window = @blacksmith_upgrade_window
  3598.   end
  3599.   #--------------------------------------------------------------------------
  3600.   # * Create Gold Window
  3601.   #--------------------------------------------------------------------------
  3602.   def create_gold_window
  3603.     @gold_window = Window_Gold.new
  3604.     @gold_window.viewport = @viewport
  3605.     @gold_window.x = Graphics.width - @gold_window.width
  3606.     @gold_window.y = @help_window.height
  3607.   end
  3608.   #--------------------------------------------------------------------------
  3609.   # * Create Dummy Window
  3610.   #--------------------------------------------------------------------------
  3611.   def create_dummy_window
  3612.     wy = @command_window.y + @command_window.height
  3613.     wh = Graphics.height - wy
  3614.     @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
  3615.     @dummy_window.viewport = @viewport
  3616.   end
  3617.   #--------------------------------------------------------------------------
  3618.   # * Create Blacksmith Repair Window
  3619.   #--------------------------------------------------------------------------
  3620.   def create_blacksmith_repair_window
  3621.     wy = @category_window.y + @category_window.height
  3622.     wh = Graphics.height - wy
  3623.     @blacksmith_repair_window = Window_Blacksmith_Repair.new(0, wy, Graphics.width, wh)
  3624.     @blacksmith_repair_window.viewport = @viewport
  3625.     @blacksmith_repair_window.help_window = @help_window
  3626.     @blacksmith_repair_window.hide
  3627.     @blacksmith_repair_window.set_handler(:ok,     method(:on_repair_ok))
  3628.     @blacksmith_repair_window.set_handler(:cancel, method(:on_repair_cancel))
  3629.     @category_window_r.item_window = @blacksmith_repair_window
  3630.   end
  3631.   #--------------------------------------------------------------------------
  3632.   # * Create Blacksmith Infuse Window
  3633.   #--------------------------------------------------------------------------
  3634.   def create_blacksmith_infuse_window
  3635.     wy = @category_window.y + @category_window.height
  3636.     wh = Graphics.height - wy
  3637.     @blacksmith_infuse_window = Window_Blacksmith_Infuse.new(0, wy, Graphics.width, wh)
  3638.     @blacksmith_infuse_window.viewport = @viewport
  3639.     @blacksmith_infuse_window.help_window = @help_window
  3640.     @blacksmith_infuse_window.hide
  3641.     @blacksmith_infuse_window.set_handler(:ok,     method(:on_infuse_ok))
  3642.     @blacksmith_infuse_window.set_handler(:cancel, method(:on_infuse_cancel))
  3643.     @category_window.item_window = @blacksmith_infuse_window
  3644.   end
  3645.   #--------------------------------------------------------------------------
  3646.   # * Create Element Select Window
  3647.   #--------------------------------------------------------------------------
  3648.   def create_element_select_window
  3649.     wx = (Graphics.width.to_f/2).to_i - 160
  3650.     wy = (Graphics.height.to_f/2).to_i
  3651.     @elements_window = Window_Element.new(wx, wy)
  3652.     @elements_window.z = 200
  3653.     @elements_window.hide.deactivate
  3654.     @elements_window.set_handler(:none,     method(:on_element_ok))
  3655.     @elements_window.set_handler(:fire, method(:on_element_ok))
  3656.     @elements_window.set_handler(:ice,     method(:on_element_ok))
  3657.     @elements_window.set_handler(:thunder, method(:on_element_ok))
  3658.     @elements_window.set_handler(:water,     method(:on_element_ok))
  3659.     @elements_window.set_handler(:earth, method(:on_element_ok))
  3660.     @elements_window.set_handler(:wind,     method(:on_element_ok))
  3661.     @elements_window.set_handler(:holy, method(:on_element_ok))
  3662.     @elements_window.set_handler(:dark,     method(:on_element_ok))
  3663.     @elements_window.set_handler(:cancel, method(:on_element_cancel))
  3664.   end
  3665.   #--------------------------------------------------------------------------
  3666.   # * [Upgrade] Command
  3667.   #--------------------------------------------------------------------------
  3668.   def command_upgrade
  3669.     @dummy_window.hide
  3670.     @category_window_up.show.activate
  3671.     @status_window.show
  3672.     @blacksmith_upgrade_window.show
  3673.   end
  3674.   #--------------------------------------------------------------------------
  3675.   # * [Infuse] Command
  3676.   #--------------------------------------------------------------------------
  3677.   def command_infuse
  3678.     @dummy_window.hide
  3679.     @category_window.show.activate
  3680.     @blacksmith_infuse_window.show
  3681.   end
  3682.   #--------------------------------------------------------------------------
  3683.   # * [Repair] Command
  3684.   #--------------------------------------------------------------------------
  3685.   def command_repair
  3686.     @dummy_window.hide
  3687.     @category_window_r.show.activate
  3688.     @blacksmith_repair_window.show
  3689.   end
  3690.   #--------------------------------------------------------------------------
  3691.   # * Repair [OK]
  3692.   #--------------------------------------------------------------------------
  3693.   def on_repair_ok
  3694.     @item = @blacksmith_repair_window.item
  3695.     do_work(@blacksmith_repair_window.calculate_repair_cost(@item))
  3696.     @item.repair(@item.get_original_durability)
  3697.     @gold_window.refresh
  3698.     @blacksmith_repair_window.refresh
  3699.     @blacksmith_repair_window.activate
  3700.   end
  3701.   #--------------------------------------------------------------------------
  3702.   # * Repair [Cancel]
  3703.   #--------------------------------------------------------------------------
  3704.   def on_repair_cancel
  3705.     @blacksmith_repair_window.unselect
  3706.     @category_window_r.activate
  3707.     @help_window.clear
  3708.   end
  3709.   #--------------------------------------------------------------------------
  3710.   # * Infuse [OK]
  3711.   #--------------------------------------------------------------------------
  3712.   def on_infuse_ok
  3713.     @item = @blacksmith_infuse_window.item
  3714.     @elements_window.show.activate
  3715.   end
  3716.   #--------------------------------------------------------------------------
  3717.   # * Infuse [Cancel]
  3718.   #--------------------------------------------------------------------------
  3719.   def on_infuse_cancel
  3720.     @blacksmith_infuse_window.unselect
  3721.     @category_window.activate
  3722.     @help_window.clear
  3723.   end
  3724.   #--------------------------------------------------------------------------
  3725.   # * Element [OK]
  3726.   #--------------------------------------------------------------------------
  3727.   def on_element_ok
  3728.     @element = 1 if @elements_window.current_symbol == :none
  3729.     @element = 3 if @elements_window.current_symbol == :fire
  3730.     @element = 4 if @elements_window.current_symbol == :ice
  3731.     @element = 5 if @elements_window.current_symbol == :thunder
  3732.     @element = 6 if @elements_window.current_symbol == :water
  3733.     @element = 7 if @elements_window.current_symbol == :earth
  3734.     @element = 8 if @elements_window.current_symbol == :wind
  3735.     @element = 9 if @elements_window.current_symbol == :holy
  3736.     @element = 10 if @elements_window.current_symbol == :dark
  3737.     @elements_window.hide.deactivate
  3738.     @blacksmith_infuse_window.activate
  3739.     @item.change_atk_element(@element) if @category_window.current_symbol == :weapon
  3740.     @item.change_def_element(@element) if @category_window.current_symbol == :armor
  3741.     do_work(@blacksmith_infuse_window.infuse_cost(@item))
  3742.     @blacksmith_infuse_window.refresh
  3743.   end
  3744.   #--------------------------------------------------------------------------
  3745.   # * Element [Cancel]
  3746.   #--------------------------------------------------------------------------
  3747.   def on_element_cancel
  3748.     @elements_window.hide.deactivate
  3749.     @blacksmith_infuse_window.activate
  3750.   end
  3751.   #--------------------------------------------------------------------------
  3752.   # * Upgrade [OK]
  3753.   #--------------------------------------------------------------------------
  3754.   def on_upgrade_ok
  3755.     @item = @blacksmith_upgrade_window.item
  3756.     do_work(@blacksmith_upgrade_window.calculate_upgrade_cost(@item))
  3757.     @item.upgrade_equip
  3758.     @gold_window.refresh
  3759.     @blacksmith_upgrade_window.refresh
  3760.     @blacksmith_upgrade_window.activate
  3761.   end
  3762.   #--------------------------------------------------------------------------
  3763.   # * Upgrade [Cancel]
  3764.   #--------------------------------------------------------------------------
  3765.   def on_upgrade_cancel
  3766.     @blacksmith_upgrade_window.unselect
  3767.     @category_window_up.activate
  3768.     @help_window.clear
  3769.   end
  3770.   #--------------------------------------------------------------------------
  3771.   # * Category [OK]
  3772.   #--------------------------------------------------------------------------
  3773.   def on_category_ok
  3774.     activate_blacksmith_upgrade_window   if @command_window.current_symbol == :upgrade
  3775.     @blacksmith_upgrade_window.select(0) if @command_window.current_symbol == :upgrade
  3776.     activate_blacksmith_repair_window   if @command_window.current_symbol == :repair
  3777.     @blacksmith_repair_window.select(0) if @command_window.current_symbol == :repair
  3778.     activate_blacksmith_infuse_window   if @command_window.current_symbol == :infuse
  3779.     @blacksmith_infuse_window.select(0) if @command_window.current_symbol == :infuse
  3780.   end
  3781.   #--------------------------------------------------------------------------
  3782.   # * Category [Cancel]
  3783.   #--------------------------------------------------------------------------
  3784.   def on_category_cancel
  3785.     @command_window.activate
  3786.     @dummy_window.show
  3787.     @category_window.hide
  3788.     @category_window_r.hide
  3789.     @category_window_up.hide
  3790.     @blacksmith_repair_window.hide
  3791.     @blacksmith_infuse_window.hide
  3792.     @blacksmith_upgrade_window.hide
  3793.     @status_window.hide
  3794.   end
  3795.   #--------------------------------------------------------------------------
  3796.   # * Activate BlackSmith Update Window
  3797.   #--------------------------------------------------------------------------
  3798.   def activate_blacksmith_upgrade_window
  3799.     @dummy_window.hide
  3800.     @category_window_up.deactivate
  3801.     @blacksmith_upgrade_window.refresh
  3802.     @blacksmith_upgrade_window.show.activate
  3803.   end
  3804.   #--------------------------------------------------------------------------
  3805.   # * Activate BlackSmith Repair Window
  3806.   #--------------------------------------------------------------------------
  3807.   def activate_blacksmith_repair_window
  3808.     @dummy_window.hide
  3809.     @category_window_r.deactivate
  3810.     @blacksmith_repair_window.refresh
  3811.     @blacksmith_repair_window.show.activate
  3812.   end
  3813.   #--------------------------------------------------------------------------
  3814.   # * Activate BlackSmith Infuse Window
  3815.   #--------------------------------------------------------------------------
  3816.   def activate_blacksmith_infuse_window
  3817.     @dummy_window.hide
  3818.     @category_window.deactivate
  3819.     @blacksmith_infuse_window.refresh
  3820.     @blacksmith_infuse_window.show.activate
  3821.   end
  3822.   #--------------------------------------------------------------------------
  3823.   # * Execute Repair Cost
  3824.   #--------------------------------------------------------------------------
  3825.   def do_work(cost)
  3826.     $game_party.lose_gold(cost)
  3827.     RPG::SE.new("Hammer", 100, 100).play
  3828.   end
  3829. end
  3830.  
  3831. #==============================================================================
  3832. # ** Scene_Battle
  3833. #------------------------------------------------------------------------------
  3834. #  This class performs battle screen processing.
  3835. #==============================================================================
  3836.  
  3837. class Scene_Battle < Scene_Base
  3838.   #--------------------------------------------------------------------------
  3839.   # * Skill [OK]
  3840.   #--------------------------------------------------------------------------
  3841.   def on_skill_ok
  3842.     @skill = @skill_window.item
  3843.     if @skill != nil && @skill.note =~ /Physical/
  3844.       if @skill_window.actor.physical_attribute
  3845.         BattleManager.actor.input.set_skill(@skill.id)
  3846.         BattleManager.actor.last_skill.object = @skill
  3847.         if !@skill.need_selection?
  3848.           @skill_window.hide
  3849.           next_command
  3850.         elsif @skill.for_opponent?
  3851.           select_enemy_selection
  3852.         else
  3853.           select_actor_selection
  3854.         end
  3855.       else
  3856.         Sound.play_buzzer
  3857.         @skill_window.activate
  3858.       end
  3859.     elsif @skill != nil && @skill.note =~ /Magical/
  3860.       if @skill_window.actor.magical_attribute
  3861.         BattleManager.actor.input.set_skill(@skill.id)
  3862.         BattleManager.actor.last_skill.object = @skill
  3863.         if !@skill.need_selection?
  3864.           @skill_window.hide
  3865.           next_command
  3866.         elsif @skill.for_opponent?
  3867.           select_enemy_selection
  3868.         else
  3869.           select_actor_selection
  3870.         end
  3871.       else
  3872.         Sound.play_buzzer
  3873.         @skill_window.activate
  3874.       end
  3875.     elsif @skill != nil && @skill.note =~ /Faith/
  3876.       if @skill_window.actor.faith_attribute
  3877.         BattleManager.actor.input.set_skill(@skill.id)
  3878.         BattleManager.actor.last_skill.object = @skill
  3879.         if !@skill.need_selection?
  3880.           @skill_window.hide
  3881.           next_command
  3882.         elsif @skill.for_opponent?
  3883.           select_enemy_selection
  3884.         else
  3885.           select_actor_selection
  3886.         end
  3887.       else
  3888.         Sound.play_buzzer
  3889.         @skill_window.activate
  3890.       end
  3891.     elsif @skill != nil
  3892.       BattleManager.actor.input.set_skill(@skill.id)
  3893.       BattleManager.actor.last_skill.object = @skill
  3894.       if !@skill.need_selection?
  3895.         @skill_window.hide
  3896.         next_command
  3897.       elsif @skill.for_opponent?
  3898.         select_enemy_selection
  3899.       else
  3900.         select_actor_selection
  3901.       end
  3902.     else
  3903.       Sound.play_buzzer
  3904.       @skill_window.activate
  3905.     end
  3906.   end
  3907. end
Advertisement
Add Comment
Please, Sign In to add comment