#------------------------------------------------------------------------------
# CREDITS: Gando for making the script and khmp for helping with it.
#==============================================================================
PASSIVE_SKILLS = [138, 139]
#skill_id => [max_hp, max_sp, str, dex, agi, int, atk, pdef, mdef, gold, exp]
ATTRIBUTES =
{
138 => [0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0] ,
139 => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100] ,
}
GOLD_GAIN_PERCENT = true
EXP_GAIN_PERCENT = true
class Game_Actor < Game_Battler
alias passive_skill_learn learn_skill
alias passive_skill_forget forget_skill
#--------------------------------------------------------------------------
# * Get Actor ID
#--------------------------------------------------------------------------
def learn_skill(skill_id)
passive_skill_learn(skill_id)
if PASSIVE_SKILLS.include?(skill_id)
@maxhp_plus += ATTRIBUTES[skill_id][0]
@maxsp_plus += ATTRIBUTES[skill_id][1]
@str_plus += ATTRIBUTES[skill_id][2]
@dex_plus += ATTRIBUTES[skill_id][3]
@agi_plus += ATTRIBUTES[skill_id][4]
@int_plus += ATTRIBUTES[skill_id][5]
@atk_plus += ATTRIBUTES[skill_id][6]
@pdef_plus += ATTRIBUTES[skill_id][7]
@mdef_plus += ATTRIBUTES[skill_id][8]
@goldt += ATTRIBUTES[skill_id][9]
@expt += ATTRIBUTES[skill_id][10]
end
end
def forget_skill(skill_id)
passive_skill_forget(skill_id)
if PASSIVE_SKILLS.include?(skill_id)
@maxhp_plus -= ATTRIBUTES[skill_id][0]
@maxsp_plus -= ATTRIBUTES[skill_id][1]
@str_plus -= ATTRIBUTES[skill_id][2]
@dex_plus -= ATTRIBUTES[skill_id][3]
@agi_plus -= ATTRIBUTES[skill_id][4]
@int_plus -= ATTRIBUTES[skill_id][5]
@atk_plus -= ATTRIBUTES[skill_id][6]
@pdef_plus -= ATTRIBUTES[skill_id][7]
@mdef_plus -= ATTRIBUTES[skill_id][8]
@goldt -= ATTRIBUTES[skill_id][9]
@expt -= ATTRIBUTES[skill_id][10]
end
end
end
class Game_Battler
attr_accessor :goldt
attr_accessor :expt
alias parameter_init initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@atk_plus = 0
@pdef_plus = 0
@mdef_plus = 0
@goldt = 0
@expt = 0
parameter_init
end
#--------------------------------------------------------------------------
# * Get Attack
#--------------------------------------------------------------------------
def atk
n = [[base_atk + @atk_plus, 1].max, 999].min
for state in states do n *= state.atk_rate / 100.0 end
n = [[Integer(n), 1].max, 999].min
return n
end
#--------------------------------------------------------------------------
# * Get Defense
#--------------------------------------------------------------------------
def pdef
n = [[base_pdef + @pdef_plus, 1].max, 999].min
for i in @states
n *= $data_states[i].pdef_rate / 100.0
end
return Integer(n)
end
#--------------------------------------------------------------------------
# * Get Defense
#--------------------------------------------------------------------------
def mdef
n = [[base_mdef + @mdef_plus, 1].max, 999].min
for i in @states
n *= $data_states[i].mdef_rate / 100.0
end
return Integer(n)
end
#--------------------------------------------------------------------------
# * Set Attack
# new_atk : new attack
#--------------------------------------------------------------------------
def atk=(new_atk)
@atk_plus += new_atk - self.atk
@atk_plus = [[@atk_plus, -999].max, 999].min
end
#--------------------------------------------------------------------------
# * Set Defense
# new_def : new defense
#--------------------------------------------------------------------------
def pdef=(new_pdef)
@pdef_plus += new_pdef - self.pdef
@pdef_plus = [[@pdef_plus, -999].max, 999].min
end
#--------------------------------------------------------------------------
# * Set Defense
# new_def : new defense
#--------------------------------------------------------------------------
def mdef=(new_mdef)
@mdef_plus += new_mdef - self.mdef
@mdef_plus = [[@mdef_plus, -999].max, 999].min
end
end
class Scene_Battle
#--------------------------------------------------------------------------
# * Start After Battle Phase
#--------------------------------------------------------------------------
def start_phase5
# Shift to phase 5
@phase = 5
# Play battle end ME
$game_system.me_play($game_system.battle_end_me)
# Return to BGM before battle started
$game_system.bgm_play($game_temp.map_bgm)
# Initialize EXP, amount of gold, and treasure
exp = 0
gold = 0
treasures = []
# Loop
for enemy in $game_troop.enemies
# If enemy is not hidden
unless enemy.hidden
# Add EXP and amount of gold obtained
exp += enemy.exp
gold += enemy.gold
# Determine if treasure appears
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# Treasure is limited to a maximum of 6 items
treasures = treasures[0..5]
# Obtaining EXP
gold_mult = 0
exp_mult = 0
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
exp_mult += $game_party.actors[i].expt
end
if EXP_GAIN_PERCENT == true
exp += (exp * exp_mult == 0? 0: exp * exp_mult / 100).to_i
elsif EXP_GAIN_PERCENT == false
exp = (exp * exp_mult == 0? 0: exp * exp_mult).to_i
end
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
gold_mult += $game_party.actors[i].goldt
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
if GOLD_GAIN_PERCENT == true
gold += (gold * gold_mult == 0? 0: gold * gold_mult / 100).to_i
elsif GOLD_GAIN_PERCENT == false
gold = (gold * gold_mult == 0? 0: gold * gold_mult).to_i
end
# Obtaining gold
$game_party.gain_gold(gold)
# Obtaining treasure
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# Make battle result window
@result_window = Window_BattleResult.new(exp, gold, treasures)
# Set wait count
@phase5_wait_count = 100
end
end
#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
# This will hide the zero if the skill doesn't cost any SP.
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
if @data[index].sp_cost != 0
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
end
end