#==============================================================================
# ** Actor Bonuses
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 3
# 2007-01-28
# SDK : Version 2.0+, Part I
#------------------------------------------------------------------------------
# * Version History :
#
# Version 1 ---------------------------------------------------- (2006-03-12)
# Version 2 ---------------------------------------------------- (2006-09-20)
# - Update : Re-scripted Entire System
# Version 2.1 ------------------------------------------------- (2006-11-30)
# - Bug Fix : Fixed State Ranks Error
# Version 2.11 ------------------------------------------------ (2006-12-13)
# - Bug Fix : Fixed State Ranks Error
# Version 3 ---------------------------------------------------- (2007-01-28)
# - Updated Code Using Stat Bonus Base & SDK 2.0
#------------------------------------------------------------------------------
# * Requirements :
#
# Stat Bonus Base
#------------------------------------------------------------------------------
# * Description :
#
# This Script was designed to allow your characters to gain additional
# bonuses to their stats and elemental/state ranks. It allows you to gain
# bonuses based off : actor id, class id, equipment or skills (passive).
# You can control the bonuses to be either direct gains or percents (except
# element and state ranks modificatsion). If an direct and percent gain
# exist, the direct gain will take place first, then multiple by the percent.
#------------------------------------------------------------------------------
# * Instructions :
#
# Place The Script Below the SDK and Above Main.
# To Customize your bonuses, refer to the customization instructions.
#------------------------------------------------------------------------------
# * Customization :
#
# <Bonus_Type> = { <key> => { stat_bonus => bonus, ... } ... }
#
# The Following are list of constants and description of the bonus
#
# ActorBonuses_Direct / ActorBonuses_Percent
# - Description : Gains Bonuses Based Off Actor ID
# - Key : Actor ID
#
# ClassBonuses_Direct / ClassBonuses_Percent
# - Description : Gains Bonuses Based Off Class ID
# - Key : Class ID
#
# SkillBonuses_Direct / SkillBonuses_Percent
# - Description : Gains Bonuses Based Off Skill ID
# - Key : Skill ID
#
# WeaponBonuses_Direct / WeaponBonuses_Percent
# - Description : Gains Bonuses Based Off Weapon ID
# - Key : Weapon ID
#
# ArmorBonuses_Direct / ArmorBonuses_Percent
# - Description : Gains Bonuses Based Off Armor ID
# - Key : Armor ID
#
# ** Normal Stat Modifers
#
# 'maxhp', 'maxsp', 'str', 'dex', 'agi', 'int', 'atk', 'pdef', 'mdef',
# 'eva', 'hit', 'exp', 'gold'
#
# ** Special Modifers
# 'element' => { element_id => bonus }
# 'state' => { state_id => bonus }
#------------------------------------------------------------------------------
# * Syntax :
#
# Collect Bonus Gain For a Certain Stat
# Actor_Stat_Bonuses.calculate_bonus(<game_actor>, <stat_name>, base_value)
#
# or
#
# <game_actor>.seph_asb_<stat_name>_bonus
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Actor Bonuses', 'SephirothSpawn', 3.0, '2007-01-28')
SDK.check_requirements(2.0, [], {'Stat Bonus Base' => 1})
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.enabled?('Actor Bonuses')
#==============================================================================
# ** Actor_Stat_Bonuses
#==============================================================================
module Actor_Stat_Bonuses
#--------------------------------------------------------------------------
# * Stat Bonuses
#
# ~ Normal Stat Modifers
# 'maxhp', 'maxsp', 'str', 'dex', 'agi', 'int', 'atk', 'pdef', 'mdef',
# 'eva', 'hit', 'exp', 'gold'
#
# ~ Special Modifers (Note that there is no % bonus for element & states)
# 'element' => { element_id => bonus }
# 'state' => { state_id => bonus }
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Actor Bonuses
#
# ~ actor_id => { stat_bonus => bonus, ... }
#--------------------------------------------------------------------------
ActorBonuses_Direct = {
}
ActorBonuses_Percent = {
}
#--------------------------------------------------------------------------
# * Class Bonuses
#
# ~ class_id => { stat_bonus => bonus, ... }
#--------------------------------------------------------------------------
ClassBonuses_Direct = {
}
ClassBonuses_Percent = {
}
#--------------------------------------------------------------------------
# * Skill Bonuses (Passive)
#
# ~ skill_id => { stat_bonus => bonus, ... }
#--------------------------------------------------------------------------
SkillBonuses_Direct = {
}
SkillBonuses_Percent = {
}
#--------------------------------------------------------------------------
# * Weapon Bonuses
#
# ~ weapon_id => { stat_bonus => bonus, ... }
#--------------------------------------------------------------------------
WeaponBonuses_Direct = {
}
WeaponBonuses_Percent = {
}
#--------------------------------------------------------------------------
# * Armor Bonuses
#
# ~ armor_id => { stat_bonus => bonus, ... }
#--------------------------------------------------------------------------
ArmorBonuses_Direct = {
}
ArmorBonuses_Percent = {
}
#--------------------------------------------------------------------------
# * Sets Defaults For All Constants
#
# Do Not Alter his unless you know what you are doing
#--------------------------------------------------------------------------
[ActorBonuses_Direct, ActorBonuses_Percent, ClassBonuses_Direct,
ClassBonuses_Percent, SkillBonuses_Direct, SkillBonuses_Percent,
WeaponBonuses_Direct, WeaponBonuses_Percent, ArmorBonuses_Direct,
ArmorBonuses_Percent].each do |constant|
constant.default = {}
constant.default.default = 0
constant.default['element'] = {}
constant.default['element'].default = 0
constant.default['state'] = {}
constant.default['state'].default = 0
constant.keys.each do |key|
constant[key].default = 0
constant[key]['element'] = {} unless constant[key].has_key?('element')
constant[key]['element'].default = 0
constant[key]['state'] = {} unless constant[key].has_key?('state')
constant[key]['state'].default = 0
end
end
#--------------------------------------------------------------------------
# * Get Normal Bonuses (Direct)
#--------------------------------------------------------------------------
def self.get_normal_bonus_direct(actor, bonus_string)
# Starts Bonus Count
n = 0
# Adds Actor Bonus
n += ActorBonuses_Direct[actor.id][bonus_string]
# Adds Class Bonus
n += ClassBonuses_Direct[actor.class_id][bonus_string]
# Adds Skill Bonus
for skill_id in actor.skills
n += SkillBonuses_Direct[skill_id][bonus_string]
end
# Adds Weapon Bonus
n += WeaponBonuses_Direct[actor.weapon_id][bonus_string]
# Adds Armor Bonus
n += ArmorBonuses_Direct[actor.armor1_id][bonus_string]
n += ArmorBonuses_Direct[actor.armor2_id][bonus_string]
n += ArmorBonuses_Direct[actor.armor3_id][bonus_string]
n += ArmorBonuses_Direct[actor.armor4_id][bonus_string]
# Returns Bonus
return n
end
#--------------------------------------------------------------------------
# * Get Normal Bonuses (Percent)
#--------------------------------------------------------------------------
def self.get_normal_bonus_percent(actor, bonus_string)
# Starts Bonus Count
n = 0
# Adds Actor Bonus
n += ActorBonuses_Percent[actor.id][bonus_string]
# Adds Class Bonus
n += ClassBonuses_Percent[actor.class_id][bonus_string]
# Adds Skill Bonus
for skill_id in actor.skills
n += SkillBonuses_Percent[skill_id][bonus_string]
end
# Adds Weapon Bonus
n += WeaponBonuses_Percent[actor.weapon_id][bonus_string]
# Adds Armor Bonus
n += ArmorBonuses_Percent[actor.armor1_id][bonus_string]
n += ArmorBonuses_Percent[actor.armor2_id][bonus_string]
n += ArmorBonuses_Percent[actor.armor3_id][bonus_string]
n += ArmorBonuses_Percent[actor.armor4_id][bonus_string]
# Returns Bonus
return n
end
#--------------------------------------------------------------------------
# * Calculate Special Bonuses
#--------------------------------------------------------------------------
def self.calculate_special_bonus(actor, bonus_string, id)
# Starts Bonus Count
n = 0
# Adds Actor Bonus
n += ActorBonuses_Direct[actor.id][bonus_string][id]
# Adds Class Bonus
n += ClassBonuses_Percent[actor.class_id][bonus_string][id]
# Adds Skill Bonus
for skill_id in actor.skills
n += SkillBonuses_Percent[skill_id][bonus_string][id]
end
# Adds Weapon Bonus
n += WeaponBonuses_Percent[actor.weapon_id][bonus_string][id]
# Adds Armor Bonus
n += ArmorBonuses_Percent[actor.armor1_id][bonus_string][id]
n += ArmorBonuses_Percent[actor.armor2_id][bonus_string][id]
n += ArmorBonuses_Percent[actor.armor3_id][bonus_string][id]
n += ArmorBonuses_Percent[actor.armor4_id][bonus_string][id]
# Returns Bonus
return n
end
#--------------------------------------------------------------------------
# * Calculate Bonus
#--------------------------------------------------------------------------
def self.calculate_bonus(actor, bonus_string, base_value)
# Collects Direct Bonus
direct_bonus = self.get_normal_bonus_direct(actor, bonus_string)
# Collects Percent Bonus
percent_bonus = self.get_normal_bonus_percent(actor, bonus_string)
# Return Bonus
return Integer( ( base_value + direct_bonus ) *
( (100 + percent_bonus) / 100.0 ) ) - base_value
end
end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias_method :seph_statbonus_dmhpb, :direct_maxhp_bonus
alias_method :seph_statbonus_dmspb, :direct_maxsp_bonus
alias_method :seph_statbonus_dstrb, :direct_str_bonus
alias_method :seph_statbonus_ddexb, :direct_dex_bonus
alias_method :seph_statbonus_dagib, :direct_agi_bonus
alias_method :seph_statbonus_dintb, :direct_int_bonus
alias_method :seph_statbonus_datkb, :direct_atk_bonus
alias_method :seph_statbonus_devab, :direct_eva_bonus
alias_method :seph_statbonus_dhitb, :direct_hit_bonus
alias_method :seph_statbonus_dpdefb, :direct_pdef_bonus
alias_method :seph_statbonus_dmdefb, :direct_mdef_bonus
alias_method :seph_statbonus_pmhpb, :percent_maxhp_bonus
alias_method :seph_statbonus_pmspb, :percent_maxsp_bonus
alias_method :seph_statbonus_pstrb, :percent_str_bonus
alias_method :seph_statbonus_pdexb, :percent_dex_bonus
alias_method :seph_statbonus_pagib, :percent_agi_bonus
alias_method :seph_statbonus_pintb, :percent_int_bonus
alias_method :seph_statbonus_patkb, :percent_atk_bonus
alias_method :seph_statbonus_pevab, :percent_eva_bonus
alias_method :seph_statbonus_phitb, :percent_hit_bonus
alias_method :seph_statbonus_ppdefb, :percent_pdef_bonus
alias_method :seph_statbonus_pmdefb, :percent_mdef_bonus
alias_method :seph_statbonus_gmactr_er, :element_rate
alias_method :seph_statbonus_gmactr_sr, :state_ranks
alias_method :seph_statbonus_gmactr_exp=, :exp=
#--------------------------------------------------------------------------
# * Get Maximum HP
#--------------------------------------------------------------------------
def direct_maxhp_bonus
n = seph_statbonus_dmhpb
n += Actor_Stat_Bonuses.get_normal_bonus_direct(self, 'maxhp')
return n
end
def percent_maxhp_bonus
n = seph_statbonus_pmhpb
n += Actor_Stat_Bonuses.get_normal_bonus_percent(self, 'maxhp')
return n
end
#--------------------------------------------------------------------------
# * Get Maximum SP
#--------------------------------------------------------------------------
def direct_maxsp_bonus
n = seph_statbonus_dmspb
n += Actor_Stat_Bonuses.get_normal_bonus_direct(self, 'maxsp')
return n
end
def percent_maxsp_bonus
n = seph_statbonus_pmspb
n += Actor_Stat_Bonuses.get_normal_bonus_percent(self, 'maxsp')
return n
end
#--------------------------------------------------------------------------
# * Get Strength
#--------------------------------------------------------------------------
def direct_str_bonus
n = seph_statbonus_dstrb
n += Actor_Stat_Bonuses.get_normal_bonus_direct(self, 'str')
return n
end
def percent_str_bonus
n = seph_statbonus_pstrb
n += Actor_Stat_Bonuses.get_normal_bonus_percent(self, 'str')
return n
end
#--------------------------------------------------------------------------
# * Get Dexterity
#--------------------------------------------------------------------------
def direct_dex_bonus
n = seph_statbonus_ddexb
n += Actor_Stat_Bonuses.get_normal_bonus_direct(self, 'dex')
return n
end
def percent_dex_bonus
n = seph_statbonus_pdexb
n += Actor_Stat_Bonuses.get_normal_bonus_percent(self, 'dex')
return n
end
#--------------------------------------------------------------------------
# * Get Basic Agility
#--------------------------------------------------------------------------
def direct_agi_bonus
n = seph_statbonus_dagib
n += Actor_Stat_Bonuses.get_normal_bonus_direct(self, 'agi')
return n
end
def percent_agi_bonus
n = seph_statbonus_pagib
n += Actor_Stat_Bonuses.get_normal_bonus_percent(self, 'agi')
return n
end
#--------------------------------------------------------------------------
# * Get Basic Intelligence
#--------------------------------------------------------------------------
def direct_int_bonus
n = seph_statbonus_dintb
n += Actor_Stat_Bonuses.get_normal_bonus_direct(self, 'int')
return n
end
def percent_int_bonus
n = seph_statbonus_pintb
n += Actor_Stat_Bonuses.get_normal_bonus_percent(self, 'int')
return n
end
#--------------------------------------------------------------------------
# * Get Basic Attack Power
#--------------------------------------------------------------------------
def direct_atk_bonus
n = seph_statbonus_datkb
n += Actor_Stat_Bonuses.get_normal_bonus_direct(self, 'atk')
return n
end
def percent_atk_bonus
n = seph_statbonus_patkb
n += Actor_Stat_Bonuses.get_normal_bonus_percent(self, 'atk')
return n
end
#--------------------------------------------------------------------------
# * Get Basic Physical Defense
#--------------------------------------------------------------------------
def direct_pdef_bonus
n = seph_statbonus_dpdefb
n += Actor_Stat_Bonuses.get_normal_bonus_direct(self, 'pdef')
return n
end
def percent_pdef_bonus
n = seph_statbonus_ppdefb
n += Actor_Stat_Bonuses.get_normal_bonus_percent(self, 'pdef')
return n
end
#--------------------------------------------------------------------------
# * Get Basic Magic Defense
#--------------------------------------------------------------------------
def direct_mdef_bonus
n = seph_statbonus_dmdefb
n += Actor_Stat_Bonuses.get_normal_bonus_direct(self, 'mdef')
return n
end
def percent_mdef_bonus
n = seph_statbonus_pmdefb
n += Actor_Stat_Bonuses.get_normal_bonus_percent(self, 'mdef')
return n
end
#--------------------------------------------------------------------------
# * Get Basic Evasion Correction
#--------------------------------------------------------------------------
def direct_eva_bonus
n = seph_statbonus_devab
n += Actor_Stat_Bonuses.get_normal_bonus_direct(self, 'eva')
return n
end
def percent_eva_bonus
n = seph_statbonus_pevab
n += Actor_Stat_Bonuses.get_normal_bonus_percent(self, 'eva')
return n
end
#--------------------------------------------------------------------------
# * Get Hit Correction
#--------------------------------------------------------------------------
def direct_hit_bonus
n = seph_statbonus_dhitb
n += Actor_Stat_Bonuses.get_normal_bonus_direct(self, 'hit')
return n
end
def percent_hit_bonus
n = seph_statbonus_phitb
n += Actor_Stat_Bonuses.get_normal_bonus_percent(self, 'hit')
return n
end
#--------------------------------------------------------------------------
# * Get Element Revision Value
#--------------------------------------------------------------------------
def element_rate(element_id)
# Get Original Element Rate
n = seph_statbonus_gmactr_er(element_id)
# Adds Bonus
n += Actor_Stat_Bonuses.calculate_special_bonus(self, 'element',
element_id)
# Return Result
return n
end
#--------------------------------------------------------------------------
# * Get State Effectiveness
#--------------------------------------------------------------------------
def state_ranks
# Get Original State Ranks
ranks = seph_statbonus_gmactr_sr
# Pass Through All State Ranks
for i in 1...ranks.xsize
bonus = Actor_Stat_Bonuses.calculate_special_bonus(self, 'state', i)
ranks[i] += bonus
end
# Return Ranks
return ranks
end
#--------------------------------------------------------------------------
# * Change EXP
#--------------------------------------------------------------------------
def exp=(exp)
# If Gaining Exp
if (exp_gain = exp - @exp) > 0
# Collect Exp Bonus
# Add Bonus
exp += Actor_Stat_Bonuses.calculate_bonus(self, 'exp', exp_gain)
end
# Original Exp Set
self.seph_statbonus_gmactr_exp=(exp)
end
end
#==============================================================================
# ** Window_BattleResult
#==============================================================================
class Window_BattleResult < Window_Base
attr_accessor :gold
end
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Start After Battle Phase
#--------------------------------------------------------------------------
alias_method :seph_asb_scnbtl_sp5, :start_phase5
def start_phase5
# Original Start Battle Phase 5
seph_asb_scnbtl_sp5
# Read Gold Gained
gold = @result_window.gold
# Start Gold Gain Counters
direct_gain = 0
percent_gain = 0
for actor in $game_party.actors
unless actor.dead?
direct_gain += Actor_Stat_Bonuses.get_normal_bonus_direct(actor,
'gold')
percent_gain += Actor_Stat_Bonuses.get_normal_bonus_percent(actor,
'gold')
end
end
# Calculate Gold Increase
gold = Integer( ( gold + direct_gain ) *
( (100 + percent_gain) / 100.0 ) )
# Reset Gold Gain
@result_window.gold = gold
# Refresh Result Window
@result_window.refresh
end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end