#============================================================================== # ** ExEquip_BothHanded (AEROGP) #------------------------------------------------------------------------------ # This script grants the ability to use a shield, as well as equip it in the # weapon slot instead of the shield slot, when "two swords style" is enabled. #============================================================================== class Game_Actor < Game_Battler alias _exebthd_initialize initialize unless $@ #-------------------------------------------------------------------------- # * Object Initialization # actor_id : actor ID #-------------------------------------------------------------------------- def initialize(actor_id) _exebthd_initialize(actor_id) @weapon_class = RPG::Weapon @armor1_class = two_swords_style ? RPG::Weapon : RPG::Armor end #-------------------------------------------------------------------------- # * Get Weapon Object Array (Redefined) #-------------------------------------------------------------------------- def weapons result = [] if @weapon_class == RPG::Weapon result.push($data_weapons[@weapon_id]) end if @armor1_class == RPG::Weapon result.push($data_weapons[@armor1_id]) end return result end #-------------------------------------------------------------------------- # * Get Armor Object Array (Redefined) #-------------------------------------------------------------------------- def armors result = [] if @weapon_class == RPG::Armor result.push($data_armors[@weapon_id]) end if @armor1_class == RPG::Armor result.push($data_armors[@armor1_id]) end result.push($data_armors[@armor2_id]) result.push($data_armors[@armor3_id]) result.push($data_armors[@armor4_id]) return result end #-------------------------------------------------------------------------- # * Get Left-Hand Object #-------------------------------------------------------------------------- def left_hand result = [nil] if @weapon_class == RPG::Weapon result = [$data_weapons[@weapon_id]] end if @weapon_class == RPG::Armor result = [$data_armors[@weapon_id]] end return result end #-------------------------------------------------------------------------- # * Get Right-Hand Object #-------------------------------------------------------------------------- def right_hand result = [nil] if @armor1_class == RPG::Weapon result = [$data_weapons[@armor1_id]] end if @armor1_class == RPG::Armor result = [$data_armors[@armor1_id]] end return result end #-------------------------------------------------------------------------- # * Get Body Armor Object Array #-------------------------------------------------------------------------- def body_armors result = [] result.push($data_armors[@armor2_id]) result.push($data_armors[@armor3_id]) result.push($data_armors[@armor4_id]) return result end #-------------------------------------------------------------------------- # * Get Equipped Item Object Array (Redefined) #-------------------------------------------------------------------------- def equips return left_hand + right_hand + body_armors end #-------------------------------------------------------------------------- # * Change Equipment (Definition added) # equip_type : Equip region (0..4) # item : Weapon or armor (nil is used to unequip) # test : Test flag (for battle test or temporary equipment) #-------------------------------------------------------------------------- def change_equip(equip_type, item, test = false) last_item = equips[equip_type] unless test return if $game_party.item_number(item) == 0 if item != nil $game_party.gain_item(last_item, 1) $game_party.lose_item(item, 1) end item_id = item == nil ? 0 : item.id case equip_type when 0 # Weapon / Weapon 1 @weapon_id = item_id if two_swords_style and item != nil # If two swords style @weapon_class = item.class unless shield_legal? # If shield is not allowed change_equip(1, nil, test) # Unequip from other hand end end unless two_hands_legal? # If two hands is not allowed change_equip(1, nil, test) # Unequip from other hand end when 1 # Shield / Weapon 2 @armor1_id = item_id if two_swords_style and item != nil # If two swords style @armor1_class = item.class unless shield_legal? # If shield is not allowed change_equip(0, nil, test) # Unequip from other hand end end unless two_hands_legal? # If two hands is not allowed change_equip(0, nil, test) # Unequip from other hand end when 2 # Head @armor2_id = item_id when 3 # Body @armor3_id = item_id when 4 # Accessory @armor4_id = item_id end end #-------------------------------------------------------------------------- # * Discard Equipment (Redefined) # item : Weapon or armor to be discarded. # Used when the "Include Equipment" option is enabled. #-------------------------------------------------------------------------- def discard_equip(item) if item.is_a?(RPG::Weapon) if @weapon_class == item.class and @weapon_id == item.id @weapon_id = 0 elsif @armor1_class == item.class and @armor1_id == item.id @armor1_id = 0 end elsif item.is_a?(RPG::Armor) if @weapon_class == item.class and @weapon_id == item.id @weapon_id = 0 elsif @armor1_class == item.class and @armor1_id == item.id @armor1_id = 0 elsif @armor2_id == item.id @armor2_id = 0 elsif @armor3_id == item.id @armor3_id = 0 elsif @armor4_id == item.id @armor4_id = 0 end end end #-------------------------------------------------------------------------- # * Determine if Shield is Usable #-------------------------------------------------------------------------- def shield_legal? if @weapon_id != 0 and @weapon_class == RPG::Armor return false if @armor1_class == RPG::Armor end if @armor1_id != 0 and @armor1_class == RPG::Armor return false if @weapon_class == RPG::Armor end return true end #-------------------------------------------------------------------------- # * Determine if Equippable (Redefined) # item : item #-------------------------------------------------------------------------- def equippable?(item) if item.is_a?(RPG::Weapon) return self.class.weapon_set.include?(item.id) elsif item.is_a?(RPG::Armor) return self.class.armor_set.include?(item.id) end return false end end class Window_EquipItem < Window_Item #-------------------------------------------------------------------------- # * Whether to include item in list (Redefined) # item : item #-------------------------------------------------------------------------- def include?(item) return true if item == nil if @equip_type == 0 if @actor.two_swords_style return false if item.is_a?(RPG::Armor) and item.kind > 0 else return false unless item.is_a?(RPG::Weapon) end else return false unless item.is_a?(RPG::Armor) return false unless item.kind == @equip_type - 1 end return @actor.equippable?(item) end end