and what I made with this error?
Script'transitions module' line 660: RuntimeError ocurred.
LoadLibrary: rgss_addon
Script'transitions module' line 660: RuntimeError ocurred.
LoadLibrary: rgss_addon
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
>Call Common Event: call actor (The event that cause rise the char's level) (Basically uses a variable (average level) for save the level after of calculate the average level of the team)
>Change party member: [Character]
>Control Variables: [initial level] = [Character]'s level
>Conditional Branch: Variable [Initial Level] != Variable [Average Level]
>Control Variables: [Share points] += 5
>Control Variables: [Initial Level] +=1
: Branch End
>Change Level: [Character], + Variable [Average Level]
Script: $game_actor[id char].dp = $game_variables[Share points]
module BlizzCFG
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
STARTING_DP = 5
DP_PER_LEVEL = 5
STR_DP_COST = 1
DEX_DP_COST = 1
AGI_DP_COST = 1
INT_DP_COST = 1
AUTO_CALL = false
AUTO_MAP_CALL = false
DISPLAY_ICON = true
OWN_ICON = false
ICON_X = 612
ICON_Y = 452
ICON_OPACITY = 192
WINDOW_MODE = true
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# constants
STRLimit = 999
DEXLimit = 999
AGILimit = 999
INTLimit = 999
DPName = 'DP'
EvasionName = 'EVA'
EXPText = 'EXP'
NextText = 'next'
EquipmentText = 'Equipment'
AreYouSure = 'Are you sure?'
DistroCommands = ['Distribute DP', 'Next Character', 'Previous Character', 'Finish']
AreYouSureCommands = ['Cancel', 'Accept Changes', 'Discard Changes']
AttrLimits = [STRLimit, DEXLimit, AGILimit, INTLimit]
ExchangeRates = [STR_DP_COST,
DEX_DP_COST, AGI_DP_COST, INT_DP_COST]
ColorWhite = Color.new(255, 255, 255)
ColorBlack = Color.new(0, 0, 0)
ColorIcon = Color.new(0, 128, 255)
ColorIncreased = Color.new(0, 255, 0)
# ensures compatibility
$stat_system = 2.2
end
#==============================================================================
# Array
#==============================================================================
class Array
def sum
result = 0
self.each {|i| result += i if i.is_a?(Numeric)}
return result
end
end
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
attr_reader :dp
alias setup_sds_later setup
def setup(actor_id)
@dp = BlizzCFG::STARTING_DP
setup_sds_later(actor_id)
end
alias exp_sds_later exp=
def exp=(exp)
old_level = @level
exp_sds_later(exp)
value = (@level - old_level) * BlizzCFG::DP_PER_LEVEL
self.dp += value if value > 0
end
def dp=(value)
@dp = (value < 0 ? 0 : value)
end
end
#==============================================================================
# Window_Base
#==============================================================================
class Window_Base < Window
def draw_actor_battler(actor, x, y)
bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
cw, ch = bitmap.width, bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch / 2, bitmap, src_rect)
end
alias draw_actor_parameter_sds_later draw_actor_parameter
def draw_actor_parameter(actor, x, y, type)
if type == 7
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, BlizzCFG::EvasionName)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, actor.eva.to_s, 2)
else
draw_actor_parameter_sds_later(actor, x, y, type)
end
end
end
#==============================================================================
# Window_DistributionStatus
#==============================================================================
class Window_DistributionStatus < Window_Base
attr_reader :actor
def initialize(actor)
super(0, BlizzCFG::WINDOW_MODE ? 0 : 224, 640, 256)
@actor = actor
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
refresh
end
def actor=(actor)
@actor = actor
refresh
end
def refresh
self.contents.clear
unless @actor == nil
draw_actor_battler(@actor, 256, 120)
draw_actor_name(@actor, 4, 0)
draw_actor_class(@actor, 4, 32)
draw_actor_level(@actor, 4, 64)
self.contents.font.color = system_color
self.contents.draw_text(352, 16, 96, 32, BlizzCFG::EquipmentText)
draw_item_name($data_weapons[@actor.weapon_id], 352, 64)
draw_item_name($data_armors[@actor.armor1_id], 352, 96)
draw_item_name($data_armors[@actor.armor2_id], 352, 128)
draw_item_name($data_armors[@actor.armor3_id], 352, 160)
draw_item_name($data_armors[@actor.armor4_id], 352, 192)
self.contents.font.color = normal_color
draw_actor_parameter(@actor, 4, 96, 0)
draw_actor_parameter(@actor, 4, 128, 1)
draw_actor_parameter(@actor, 4, 160, 2)
draw_actor_parameter(@actor, 4, 192, 7)
end
end
end
#==============================================================================
# Window_DistributionPoints
#==============================================================================
class Window_DistributionPoints < Window_Base
attr_reader :actor
attr_reader :dp_left
def initialize(actor)
super(0, BlizzCFG::WINDOW_MODE ? 416 : 160, 224, 64)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.actor = actor
end
def actor=(actor)
@actor, @dp_left = actor, actor.dp
refresh
end
def set_dp(value)
@dp_left = actor.dp - value
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 32, 32, BlizzCFG::DPName)
self.contents.font.color = normal_color
self.contents.draw_text(36, 0, 152, 32, "#{@dp_left} / #{@actor.dp}", 2)
end
end
#==============================================================================
# Window_Distribution
#==============================================================================
class Window_Distribution < Window_Selectable
attr_reader :actor
attr_reader :spent
def initialize(actor)
super(224, BlizzCFG::WINDOW_MODE ? 256 : 0, 416, 224)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
@words = [$data_system.words.str, $data_system.words.dex, $data_system.words.agi,
$data_system.words.int]
@item_max = @words.size
self.actor = actor
self.active, self.index = false, 0
end
def actor=(actor)
@actor = actor
@current = [@actor.str, @actor.dex, @actor.agi,@actor.int]
@spent = [0, 0, 0, 0]
refresh
end
def active=(value)
super(value)
update_cursor_rect
end
def apply_new_attributes
@actor.str += (BlizzCFG::STR_DP_COST > 0 ?
@spent[0] / BlizzCFG::STR_DP_COST : @spent[0] * -BlizzCFG::STR_DP_COST)
@actor.dex += (BlizzCFG::DEX_DP_COST > 0 ?
@spent[1] / BlizzCFG::DEX_DP_COST : @spent[1] * -BlizzCFG::DEX_DP_COST)
@actor.agi += (BlizzCFG::AGI_DP_COST > 0 ?
@spent[2] / BlizzCFG::AGI_DP_COST : @spent[2] * -BlizzCFG::AGI_DP_COST)
@actor.int += (BlizzCFG::INT_DP_COST > 0 ?
@spent[3] / BlizzCFG::INT_DP_COST : @spent[3] * -BlizzCFG::INT_DP_COST)
@actor.dp -= @spent.sum
self.actor = @actor
end
def refresh
self.contents.clear
(0...@item_max).each {|i| draw_item(i)}
end
def draw_item(i)
y = i * 32
self.contents.fill_rect(0, y, self.contents.width, 32, Color.new(0, 0, 0, 0))
self.contents.font.color = system_color
self.contents.draw_text(4, y, 80, 32, @words[i])
self.contents.draw_text(344, y, 40, 32, BlizzCFG::DPName)
self.contents.draw_text(180, y, 12, 32, '/', 1)
self.contents.draw_text(192, y, 64, 32, @current[i].to_s)
self.contents.font.color = normal_color
if BlizzCFG::ExchangeRates[i] > 0
self.contents.draw_text(276, y, 64, 32,
BlizzCFG::ExchangeRates[i].to_s, 2)
elsif BlizzCFG::ExchangeRates[i] < 0
self.contents.draw_text(276, y, 64, 32,
"1/" + (-BlizzCFG::ExchangeRates[i]).to_s, 2)
end
font, self.contents.font.name = self.contents.font.name, 'Arial'
size, self.contents.font.size = self.contents.font.size, 32
bold, self.contents.font.bold = self.contents.font.bold, true
self.contents.draw_text(104, y - 2, 24, 32, '«')
self.contents.draw_text(244, y - 2, 24, 32, '»', 2)
self.contents.font.bold = bold
self.contents.font.size = size
self.contents.font.bold = bold
self.contents.font.color = BlizzCFG::ColorIncreased if @spent[i] > 0
current = @current[i]
if BlizzCFG::ExchangeRates[i] > 0
current = (@current[i] + @spent[i] / BlizzCFG::ExchangeRates[i])
elsif BlizzCFG::ExchangeRates[i] < 0
current = (@current[i] + @spent[i] * -BlizzCFG::ExchangeRates[i])
end
current = BlizzCFG::AttrLimits[i] if current > BlizzCFG::AttrLimits[i]
self.contents.draw_text(116, y, 64, 32, current.to_s, 2)
end
def add_points(value)
return false if value == 0
if BlizzCFG::ExchangeRates[index] > 0
limit = BlizzCFG::AttrLimits[index] -
(@current[index] + @spent[index] / BlizzCFG::ExchangeRates[index])
remaining = (@actor.dp - @spent.sum) / BlizzCFG::ExchangeRates[index]
limit = remaining if limit > remaining
value = limit if value > limit
elsif BlizzCFG::ExchangeRates[index] < 0
value *= -BlizzCFG::ExchangeRates[index]
limit = BlizzCFG::AttrLimits[index] -
(@current[index] + @spent[index] * -BlizzCFG::ExchangeRates[index])
remaining = (@actor.dp - @spent.sum) * -BlizzCFG::ExchangeRates[index]
limit = remaining if limit > remaining
value = limit if value > limit
spent = (value - BlizzCFG::ExchangeRates[index] - 1) /
-BlizzCFG::ExchangeRates[index]
end
if value > 0
if BlizzCFG::ExchangeRates[index] > 0
@spent[index] += value * BlizzCFG::ExchangeRates[index]
elsif BlizzCFG::ExchangeRates[index] < 0
@spent[index] += spent
end
return true
end
return false
end
def remove_points(value)
return false if value == 0
if BlizzCFG::ExchangeRates[index] > 0
limit = @spent[index] / BlizzCFG::ExchangeRates[index]
value = limit if value > limit
elsif BlizzCFG::ExchangeRates[index] < 0
value = @spent[index] if value > @spent[index]
spent = value
value *= -BlizzCFG::ExchangeRates[index]
end
if value > 0
if BlizzCFG::ExchangeRates[index] > 0
@spent[index] -= value * BlizzCFG::ExchangeRates[index]
elsif BlizzCFG::ExchangeRates[index] < 0
@spent[index] -= spent
end
return true
end
return false
end
def update
super
return unless self.active
if Input.press?(Input::R)
if Input.repeat?(Input::RIGHT)
if add_points(1)
$game_system.se_play($data_system.cursor_se)
draw_item(self.index)
else
$game_system.se_play($data_system.buzzer_se)
end
elsif Input.repeat?(Input::LEFT)
if remove_points(1)
$game_system.se_play($data_system.cursor_se)
draw_item(self.index)
else
$game_system.se_play($data_system.buzzer_se)
end
end
elsif Input.press?(Input::L)
if Input.repeat?(Input::RIGHT)
if add_points(1)
$game_system.se_play($data_system.cursor_se)
draw_item(self.index)
else
$game_system.se_play($data_system.buzzer_se)
end
elsif Input.repeat?(Input::LEFT)
if remove_points(1)
$game_system.se_play($data_system.cursor_se)
draw_item(self.index)
else
$game_system.se_play($data_system.buzzer_se)
end
end
elsif Input.repeat?(Input::RIGHT)
if add_points(1)
$game_system.se_play($data_system.cursor_se)
draw_item(self.index)
else
$game_system.se_play($data_system.buzzer_se)
end
elsif Input.repeat?(Input::LEFT)
if remove_points(1)
$game_system.se_play($data_system.cursor_se)
draw_item(self.index)
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
def update_cursor_rect
if @index < 0 || !self.active
self.cursor_rect.empty
else
super
end
end
end
#==============================================================================
# Window_Sure
#==============================================================================
class Window_Sure < Window_Command
def initialize(width, commands)
commands = commands.clone + ['']
super
@item_max, self.index = commands.size - 1, 0
self.x, self.y, self.z = 320 - self.width / 2, 240 - self.height / 2, 10000
refresh
end
def refresh
super
self.contents.font.color = system_color
self.contents.draw_text(4, 0, self.contents.width - 8, 32,
BlizzCFG::AreYouSure, 1)
end
def draw_item(i, color)
self.contents.font.color = color
rect = Rect.new(4, (i + 1) * 32, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[i], 1)
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(32, (@index + 1) * 32, self.contents.width - 64, 32)
end
end
end
#==============================================================================
# Scene_Points
#==============================================================================
class Scene_Points
def initialize(classe = $scene.class)
@scene = classe
end
def main
@command_window = Window_Command.new(224, BlizzCFG::DistroCommands)
@command_window.y = (BlizzCFG::WINDOW_MODE ? 256 : 0)
actor = $game_party.actors[0]
@status_window = Window_DistributionStatus.new(actor)
@distro_window = Window_Distribution.new(actor)
@dp_window = Window_DistributionPoints.new(actor)
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
@command_window.dispose
@status_window.dispose
@distro_window.dispose
@dp_window.dispose
end
def create_confirmation_window
@sure_window = Window_Sure.new(256, BlizzCFG::AreYouSureCommands)
end
def update
if @command_window.active
@command_window.update
update_main_command
elsif @sure_window != nil
@sure_window.update
update_confirmation
elsif @distro_window.active
@distro_window.update
update_distro
end
end
def update_main_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = @scene.new
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
if @command_window.index == 0
@command_window.active, @distro_window.active = false, true
elsif @distro_window.spent.sum > 0
@command_window.active = false
create_confirmation_window
else
@distro_window.index = 0
check_command_window
end
end
end
def update_confirmation
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@sure_window.dispose
@sure_window, @command_window.active = nil, true
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
if @sure_window.index > 0
@distro_window.apply_new_attributes if @sure_window.index == 1
check_command_window
end
@sure_window.dispose
@sure_window, @command_window.active = nil, true
end
end
def check_command_window
case @command_window.index
when 1
i = @status_window.actor.index + 1
i %= $game_party.actors.size
@status_window.actor = @distro_window.actor =
@dp_window.actor = $game_party.actors[i]
when 2
i = @status_window.actor.index + $game_party.actors.size - 1
i %= $game_party.actors.size
@status_window.actor = @distro_window.actor =
@dp_window.actor = $game_party.actors[i]
when 3
$scene = @scene.new
end
end
def update_distro
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active, @distro_window.active = true, false
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@command_window.active, @distro_window.active = true, false
elsif Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT)
@dp_window.set_dp(@distro_window.spent.sum)
end
end
end
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle
alias main_sds_later main
def main
main_sds_later
if BlizzCFG::AUTO_CALL &&
$game_party.actors.any? {|actor| actor.dp > 0}
$scene = Scene_Points.new
end
end
end
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map
alias main_sds_later main
def main
main_sds_later
@notify.dispose if @notify != nil
end
alias upd_sds_later update
def update
check_icon if BlizzCFG::DISPLAY_ICON
upd_sds_later
if BlizzCFG::AUTO_MAP_CALL &&
$game_party.actors.any? {|actor| actor.dp > 0}
$scene = Scene_Points.new
end
end
def check_icon
if $game_party.actors.any? {|actor| actor.dp > 0}
if @notify == nil
@notify = RPG::Sprite.new
if BlizzCFG::OWN_ICON
@notify.bitmap = RPG::Cache.icon(BlizzCFG::OWN_ICON)
else
@notify.bitmap = Bitmap.new(24, 24)
@notify.bitmap.fill_rect(0, 0, 24, 24, BlizzCFG::ColorWhite)
@notify.bitmap.fill_rect(22, 1, 2, 23, BlizzCFG::ColorBlack)
@notify.bitmap.fill_rect(1, 22, 23, 2, BlizzCFG::ColorBlack)
@notify.bitmap.set_pixel(23, 0, BlizzCFG::ColorBlack)
@notify.bitmap.set_pixel(0, 23, BlizzCFG::ColorBlack)
@notify.bitmap.fill_rect(2, 2, 20, 20, BlizzCFG::ColorIcon)
@notify.bitmap.fill_rect(4, 10, 16, 4, BlizzCFG::ColorWhite)
@notify.bitmap.fill_rect(10, 4, 4, 16, BlizzCFG::ColorWhite)
@notify.opacity = BlizzCFG::ICON_OPACITY
end
@notify.x, @notify.y = BlizzCFG::ICON_X, BlizzCFG::ICON_Y
@notify.z = 5000
@notify.blink_on
end
@notify.update
elsif @notify != nil
@notify.dispose
@notify = nil
end
end
end
#==============================================================================
# ** 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
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :name # name
attr_reader :character_name # character file name
attr_reader :character_hue # character hue
attr_reader :class_id # class ID
attr_reader :weapon_id # weapon ID
attr_reader :armor1_id # shield ID
attr_reader :armor2_id # helmet ID
attr_reader :armor3_id # body armor ID
attr_reader :armor4_id # accessory ID
attr_reader :level # level
attr_reader :exp # EXP
attr_reader :skills # skills
#--------------------------------------------------------------------------
# * Object Initialization
# actor_id : actor ID
#--------------------------------------------------------------------------
def initialize(actor_id)
super()
setup(actor_id)
end
#--------------------------------------------------------------------------
# * Setup
# actor_id : actor ID
#--------------------------------------------------------------------------
def setup(actor_id)
actor = $data_actors[actor_id]
@actor_id = actor_id
@name = actor.name
@character_name = actor.character_name
@character_hue = actor.character_hue
@battler_name = actor.battler_name
@battler_hue = actor.battler_hue
@class_id = actor.class_id
@weapon_id = actor.weapon_id
@armor1_id = actor.armor1_id
@armor2_id = actor.armor2_id
@armor3_id = actor.armor3_id
@armor4_id = actor.armor4_id
@level = actor.initial_level
@exp_list = Array.new(101)
make_exp_list
@exp = @exp_list[@level]
@skills = []
@hp = maxhp
@sp = maxsp
@states = []
@states_turn = {}
@maxhp_plus = 0
@maxsp_plus = 0
@str_plus = 0
@dex_plus = 0
@agi_plus = 0
@int_plus = 0
# Learn skill
for i in 1..@level
for j in $data_classes[@class_id].learnings
if j.level == i
learn_skill(j.skill_id)
end
end
end
# Update auto state
update_auto_state(nil, $data_armors[@armor1_id])
update_auto_state(nil, $data_armors[@armor2_id])
update_auto_state(nil, $data_armors[@armor3_id])
update_auto_state(nil, $data_armors[@armor4_id])
end
#--------------------------------------------------------------------------
# * Get Actor ID
#--------------------------------------------------------------------------
def id
return @actor_id
end
#--------------------------------------------------------------------------
# * Get Index
#--------------------------------------------------------------------------
def index
return $game_party.actors.index(self)
end
#--------------------------------------------------------------------------
# * Calculate EXP
#--------------------------------------------------------------------------
def make_exp_list
actor = $data_actors[@actor_id]
@exp_list[1] = 0
pow_i = 2.4 + actor.exp_inflation / 100.0
for i in 2..100
if i > actor.final_level
@exp_list[i] = 0
else
n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
@exp_list[i] = @exp_list[i-1] + Integer(n)
end
end
end
#--------------------------------------------------------------------------
# * Get Element Revision Value
# element_id : element ID
#--------------------------------------------------------------------------
def element_rate(element_id)
# Get values corresponding to element effectiveness
table = [0,200,150,100,50,0,-100]
result = table[$data_classes[@class_id].element_ranks[element_id]]
# If this element is protected by armor, then it's reduced by half
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
armor = $data_armors[i]
if armor != nil and armor.guard_element_set.include?(element_id)
result /= 2
end
end
# If this element is protected by states, then it's reduced by half
for i in @states
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
end
# End Method
return result
end
#--------------------------------------------------------------------------
# * Get State Effectiveness
#--------------------------------------------------------------------------
def state_ranks
return $data_classes[@class_id].state_ranks
end
#--------------------------------------------------------------------------
# * Determine State Guard
# state_id : state ID
#--------------------------------------------------------------------------
def state_guard?(state_id)
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
armor = $data_armors[i]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
end
return false
end
#--------------------------------------------------------------------------
# * Get Normal Attack Element
#--------------------------------------------------------------------------
def element_set
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.element_set : []
end
#--------------------------------------------------------------------------
# * Get Normal Attack State Change (+)
#--------------------------------------------------------------------------
def plus_state_set
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.plus_state_set : []
end
#--------------------------------------------------------------------------
# * Get Normal Attack State Change (-)
#--------------------------------------------------------------------------
def minus_state_set
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.minus_state_set : []
end
#--------------------------------------------------------------------------
# * Get Maximum HP
#--------------------------------------------------------------------------
def maxhp
n = [[base_maxhp + @maxhp_plus, 1].max, 9999].min
for i in @states
n *= $data_states[i].maxhp_rate / 100.0
end
n = [[Integer(n), 1].max, 9999].min
return n
end
#--------------------------------------------------------------------------
# * Get Basic Maximum HP
#--------------------------------------------------------------------------
def base_maxhp
return $data_actors[@actor_id].parameters[0, @level]
end
#--------------------------------------------------------------------------
# * Get Basic Maximum SP
#--------------------------------------------------------------------------
def base_maxsp
return $data_actors[@actor_id].parameters[1, @level]
end
#--------------------------------------------------------------------------
# * Get Basic Strength
#--------------------------------------------------------------------------
def base_str
n = $data_actors[@actor_id].parameters[2, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.str_plus : 0
n += armor1 != nil ? armor1.str_plus : 0
n += armor2 != nil ? armor2.str_plus : 0
n += armor3 != nil ? armor3.str_plus : 0
n += armor4 != nil ? armor4.str_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# * Get Basic Dexterity
#--------------------------------------------------------------------------
def base_dex
n = $data_actors[@actor_id].parameters[3, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.dex_plus : 0
n += armor1 != nil ? armor1.dex_plus : 0
n += armor2 != nil ? armor2.dex_plus : 0
n += armor3 != nil ? armor3.dex_plus : 0
n += armor4 != nil ? armor4.dex_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# * Get Basic Agility
#--------------------------------------------------------------------------
def base_agi
n = $data_actors[@actor_id].parameters[4, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.agi_plus : 0
n += armor1 != nil ? armor1.agi_plus : 0
n += armor2 != nil ? armor2.agi_plus : 0
n += armor3 != nil ? armor3.agi_plus : 0
n += armor4 != nil ? armor4.agi_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# * Get Basic Intelligence
#--------------------------------------------------------------------------
def base_int
n = $data_actors[@actor_id].parameters[5, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.int_plus : 0
n += armor1 != nil ? armor1.int_plus : 0
n += armor2 != nil ? armor2.int_plus : 0
n += armor3 != nil ? armor3.int_plus : 0
n += armor4 != nil ? armor4.int_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# * Get Basic Attack Power
#--------------------------------------------------------------------------
def base_atk
#Put here
n = $data_actors[@actor_id].parameters[2, @level]
weapon = $data_weapons[@weapon_id]
# Edited
return weapon != nil ? weapon.atk + n : n
# Original
# return weapon != nil ? weapon.atk : 0
end
#--------------------------------------------------------------------------
# * Get Basic Physical Defense
#--------------------------------------------------------------------------
#edit
def base_pdef
n = $data_actors[@actor_id].parameters[3, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
pdef1 = weapon != nil ? weapon.pdef : 0
pdef2 = armor1 != nil ? armor1.pdef : 0
pdef3 = armor2 != nil ? armor2.pdef : 0
pdef4 = armor3 != nil ? armor3.pdef : 0
pdef5 = armor4 != nil ? armor4.pdef : 0
return n + pdef1 + pdef2 + pdef3 + pdef4 + pdef5
end
#original
#end def base_pdef
# weapon = $data_weapons[@weapon_id]
# armor1 = $data_armors[@armor1_id]
# armor2 = $data_armors[@armor2_id]
# armor3 = $data_armors[@armor3_id]
# armor4 = $data_armors[@armor4_id]
# pdef1 = weapon != nil ? weapon.pdef : 0
# pdef2 = armor1 != nil ? armor1.pdef : 0
# pdef3 = armor2 != nil ? armor2.pdef : 0
# pdef4 = armor3 != nil ? armor3.pdef : 0
# pdef5 = armor4 != nil ? armor4.pdef : 0
# return pdef1 + pdef2 + pdef3 + pdef4 + pdef5
#end
#--------------------------------------------------------------------------
# * Get Basic Magic Defense
#--------------------------------------------------------------------------
def base_mdef
#Edit
n = $data_actors[@actor_id].parameters[5, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
mdef1 = weapon != nil ? weapon.mdef : 0
mdef2 = armor1 != nil ? armor1.mdef : 0
mdef3 = armor2 != nil ? armor2.mdef : 0
mdef4 = armor3 != nil ? armor3.mdef : 0
mdef5 = armor4 != nil ? armor4.mdef : 0
return n + mdef1 + mdef2 + mdef3 + mdef4 + mdef5
end
#Original
#def base_mdef
# weapon = $data_weapons[@weapon_id]
# armor1 = $data_armors[@armor1_id]
# armor2 = $data_armors[@armor2_id]
# armor3 = $data_armors[@armor3_id]
# armor4 = $data_armors[@armor4_id]
# mdef1 = weapon != nil ? weapon.mdef : 0
# mdef2 = armor1 != nil ? armor1.mdef : 0
# mdef3 = armor2 != nil ? armor2.mdef : 0
# mdef4 = armor3 != nil ? armor3.mdef : 0
# mdef5 = armor4 != nil ? armor4.mdef : 0
# return mdef1 + mdef2 + mdef3 + mdef4 + mdef5
#end
#--------------------------------------------------------------------------
# * Get Basic Evasion Correction
#--------------------------------------------------------------------------
def base_eva
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
eva1 = armor1 != nil ? armor1.eva : 0
eva2 = armor2 != nil ? armor2.eva : 0
eva3 = armor3 != nil ? armor3.eva : 0
eva4 = armor4 != nil ? armor4.eva : 0
return eva1 + eva2 + eva3 + eva4
end
#--------------------------------------------------------------------------
# * Get Offensive Animation ID for Normal Attacks
#--------------------------------------------------------------------------
def animation1_id
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.animation1_id : 0
end
#--------------------------------------------------------------------------
# * Get Target Animation ID for Normal Attacks
#--------------------------------------------------------------------------
def animation2_id
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.animation2_id : 0
end
#--------------------------------------------------------------------------
# * Get Class Name
#--------------------------------------------------------------------------
def class_name
return $data_classes[@class_id].name
end
#--------------------------------------------------------------------------
# * Get EXP String
#--------------------------------------------------------------------------
def exp_s
return @exp_list[@level+1] > 0 ? @exp.to_s : "-------"
end
#--------------------------------------------------------------------------
# * Get Next Level EXP String
#--------------------------------------------------------------------------
def next_exp_s
return @exp_list[@level+1] > 0 ? @exp_list[@level+1].to_s : "-------"
end
#--------------------------------------------------------------------------
# * Get Until Next Level EXP String
#--------------------------------------------------------------------------
def next_rest_exp_s
return @exp_list[@level+1] > 0 ?
(@exp_list[@level+1] - @exp).to_s : "-------"
end
#--------------------------------------------------------------------------
# * Update Auto State
# old_armor : unequipped armor
# new_armor : equipped armor
#--------------------------------------------------------------------------
def update_auto_state(old_armor, new_armor)
# Forcefully remove unequipped armor's auto state
if old_armor != nil and old_armor.auto_state_id != 0
remove_state(old_armor.auto_state_id, true)
end
# Forcefully add unequipped armor's auto state
if new_armor != nil and new_armor.auto_state_id != 0
add_state(new_armor.auto_state_id, true)
end
end
#--------------------------------------------------------------------------
# * Determine Fixed Equipment
# equip_type : type of equipment
#--------------------------------------------------------------------------
def equip_fix?(equip_type)
case equip_type
when 0 # Weapon
return $data_actors[@actor_id].weapon_fix
when 1 # Shield
return $data_actors[@actor_id].armor1_fix
when 2 # Head
return $data_actors[@actor_id].armor2_fix
when 3 # Body
return $data_actors[@actor_id].armor3_fix
when 4 # Accessory
return $data_actors[@actor_id].armor4_fix
end
return false
end
#--------------------------------------------------------------------------
# * Change Equipment
# equip_type : type of equipment
# id : weapon or armor ID (If 0, remove equipment)
#--------------------------------------------------------------------------
def equip(equip_type, id)
case equip_type
when 0 # Weapon
if id == 0 or $game_party.weapon_number(id) > 0
$game_party.gain_weapon(@weapon_id, 1)
@weapon_id = id
$game_party.lose_weapon(id, 1)
end
when 1 # Shield
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor1_id], $data_armors[id])
$game_party.gain_armor(@armor1_id, 1)
@armor1_id = id
$game_party.lose_armor(id, 1)
end
when 2 # Head
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor2_id], $data_armors[id])
$game_party.gain_armor(@armor2_id, 1)
@armor2_id = id
$game_party.lose_armor(id, 1)
end
when 3 # Body
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor3_id], $data_armors[id])
$game_party.gain_armor(@armor3_id, 1)
@armor3_id = id
$game_party.lose_armor(id, 1)
end
when 4 # Accessory
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor4_id], $data_armors[id])
$game_party.gain_armor(@armor4_id, 1)
@armor4_id = id
$game_party.lose_armor(id, 1)
end
end
end
#--------------------------------------------------------------------------
# * Determine if Equippable
# item : item
#--------------------------------------------------------------------------
def equippable?(item)
# If weapon
if item.is_a?(RPG::Weapon)
# If included among equippable weapons in current class
if $data_classes[@class_id].weapon_set.include?(item.id)
return true
end
end
# If armor
if item.is_a?(RPG::Armor)
# If included among equippable armor in current class
if $data_classes[@class_id].armor_set.include?(item.id)
return true
end
end
return false
end
#--------------------------------------------------------------------------
# * Change EXP
# exp : new EXP
#--------------------------------------------------------------------------
def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
# Level up
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
# Learn skill
for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)
end
end
end
# Level down
while @exp < @exp_list[@level]
@level -= 1
end
# Correction if exceeding current max HP and max SP
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
#--------------------------------------------------------------------------
# * Change Level
# level : new level
#--------------------------------------------------------------------------
def level=(level)
# Check up and down limits
level = [[level, $data_actors[@actor_id].final_level].min, 1].max
# Change EXP
self.exp = @exp_list[level]
end
#--------------------------------------------------------------------------
# * Learn Skill
# skill_id : skill ID
#--------------------------------------------------------------------------
def learn_skill(skill_id)
if skill_id > 0 and not skill_learn?(skill_id)
@skills.push(skill_id)
@skills.sort!
end
end
#--------------------------------------------------------------------------
# * Forget Skill
# skill_id : skill ID
#--------------------------------------------------------------------------
def forget_skill(skill_id)
@skills.delete(skill_id)
end
#--------------------------------------------------------------------------
# * Determine if Finished Learning Skill
# skill_id : skill ID
#--------------------------------------------------------------------------
def skill_learn?(skill_id)
return @skills.include?(skill_id)
end
#--------------------------------------------------------------------------
# * Determine if Skill can be Used
# skill_id : skill ID
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
if not skill_learn?(skill_id)
return false
end
return super
end
#--------------------------------------------------------------------------
# * Change Name
# name : new name
#--------------------------------------------------------------------------
def name=(name)
@name = name
end
#--------------------------------------------------------------------------
# * Change Class ID
# class_id : new class ID
#--------------------------------------------------------------------------
def class_id=(class_id)
if $data_classes[class_id] != nil
@class_id = class_id
# Remove items that are no longer equippable
unless equippable?($data_weapons[@weapon_id])
equip(0, 0)
end
unless equippable?($data_armors[@armor1_id])
equip(1, 0)
end
unless equippable?($data_armors[@armor2_id])
equip(2, 0)
end
unless equippable?($data_armors[@armor3_id])
equip(3, 0)
end
unless equippable?($data_armors[@armor4_id])
equip(4, 0)
end
end
end
#--------------------------------------------------------------------------
# * Change Graphics
# character_name : new character file name
# character_hue : new character hue
# battler_name : new battler file name
# battler_hue : new battler hue
#--------------------------------------------------------------------------
def set_graphic(character_name, character_hue, battler_name, battler_hue)
@character_name = character_name
@character_hue = character_hue
@battler_name = battler_name
@battler_hue = battler_hue
end
#--------------------------------------------------------------------------
# * Get Battle Screen X-Coordinate
#--------------------------------------------------------------------------
def screen_x
# Return after calculating x-coordinate by order of members in party
if self.index != nil
return self.index * 160 + 80
else
return 0
end
end
#--------------------------------------------------------------------------
# * Get Battle Screen Y-Coordinate
#--------------------------------------------------------------------------
def screen_y
return 464
end
#--------------------------------------------------------------------------
# * Get Battle Screen Z-Coordinate
#--------------------------------------------------------------------------
def screen_z
# Return after calculating z-coordinate by order of members in party
if self.index != nil
return 4 - self.index
else
return 0
end
end
end