#==============================================================================
# Multi-slot equipment script
#------------------------------------------------------------------------------
# Section 2: Actor
#------------------------------------------------------------------------------
# Guillaume777
# 6.2.1
# 2006/02/14
#==============================================================================
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
include G7_MS_MOD
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :equip_mode # To restore equipment after false equip
attr_accessor :equip_type_force # To bypass equip_type
attr_accessor :equip_from_menu # To prevent users to unequip cursed items
attr_accessor :translucent_texts # To store translucents slots
#--------------------------------------------------------------------------
# * Setup (Initializing new Slots)
# actor_id : actor ID
#--------------------------------------------------------------------------
alias g7_ms_game_actor_setup setup
def setup(actor_id)
g7_ms_game_actor_setup(actor_id) #setup normaly
self.order_armor_ids
end
#--------------------------------------------------------------------------
# * Number of Offhand Required
# ignore : ignore
#--------------------------------------------------------------------------
def nb_offhand_required(ignore=nil)
nb_offhand = 0
nb_need_offhand = 0
for i in 0...self.weapon_slots.size
if i != ignore then
weapon = self.weapon_ids
if weapon == 0 then
nb_offhand += 1
elsif $data_weapons[weapon].needs_offhand then
nb_need_offhand += 1
else
nb_offhand += 1
end
end
end
return (nb_need_offhand - nb_offhand)
end
#--------------------------------------------------------------------------
# * Change Equipment ( Modified for extra equipment)
# equip_type : type of equipment
# id : weapon or armor ID (If 0, remove equipment)
#--------------------------------------------------------------------------
alias g7_ms_game_actor_equip equip
def equip(equip_type, id)
if @equip_type_force != nil then equip_type = @equip_type_force end
# equip_type_force is used to bypass the equip_type argument
if self.equip_mode == 'STORE' then
# Store equipment for it to be restored after checking what the stats would
self.equip_mode = nil
@stored_armors = self.armor_ids.dup
@stored_weapons = self.weapon_ids.dup
saved_mode = 'STORE'
elsif self.equip_mode == 'RESTORE'
# Restore equipment after preview of new equipment on stats
self.equip_mode = nil
self.restore(equip_type)
return
# If equipped for real
else
if self.enough_hands?(equip_type,id) != false then
# Switch items to be equipped to fool the players
id = self.switch_items(equip_type,id)
end
end
# If not enough hands then don't equip
if self.enough_hands?(equip_type,id) == false then
id = 0
# If cursed and player tried to remove it, do nothing
elsif self.equip_from_menu and self.cursed?(equip_type) then
id = 0
# If the slot is one of the 5 basic ones
elsif equip_type <= 4
# Equip the goold old way
g7_ms_game_actor_equip(equip_type, id)
else
# Equip in the new way
equip_extra(equip_type,id) #equip in the new way
end
# Fix in case there are no enough empty hands for all the equipped weapons
if id != 0 then self.fix_handed_weapons(equip_type) end
# This ensure that the next equiping will restore the original equipment
if saved_mode == 'STORE' then self.equip_mode = 'RESTORE' end
end
#--------------------------------------------------------------------------
# * Restore Equipment once the stats are checked and adds translucent
# equip_type : type of equipment
#--------------------------------------------------------------------------
def restore(equip_type)
if self.translucent_texts == nil then self.translucent_texts = Array.new end
self.equip_from_menu = false
if equip_type != 0 and @stored_weapons[0] != self.weapon_ids[0]
self.translucent_texts[0] = true
end
for i in 1...@stored_weapons.size
if i+[self.armor_slots.size,4].max != equip_type and
@stored_weapons != self.weapon_ids then
self.translucent_texts = true
end
end
for i in 0...@stored_armors.size
if i+1 != equip_type and
@stored_armors != self.armor_ids then
self.translucent_texts[self.weapon_slots.size + i] = true
end
end
@equip_type_force = nil
copy = self.translucent_texts.dup
self.weapon_ids = @stored_weapons
self.armor_ids = @stored_armors
self.translucent_texts = copy
end
#--------------------------------------------------------------------------
# * Switch Items. Switches equipment to fool a player.
# equip_type : type of equipment
# id : id
#--------------------------------------------------------------------------
def switch_items(equip_type,id)
if self.cursed?(equip_type) == false then
if equip_type == 0 or equip_type > [self.armor_slots.size,4].max
for i in 0...SWITCH_EQUIP_WEAPONS.size
if SWITCH_EQUIP_WEAPONS[0] == id then
$game_party.lose_weapon(SWITCH_EQUIP_WEAPONS[0], 1)
$game_party.gain_weapon(SWITCH_EQUIP_WEAPONS[1], 1)
id = SWITCH_EQUIP_WEAPONS[1]
end
end
else
for i in 0...SWITCH_EQUIP_ARMORS.size
if SWITCH_EQUIP_ARMORS[0] == id then
$game_party.lose_armor(SWITCH_EQUIP_ARMORS[0], 1)
$game_party.gain_armor(SWITCH_EQUIP_ARMORS[1], 1)
id = SWITCH_EQUIP_ARMORS[1]
end
end
end
end
return id
end
#--------------------------------------------------------------------------
# * Enough Hands? Returns if there are enough hands to hold a weapon
# equip_type : type of equipment
# id : ID
#--------------------------------------------------------------------------
def enough_hands?(equip_type, id)
# Enough Hand = true if you unequip something
if id == 0 then return true end
# If it's a weapon
if equip_type == 0 or equip_type > [self.armor_slots.size ,4].max
nb = $data_weapons[id].nb_hands
elsif self.weapon_shield_share and self.armor_slots[equip_type-1] == self.shield_hand_slot
nb = 1
else
return true #return true if not shield or weapon
end
nb_s = 0 #nb shield slots
if self.shield_hand_wield then
for i in 0...self.armor_slots.size
if self.armor_slots == self.shield_hand_slot
if self.weapon_shield_share != true then nb_s += 1 end
if self.cursed?(i+1) then nb += 1 end
end
end
end
if self.weapon_hand_wield
if self.cursed?(0) then # Penalities if can't remove first weapon
nb = nb + $data_weapons[self.weapon_ids[0]].nb_hands
end
for i in 1...self.weapon_slots.size # Penalities if cant remove weapon
if self.cursed?(self.armor_slots.size + i)
nb = nb + $data_weapons[self.weapon_ids].nb_hands
end
end
end
if nb == 1 then # If it only takes 1 hand to hold
return true
elsif nb > nb_s+1 and self.weapon_hand_wield != true
return false
elsif nb > self.weapon_slots.size+ nb_s and self.weapon_hand_wield
return false
elsif self.shield_hand_wield != true and self.weapon_hand_wield != true
return false
else
return true
end
end
#--------------------------------------------------------------------------
# * Equip Weapon
# index : Index of weapon
# id : weapon ID (If 0, remove equipment)
#--------------------------------------------------------------------------
def equip_weapon(index,id)
if index == 0 then
self.equip(0, id)
else
self.equip([self.armor_slots.size, 4].max + index, id)
end
end
#--------------------------------------------------------------------------
# * Equip Armor
# index : Index of armor
# id : armor ID (If 0, remove equipment)
#--------------------------------------------------------------------------
def equip_armor(index, id)
self.equip(index+1, id)
end
#--------------------------------------------------------------------------
# * Equip Extra Items
# equip_type : Index of item being equipped
# id : ID if either armor or weapon (If 0, remove equipment)
#--------------------------------------------------------------------------
def equip_extra(equip_type,id)
# If its an extra armor slot
if equip_type <= [self.armor_slots.size,4].max
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[self.armor_ids[equip_type-1]], $data_armors[id])
$game_party.gain_armor(self.armor_ids[equip_type-1], 1)
self.armor_ids[equip_type-1] = id
$game_party.lose_armor(id, 1)
end
# If its a weapon slot
else
if id == 0 or $game_party.weapon_number(id) > 0
equip_type = equip_type - [self.armor_slots.size, 4].max
weapon = self.weapon_ids[equip_type]
if weapon != nil then
$game_party.gain_weapon(weapon, 1)
end
self.weapon_ids[equip_type] = id
$game_party.lose_weapon(id, 1)
end
end
end
#--------------------------------------------------------------------------
# * Fix Multi-Handed Weapons
# equip_keep : ID of weapon to keep
#--------------------------------------------------------------------------
def fix_handed_weapons(equip_keep=nil)
array_wield_hands = Array.new # Stores the slot of the weapon that
# needs empty hands
nb_emp_hands = 0 # Store nb of empty hands
penalities = 0 # Stores extra hand required
save_force = @equip_type_force
save_menu = @equip_from_menu
@equip_from_menu = false
@equip_type_force = nil
if self.shield_hand_wield
for narmor in 0...self.armor_slots.size
if self.armor_slots[narmor] == self.shield_hand_slot
if self.weapon_shield_share == true then
penalities += 1
end
if self.armor_ids[narmor] == 0 then
nb_emp_hands += 1 # Stores empty shield hand
end
end
end
end
for nweapon in 0...self.weapon_slots.size
if self.weapon_ids[nweapon] == 0
if self.weapon_hand_wield then
nb_emp_hands += 1
end
else
array_wield_hands.push(nweapon) # Stores the hand to wield weapon
end
end
for nweapon in Rg(array_wield_hands.size-1, 0, -1)
if self.weapon_ids[array_wield_hands[nweapon]] != 0 then
nb_hands = $data_weapons[self.weapon_ids[array_wield_hands[nweapon]]].nb_hands
nb_hands += penalities
penalities = 0
save_hands = nb_hands
end
# If it finds an empty hand
while nb_emp_hands != 0 and nb_hands > 1
# Decrease the counter
nb_hands += -1
nb_emp_hands += -1
end
#if shield needs to be removed for empty hand
if self.shield_hand_wield then
for namor in 0...self.armor_slots.size
if nb_hands > 1 and self.armor_ids[namor] != 0 and
self.armor_slots[namor] == self.shield_hand_slot and
namor+1 != equip_keep and self.cursed?(namor+1) == false then
nb_hands += -1
self.equip(namor+1,0)
end
end
end
#if it must remove weapons to make room for empty hands
if self.weapon_hand_wield == true then
for nhand in Rg(self.weapon_slots.size-1, 0, -1)
if nb_hands > 1 and self.weapon_ids[nhand] != 0
if nhand == 0 then
if equip_keep != 0 and self.cursed?(0) == false then
n = nb_emp_hands
nb_emp_hands += $data_weapons[self.weapon_ids[nhand]].nb_hands
n = nb_emp_hands - n
self.equip(0,0)
end
else
if nhand+[self.armor_slots.size,4].max != equip_keep and
self.cursed?(nhand+[self.armor_slots.size,4].max) == false
then
if nhand < array_wield_hands[nweapon] then
nb_emp_hands += 1
else
nb_emp_hands += $data_weapons[self.weapon_ids[nhand]].nb_hands
end
self.equip([self.armor_slots.size,4].max+nhand, 0)
end
end # End of ( if nhnad == 0 )
end # End of ( if nb_hands != 1 )
while nb_emp_hands != 0 and nb_hands > 1
#if it finds empty hand
nb_hands += -1 #decrease counter
nb_emp_hands += -1
end
end # End of ( for nahand )
end # End of ( if self.weapon )
# If still can't find a slot, remove the weapon
if nb_hands > 1
if array_wield_hands[nweapon] == 0 and self.cursed?(0) == false then
nb_emp_hands = 1 + nb_emp_hands + save_hands - nb_hands
self.equip(0, 0)
elsif self.cursed?(array_wield_hands[nweapon]+[self.armor_slots.size,4].max) == false and
array_wield_hands[nweapon] != 0 then
nb_emp_hands = 1 + nb_emp_hands + save_hands - nb_hands
self.equip(array_wield_hands[nweapon]+[self.armor_slots.size,4].max,0)
end
end
# If it finds an empty hand
while nb_emp_hands != 0 and nb_hands > 1
# Decrease the counter
nb_hands += -1
nb_emp_hands += -1
end
# If STILL not enough hands
if nb_hands > 1 then
# Remove the item the user tried to equip
self.equip(equip_keep,0)
end
end
@equip_type_force = save_force # Returns old equip_type_force
@equip_from_menu = save_menu # Return old equip_from_menu
end
#--------------------------------------------------------------------------
# * Cursed Items
# equip_type : ID if either armor or weapon
#--------------------------------------------------------------------------
def cursed?(equip_type)
if equip_type == 0
weapon_id = self.weapon_ids[0]
if weapon_id != 0 and $data_weapons[weapon_id].cursed then return true end
# If Armor
elsif equip_type <= self.armor_slots.size
armor_id = self.armor_ids[equip_type - 1]
if armor_id != 0 and $data_armors[armor_id].cursed then return true end
else
weapon_id = self.weapon_ids[equip_type - [self.armor_slots.size, 4].max]
if weapon_id != nil and weapon_id != 0 and $data_weapons[weapon_id].cursed then return true end
end
return false
end
#--------------------------------------------------------------------------
# * Remove all cursed items
#--------------------------------------------------------------------------
def remove_curse
self.equip_type_force = nil
for i in 0...(self.weapon_slots.size + self.armor_slots.size)
if self.cursed?(i) then self.equip(i,0) end
end
end
#--------------------------------------------------------------------------
# * Order Armor IDs for Slots
#--------------------------------------------------------------------------
def order_armor_ids
equipment_array = Array.new
for i in 0...self.armor_ids.size
if self.armor_ids != nil and self.armor_ids != 0
kind = $data_armors[self.armor_ids].kind
if equipment_array[kind] == nil then
equipment_array[kind] = Array.new
end
equipment_array[kind].push(self.armor_ids)
#array in which 0 = array for shield, 1 = array for helmet,
#2 = array for armor and 3 = array for accessory, etc
end
end
self.armor_ids = nil # Remove all armors
armors = Array.new
for i in 0...self.armor_slots.size
aitem = nil
if equipment_array[(self.armor_slots)-1] == nil then
equipment_array[(self.armor_slots)-1] = Array.new
end
while aitem == nil and equipment_array[(self.armor_slots)-1].size != 0
aitem = equipment_array[(self.armor_slots)-1].delete_at(0)
if aitem == 0 then aitem = nil end
end
if aitem != nil then
armors.push(aitem) # Adds armor
else
armors.push(0) # Adds empty
end # End of ( if iaitem != nil )
end # End of ( for i in )
self.armor_ids = armors
end
#--------------------------------------------------------------------------
# * Change Weapon Slots
# array : Array for weapon slots
#--------------------------------------------------------------------------
def weapon_slots=(array) # Change slots of weapons
if array == nil then array = WEAPON_KINDS end # Use default slots
weapon_array = Array.new(self.weapon_ids) # Save weapons
self.weapon_ids = nil
@weapon_slots = Array.new(array) # New slots
self.weapon_ids = weapon_array # Re-equip items
i = self.weapon_ids.size
while self.nb_offhand_required > 1
if self.weapon_ids != nil and self.weapon_ids != 0 then
self.equip_weapon(i,0)
end
i = i-1
end
end
#--------------------------------------------------------------------------
# * Change Armor Slots
# array : Array for armor slots
#--------------------------------------------------------------------------
def armor_slots=(array) # change slots of armor
if array == nil then array = ARMOR_KINDS end #returns to default if nothing
equipment_array = Array.new
for i in 0...[array.max, self.armor_slots.max].max+1
if equipment_array == nil then
equipment_array = Array.new
end
end
for i in 0...self.armor_ids.size
if self.armor_ids != nil and self.armor_ids != 0 then
kind = $data_armors[self.armor_ids].kind + 1
equipment_array[kind].push(self.armor_ids)
# Array in which 0 = array for shield, 1 = array for helmet,
# 2 = array for armor and 3 = array for accessory, etc
end
end
for kind in 0...[array.max, self.armor_slots.max].max+1
if array.include?(kind) and self.armor_slots.include?(kind) then
nb_i_new = 0
nb_i_old = 0
for i in 0...self.armor_slots.size
if self.armor_slots == kind then nb_i_old += 1 end
end
for i in 0...array.size
if array == kind then nb_i_new += 1 end
end
for i in nb_i_new...nb_i_old
for k in 0...equipment_array[kind].size
index = equipment_array[kind].index(0)
if index != nil then
equipment_array[kind].delete_at(index)
end
end
end
end
end
self.armor_ids = nil # Remove items
@armor_slots = array # New array
for i in 0...self.armor_slots.size
aitem = nil
kind = self.armor_slots
if equipment_array[kind].size != 0
aitem = equipment_array[kind].delete_at(0)
self.equip(i+ 1,aitem) # Adds armor
else
self.equip(i+ 1,0)
end
end
end
#--------------------------------------------------------------------------
# * Set new array of weapons, if nil then it removes all weapon
# array : Array of weapon IDs
#--------------------------------------------------------------------------
def weapon_ids=(array) # Be careful. @item_type_force needs to be nil!
if array == nil then
self.equip(0, 0) # Remove first weapon
for i in 1...self.weapon_ids.size
self.equip(i + [self.armor_slots.size,4].max, 0 ) # Remove all weapons
end
return
end
self.weapon_ids = nil
for i in 0...self.weapon_slots.size
# Ensure no weapons are equipped
if array == nil then array = 0 end
if i == 0 then # If first weapon
self.equip(0, array) # Equip weapon
else # Else if extra weapons
self.equip(i + [self.armor_slots.size, 4].max, array)
end
end
end
#--------------------------------------------------------------------------
# * Set new array of armors in ordered fashion
# array : Array of armor IDs
#--------------------------------------------------------------------------
def armor_ids=(array)
if array == nil then
for i in 0...self.armor_slots.size
self.equip(i + 1, 0) # Remove all armors
end
return
end
self.armor_ids = nil # Remove all armors
for i in 0...self.armor_slots.size
self.equip(i+ 1, array) # Adds armor
end
end
#--------------------------------------------------------------------------
# * Return @armor_ids
#--------------------------------------------------------------------------
def armor_ids
# Returns ids with all armor, also store 4 armor
unless self.is_a?(Game_Actor)
return []
end
if @armor_ids == nil then @armor_ids = Array.new(self.armor_slots.size) end
ids = @armor_ids
ids[0] = @armor1_id
ids[1] = @armor2_id
ids[2] = @armor3_id
ids[3] = @armor4_id
# Ensure no nil values are returned
for i in 0...self.armor_slots.size
if ids == nil then ids = 0 end
end
return ids
end
#--------------------------------------------------------------------------
# * Return @Weapon_ids
#--------------------------------------------------------------------------
def weapon_ids
# Returns ids with all weapon, also store first weapon
unless self.is_a?(Game_Actor)
return []
end
if @weapon_ids == nil then @weapon_ids = Array.new(self.weapon_slots.size) end
ids = @weapon_ids
ids[0] = @weapon_id
# Ensure no nil values are returned
for i in 0...self.weapon_slots.size
if ids == nil then ids = 0 end
end
return ids
end
#--------------------------------------------------------------------------
# * Returns names of armor
#--------------------------------------------------------------------------
def armor_slot_names
# Return custom words for slots, or default ones
if @armor_slot_names == nil then @armor_slot_names = Array.new end
temp_array = Array.new(@armor_slot_names)
# Default names of slots
default_names = [$data_system.words.armor1,$data_system.words.armor2,$data_system.words.armor3,$data_system.words.armor4, self.extra_slot_names].flatten #default names of slots
for i in 0...default_names.size
if temp_array == nil then temp_array = default_names end # If not
# Custom then set as default
if temp_array == nil then temp_array = $data_system.words.armor4 end
end
return temp_array
end
#--------------------------------------------------------------------------
# * Returns names of weapons
#--------------------------------------------------------------------------
def weapon_slot_names
# Return custom words for weapon slots, of default ones
if @weapon_slot_names != nil then
temp_array = Array.new(@weapon_slot_names) # Use the custom values
else
temp_array = Array.new(self.weapon_slots.size) # Use default values
end
default_names = WEAPON_KIND_NAMES # Default names of slots
for i in 0...self.weapon_slots.size
# If... Set as Constant
if temp_array == nil then temp_array = default_names end
if temp_array == nil then temp_array = $data_system.words.weapon end
# If constant array is empty then use default one
end
return temp_array
end
#--------------------------------------------------------------------------
# * Return all element of all equipped armor
#--------------------------------------------------------------------------
def guard_element_set
# Return array with guard_element_set of all equipped armor
set = []
# Search all armor equipped
for id in self.armor_ids
next if id.nil?
armor = $data_armors[id]
# Add the element to set
set += (armor != nil ? armor.guard_element_set : [])
end
return set
end
#--------------------------------------------------------------------------
# * Return all equipment
#--------------------------------------------------------------------------
def equipments
# Return array with all equipment
equipments = []
self.weapon_ids.each {|id| equipments.push($data_weapons[id])}
self.armor_ids.each {|id| equipments.push($data_armors[id])}
return equipments
end
#--------------------------------------------------------------------------
# * Return if item is equiped
#--------------------------------------------------------------------------
def equiped?(item)
# Return if item is equipped, works with both armor and weapon
case item
when RPG::Weapon
return self.weapon_ids.include?(item.id)
when RPG::Armor
return self.armor_ids.include?(item.id)
else
return false
end
end
#--------------------------------------------------------------------------
# * Return list of weapons to use for attacks
#--------------------------------------------------------------------------
def attacks # This return an array with the list of all attacks of a character
# This takes in consideration extra weapon + number of attacks of
# each weapon
attacks = Array.new
for i in 0...self.weapon_ids.size
weapon = $data_weapons[self.weapon_ids]
# If the weapon is valid
if weapon != nil and weapon.atk != 0 then
for counter in 0...weapon.nb_attacks
attacks.push(i) #add attacks
end
end
end
# Give one unarmed attack if no weapons on
if attacks.size == 0 then attacks[0] = 0 end
return Array.new(attacks)
end
#--------------------------------------------------------------------------
# * Get the weapon to be used in attack
#--------------------------------------------------------------------------
def get_weapon_data
# This returns the weapon to use for the attack.
weaponid = self.weapon_ids[self.attacks[self.attack_count]]
weapon = $data_weapons[weaponid]
return weapon
end
#--------------------------------------------------------------------------
# * Get Offensive Animation ID for Normal Attacks
#--------------------------------------------------------------------------
def animation1_id
# Set animation for current weapon
weapon = self.get_weapon_data
return weapon != nil ? weapon.animation1_id : 0
end
#--------------------------------------------------------------------------
# * Get Target Animation ID for Normal Attacks
#--------------------------------------------------------------------------
def animation2_id
# Set animation for current weapon
weapon = self.get_weapon_data
return weapon != nil ? weapon.animation2_id : 0
end
#--------------------------------------------------------------------------
# * Get Basic Attack Power
# Get the atk to be used in attack ( or shown in menu screen )
#--------------------------------------------------------------------------
def base_atk
multiplier = nil
if $game_temp.in_battle and (self.current_action.kind == 0 or self.all_weapons_for_skills? != true)
# If in battle & doing a normal attack, only use one weapon's attack power
weapon = self.get_weapon_data
n = weapon != nil ? weapon.atk : 0
# Multiplier of hand as defined in self.weapon_slot_powers
if weapon != nil and weapon.nb_hands == 1 then
multiplier = self.weapon_slot_powers[self.attacks[self.attack_count]]
end
if multiplier == nil then multiplier = 100 end
n = n * (multiplier/100.0)
else # Use cumulative attack power of all weapons if in status screen or
# if using skill and all_weapons_for_skills == true
n = 0
for i in 0...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids]
atk = weapon != nil ? weapon.atk : 0
if weapon != nil and weapon.nb_hands == 1 then
multiplier = self.weapon_slot_powers
else
multiplier = nil
end
if multiplier == nil then multiplier = 100 end
atk = atk * (multiplier/100.0)
n += atk
end
end
nb_weap = 0
for i in 0...self.weapon_slots.size
if self.weapon_ids != nil and self.weapon_ids != 0
nb_weap = nb_weap + 1
end
end # Penality if more than 1 weapon
penality = self.multi_weapons_penality != nil ? self.multi_weapons_penality : 0
penality = penality /100.0
if nb_weap > 1 then n = n * ( 1 - penality ) end
return n
end
#--------------------------------------------------------------------------
# * Get Normal Attack Element
#--------------------------------------------------------------------------
def element_set
# Return elemental set of the current weapon
weapon = self.get_weapon_data
return weapon != nil ? weapon.element_set : []
end
#--------------------------------------------------------------------------
# * Get Normal Attack State Change (+)
#--------------------------------------------------------------------------
def plus_state_set
# Status the weapon can give
weapon = self.get_weapon_data
return weapon != nil ? weapon.plus_state_set : []
end
#--------------------------------------------------------------------------
# * Get Normal Attack State Change (-)
#--------------------------------------------------------------------------
def minus_state_set
# Status the weapon can remove
weapon = self.get_weapon_data
return weapon != nil ? weapon.minus_state_set : []
end
#--------------------------------------------------------------------------
# * Determine State Guard
# state_id : state ID
#--------------------------------------------------------------------------
def state_guard?(state_id)
# Return state defense of all armor
for i in self.armor_ids
armor = $data_armors
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
end
return false
end
#--------------------------------------------------------------------------
# * Get Element Revision Value
# element_id : element ID
#--------------------------------------------------------------------------
alias g7_ms_game_actor_element_rate element_rate
def element_rate(element_id)
result = g7_ms_game_actor_element_rate(element_id)
# Methods calculate bonus of extra weapon and armor
if self.armor_slots.size > 4
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids]
if armor != nil and armor.guard_element_set.include?(element_id)
result /= 2
end
end
end
return result
end
#--------------------------------------------------------------------------
# * Get Basic Strength
#--------------------------------------------------------------------------
alias g7_ms_game_actor_base_str base_str
def base_str
n = g7_ms_game_actor_base_str
for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids]
n += weapon != nil ? weapon.str_plus : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids]
n += armor != nil ? armor.str_plus : 0
end
return n
end
#--------------------------------------------------------------------------
# * Get Basic Dexterity
#--------------------------------------------------------------------------
alias g7_ms_game_actor_base_dex base_dex
def base_dex
n = g7_ms_game_actor_base_dex
for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids]
n += weapon != nil ? weapon.dex_plus : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids]
n += armor != nil ? armor.dex_plus : 0
end
return n
end
#--------------------------------------------------------------------------
# * Get Basic Agility
#--------------------------------------------------------------------------
alias g7_ms_game_actor_base_agi base_agi
def base_agi
n = g7_ms_game_actor_base_agi
for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids]
n += weapon != nil ? weapon.agi_plus : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids]
n += armor != nil ? armor.agi_plus : 0
end
return n
end
#--------------------------------------------------------------------------
# * Get Basic Intelligence
#--------------------------------------------------------------------------
alias g7_ms_game_actor_base_int base_int
def base_int
n = g7_ms_game_actor_base_int
for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids]
n += weapon != nil ? weapon.int_plus : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids]
n += armor != nil ? armor.int_plus : 0
end
return n
end
#--------------------------------------------------------------------------
# * Get Basic Physical Defense
#--------------------------------------------------------------------------
alias g7_ms_game_actor_base_pdef base_pdef
def base_pdef
n = g7_ms_game_actor_base_pdef
for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids]
n += weapon != nil ? weapon.pdef : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids]
n += armor != nil ? armor.pdef : 0
end
return n
end
#--------------------------------------------------------------------------
# * Get Basic Magic Defense
#--------------------------------------------------------------------------
alias g7_ms_game_actor_base_mdef base_mdef
def base_mdef
n = g7_ms_game_actor_base_mdef
for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids]
n += weapon != nil ? weapon.mdef : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids]
n += armor != nil ? armor.mdef : 0
end
return n
end
#--------------------------------------------------------------------------
# * Get Basic Evasion Correction
#--------------------------------------------------------------------------
alias g7_ms_game_actor_base_eva base_eva
def base_eva
n = g7_ms_game_actor_base_eva
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids]
n += armor != nil ? armor.eva : 0
end
return n
end
#--------------------------------------------------------------------------
# * Reset all slot data to default one
#--------------------------------------------------------------------------
def reset_all_slots
self.armor_slots = nil
self.weapon_slots = nil
self.armor_slot_names = nil
self.weapon_slot_names = nil
self.extra_slot_names = nil
self.weapon_slot_powers = nil
self.shield_hand_wield = nil
self.weapon_hand_wield = nil
self.shield_hand_slot = nil
self.weapon_shield_share = nil
self.multi_weapons_penality = nil
self.ignore_offhand = nil
self.all_weapons_for_skills = nil
end
#--------------------------------------------------------------------------
# * Returns behavior of items on character
#--------------------------------------------------------------------------
def weapon_shield_share
return @weapon_shield_share != nil ? @weapon_shield_share : WEAPON_SHIELD_SHARE
end
def weapon_slots
return @weapon_slots != nil ? @weapon_slots : WEAPON_KINDS
end
def armor_slots
return @armor_slots != nil ? @armor_slots : ARMOR_KINDS
end
def shield_hand_wield
return @shield_hand_wield != nil ? @shield_hand_wield : SHIELD_HAND_WIELD
end
def multi_weapons_penality
return @multi_weapons_penality != nil ? @multi_weapons_penality : MULTI_WEAPONS_PENALITY
end
def weapon_slot_powers
return @weapon_slot_powers != nil ? @weapon_slot_powers : WEAPON_KIND_POWERS
end
def weapon_hand_wield
return @weapon_hand_wield != nil ? @weapon_hand_wield : WEAPON_HAND_WIELD
end
def shield_hand_slot
return @shield_hand_slot != nil ? @shield_hand_slot : SHIELD_HAND_SLOT
end
def extra_slot_names
return @extra_slot_names != nil ? @extra_slot_names : EXTRA_SLOT_NAMES
end
def ignore_offhand?
return @ignore_offhand != nil ? @ignore_offhand : IGNORE_OFFHAND
end
def attack_count
# Returns number of attacks already made
return @attack_count != nil ? @attack_count : 0
end
def all_weapons_for_skills?
return @all_weapons_for_skills != nil ? @all_weapons_for_skills : ALL_WEAPONS_FOR_SKILLS
end
#--------------------------------------------------------------------------
# * Change behavior of items on character
#--------------------------------------------------------------------------
def multi_weapons_penality=(value)
@multi_weapons_penality = value
end
def weapon_slot_powers=(value)
@weapon_slot_powers = value
end
def weapon_shield_share=(bool)
@weapon_shield_share = bool
end
def shield_hand_slot=(int)
@shield_hand_slot = int
end
def shield_hand_wield=(bool)
@shield_hand_wield = bool
end
def weapon_hand_wield=(bool)
@weapon_hand_wield = bool
end
def ignore_offhand=(bool)
@ignore_offhand = bool
end
def all_weapons_for_skills=(bool)
@all_weapons_for_skills = bool
end
def attack_count=(value)
# Set number of attacks already made
@attack_count = value
end
#--------------------------------------------------------------------------
# * Change names for your slots
#--------------------------------------------------------------------------
def shield_name=(text)
# Set the shield slot name with...
# $game_actors[numberofactor].shield_name = 'Yourname'
@armor_slot_names[0] = text
end
def helmet_name=(text)
@armor_slot_names[1] = text
end
def armor_name=(text)
@armor_slot_names[2] = text
end
def accessory_name=(text)
@armor_slot_names[3] = text
end
def extra_slot_names=(array)
@extra_slot_names = array
end
def armor_slot_names=(array)
# Set a new array of names.
@armor_slot_names = array
end
def weapon_slot_names=(array)
# Set a new array of weapon names.
@weapon_slot_names = array
end
#--------------------------------------------------------------------------
# * End of CLASS: Game Actor
#--------------------------------------------------------------------------
end
#==============================================================================
# ** Game_Actors
#------------------------------------------------------------------------------
# This class handles the actor array. Refer to "$game_actors" for each
# instance of this class.
#==============================================================================
class Game_Actors
#--------------------------------------------------------------------------
# * Order Items
#--------------------------------------------------------------------------
def order_items
for actor in 0...@data.size
if @data[actor] != nil and @data[actor] != 0 then
# Order armors
@data[actor].order_armor_ids
end
end
end
#--------------------------------------------------------------------------
# * End of CLASS: Game Actors
#--------------------------------------------------------------------------
end