#==============================================================================
# ** Skill Leveling
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.2
# 12-25-2009
# RGSS / RPGMaker XP
# 번역 : 빗자루씨
#==============================================================================
#
# 소개:
#
# 이 시스템으로 스킬의 레벨을 연습과 함께 올릴수 있습니다.
# 점점 사용할수록 점점 스킬이 강해지는 것이죠. 그리고 스킬이 사용하는데
# 필요한 에너지도 줄어듭니다.
#
#
#------------------------------------------------------------------------------
#
# 스크립트 콜:
#
# -- 스킬 정보 입수 --
#
# 데이타 베이스를 보면 각자 어느레벨에 스킬이 있을겁니다.
# 예를들자면 1레벨때 힐, 3레벨때 파이어 뭐 그딴식으로요.
# 하지만 메뉴로 가지 않고 높은 수준의 기술, 또는 기술을
# 사용하여 낮은 비용에 대한 정보를 얻을 수있습니다.
# ( A real plus for scripters ):
#
# 각 캐릭터에게 정보를 주려면, 아래의 스크립트 콜을 쓰세요.
#
# 현재 스킬의 경험치:
# $game_actors[액터_id].skill_exp[액터_id]
#
# 현재 스킬의 레벨:
# $game_actors[액터_id].skill_level[액터_id]
#
# 현재 스킬의 에너지 사용량:
# $game_actors[액터_id].skill_sp_cost[액터_id]
#
# 현재 스킬의 파괴력:
# $game_actors[액터_id].skill_rate_power[액터_id]
#
# 현재 스킬의 명중률:
# $game_actors[액터_id].skill_rate_tohit[액터_id]
#
#
# 예를 들자면, 알렉스의 현재 크로스컷 스킬레벨을
# 디폴트 cmd에 출력시키는 스크립트 콜을 간단하게 말하자면:
#
# print $game_actors[1].skill_level[57]
#
#
# -------------------------------------------------------------------------
#
# -- 스킬 레벨 올리거나 내리기. --
#
# 전투로만 스킬의 레벨을 올릴 수 있는것은 아닙니다, 스크립트 콜을
# 이용해서도 가능해요. 비 전투성향 스킬을 올릴때에 이 스크립트 콜을
# 사용합니다. 세가지의 스크립트 콜을 당신은 사용할 수 있습니다.:
#
# skill_level_up(액터_id, 스킬_id)
# 이 스크립트 콜은 개별의 액터에게 스킬 레벨을 올릴수 있습니다.
# 그렇게 skill_level_up(1, 7) (데이터베이스에서 007. 파이어 임)
# 을 이용해 스킬을 레벨업 할수 있습니다.
#
# skill_level_down(액터_id, 스킬_id)
# 'skill_level_up'과 완전히 반대되는 콜입니다.
# 이 스크립트는 액터의 스킬 레벨을 내립니다.
# 사용법은 업과 똑같습니다.
#
# skill_level_set(액터_id, 스킬_id, 레벨)
# 이 스크립트는 스킬의 레벨을 유저가 원하는대로 설정할 수 있습니다.
# 당신이 원하는 수를 입력했을때, 스킬의 레벨은 당신이 입력한 숫자와 같은
# 레벨이 됩니다. 예제로는, skill_level_set(2, 61, 6) 페이질의 레그 스위프
# 의 레벨을 6으로 설정합니다.
#
#
#------------------------------------------------------------------------------
#
# 사용 조건:
#
# 무료로 사용가능하며, 모든 프로젝트에 이용이 가능합니다만.. 단지 크레딧을
# 타이틀에 남겨줬으면 하는 바람이 있군요 (웃음).
#
#
#==============================================================================
# 스위치(설정)
HIDE_1LEVEL = false # 레벨 1의 텍스트를 사용하는지 여부?
FIELD_ENABLED = true # 필드맵에서의 레벨링을 허용하는지 여부?
SKILL_ANIMS = true # 애니메이션 변경 여부?
SKILL_LV_UP = true # 레벨업 윈도우 팝업 여부?
# -------------------------------------------------------------------------
# LEVEL SUFFIX
SKILL_SUFFIX = "Lv" # 스킬에 붙는 텍스트 크기.
SKILL_SUFFIX_STYLE = 2 # 0 = 괄호, 1, 괄호, 2 = none
# 단어의 뜻은 같으나 []과 ()의 차이인가봅니다.
# -------------------------------------------------------------------------
# LEVELING POP-UP WINDOW
SKILL_LEVEL_SE = "056-Right02" # 레벨업시 SE
SKILL_LEVEL_FONT = "Arial Black" # 팝업 폰트 설정
SKILL_LEVEL_FONT_SIZE = 32 # 팝업 텍스트 크기
SKILL_LEVEL_FONT_COLOR = Color.new(255, 0, 0) # 팝업 텍스트 색상
# -------------------------------------------------------------------------
# 마스터 스킬 레벨 시스템:
# 스킬 마스터 레벨 설정
# ==============================
# 액터가 마스터할 수 있는 최대 레벨을 따로 정의합니다 :
# { 스킬_id => { 액터_id=>마스터레벨, 액터_id=>마스터레벨 ....}}
# 액터 ID가 '0' 으로 할당될시에, 따로 할당되지 않은 모든 액터에게
# 적용됩니다
# (57번 스킬은 크로스 컷입니다.)
SKILL_LEVEL_MAX = { 57 => { 0=>3, 1=>4} }
# 설명 : 크로스컷 => 알렉스=>레벨 3 마스터
# 레벨에 따른 커스텀 네임
# =============================================
# This system defines individual/custom names for leveled skills. It acts
# as a replacement if you do not want the traditional 'Skill (lv 3)' text
# to appear: syntax = { skill => {name list}, skill => {name list},... }
# The name list is as follows { skill_lvl => text, skill_lvl => text, ... }
# Each skill level starts off at 1 and increases. If there is no skill or
# skill level, the default text style will be used.
SKILL_LEVEL_NAMES = { 57 => { 1 => "Cross Cut", 2 => "Cross Cut Mk II", 3 => "Master Cut", 4 => "Tornado Cut", 5 => "Phoenix Cut" } }
# Define custom icons for skills based on level
# =============================================
# This system defines individual/custom icons for leveled skills. It merely
# replaces the skill's icon with a newer one based on the skill as you wish
# it to appear: syntax = { skill => {icon list}, skill => {icon list},... }
# The icon list is as follows { skill_lvl => icon, skill_lvl => icon, ... }
# Each skill level starts off at 1 and increases. If there is no skill or
# skill level, the default text style will be used.
SKILL_LEVEL_ICONS = { 57 => { 1 => "050-Skill07", 2 => "050-Skill07", 3 => "001-Weapon01", 4 => "044-Skill01", 5 => "037-Item06" } }
# Define custom anims for skills based on level
# =============================================
# This system defines individual/custom battle anims for leveled skills.
# Syntax: syntax = { skill => {anim list}, skill => {anim list},... }
# The animation list is as follows { lvl => array, lvl => array, ... }
# And each array holds two values, the user and target IDs of your battle
# animations.
SKILL_LEVEL_ANIMS = { 57 => { 1 => [5, 69], 2 => [11, 70] } }
# -------------------------------------------------------------------------
# SKILL GROWTH SYSTEM
# Define experience points needed per level per skill
# ===================================================
# This first system defines the basic number of experience points a skill
# must earn before attaining each level. The format is very much like the
# skill max level system: syntax = { skill => {list}, skill => {list},... }
# The actor list is as follows { actor_id => exp, actor_id => exp,... }
# If the actor ID is set to '0', then the experience points shown applies
# to all unlisted actors for that skill.
SKILL_EXP_POINTS = { 57 => { 0=>10, 1=>2} }
# Define experience point curve per skill (no curve if skill undefined)
# =====================================================================
# This system defines an escalating curve to the experience points needed
# for a skill to achieve each level. The format is very much like the
# skill pts system (above): syntax = { skill => {exp}, skill => {exp},... }
# The actor list is as follows { actor_id => exp, actor_id => exp,... }
# If the actor ID is set to '0', then the experience points shown applies
# to all unlisted actors for that skill.
SKILL_EXP_CURVE = { 58 => { 0=>0, 1=>5} }
# Using both SKILL_EXP_POINTS and SKILL_EXP CURVE with the supplied example
# would have the 'Cross Cut' skill go from LVL 1 to LVL 2 on 7 xp (2 + 5*1),
# LVL 3 after 14 xp (4 + 5*2), LVL 4 at 21 xp (6+ 5*3)
# -------------------------------------------------------------------------
# SKILL INCREASE/DECREASE RATES
# Defines the decreased SP cost per level of skill
# ================================================
# This system defines the number of SP points you save with each subsequent
# level. The higher the level of your spell, the lower your SP cost will
# be for each actor: syntax = { skill => {list}, skill => {list},... }
# The list is as follows { actor_id => SP saved , actor_id => SP saved, ... }
# If the actor ID is set to '0', then the saved SP cost applies to all
# unlisted actors.
SKILL_RATE_SP = { 57 => {0=>10}}
# Defines the increased power for each skill
# ==========================================
# This system defines the increase in power you can deliver with each sub-
# sequent level. The higher the level of your spell, the higher the damage
# will be delivered: syntax = { skill => {list}, skill => {list},... }
# The list is as follows { actor_id => increase, actor_id => increase, ... }
# If the actor ID is set to '0', then the spell power increase applies to
# all unlisted actors.
SKILL_RATE_POWER = { 57 => {1=>500}}
# Defines the increased chance to hit per level of skill
# ======================================================
# This system defines the increased chance you have to perform a successful
# skill effect. The higher the level of your spell, the higher the chance
# to perform a skill: syntax = { skill => {list}, skill => {list},... }
# The list is as follows { actor_id => increase, actor_id => increase, ... }
# If the actor ID is set to '0', then the spell's to hit chance applies to
# all unlisted actors.
SKILL_RATE_TOHIT = { 57 => {1=>50} }
#==============================================================================
# ** 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_accessor :skill_exp # Skill exp
attr_accessor :skill_level # Skill Level
attr_accessor :skill_sp_cost # Skill sp Adjustment
attr_accessor :skill_rate_power # Skill power adjustment
attr_accessor :skill_rate_tohit # Skill to hit adjustment
attr_accessor :skill_exp_list # Skill experience chart
attr_accessor :skill_level_pop # Leveling up flag
#--------------------------------------------------------------------------
# * Setup
# actor_id : actor ID
#--------------------------------------------------------------------------
alias setup_skill_levels setup
def setup(actor_id)
# Perform the original call
setup_skill_levels(actor_id)
# Create arrays for the actor's skills
@skill_exp = []
@skill_level = []
@skill_sp_cost = []
@skill_rate_power = []
@skill_rate_tohit = []
@skill_exp_list = []
# Skill Level Popup Flag
@skill_level_pop = false
# Cycle through skills and load the array
for id in 1...$data_skills.size
@skill_exp[id] = 0
@skill_level[id] = 0
@skill_sp_cost[id] = $data_skills[id].sp_cost
@skill_rate_power[id] = $data_skills[id].power
@skill_rate_tohit[id] = $data_skills[id].hit
@skill_exp_list[id] = make_skill_exp_list(actor_id, id)
end
end
#--------------------------------------------------------------------------
# * Calculate Skill EXP
#--------------------------------------------------------------------------
def make_skill_exp_list(actor_id, id)
# Obtain values to generate skill's experience curve
base_increment = skill_hash_acquire(SKILL_EXP_POINTS, actor_id, id )
experience_curve = skill_hash_acquire(SKILL_EXP_CURVE, actor_id, id )
level_limit = skill_hash_acquire(SKILL_LEVEL_MAX, actor_id, id )
# Generate curve based on figures
list = []
list[0] = 0
for lv in 1...level_limit+1
exp = 0
exp = list[lv-1] + experience_curve * lv + base_increment
list[lv] = exp.truncate
end
# Return the generated list
return list
end
end
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Determine Usable Skills
# skill_id : skill ID
#--------------------------------------------------------------------------
alias skill_level_skill_can_use? skill_can_use?
def skill_can_use?(skill_id)
# Perform the original call
effective = skill_level_skill_can_use?(skill_id)
# Unless usable skill
unless effective
# If there's not enough SP, the skill cannot be used.
if $data_skills[skill_id].sp_cost > self.sp
# For actors
if self.is_a?(Game_Actor)
skill_sp_cost = self.skill_sp_cost[skill_id]
# Reset effective to true if 'calculated' sp is enough.
effective = true if skill_sp_cost < self.sp
end
end
end
# Return effective
return effective
end
#--------------------------------------------------------------------------
# * Apply Skill Effects
# user : the one using skills (battler)
# skill : skill
#--------------------------------------------------------------------------
alias skill_level_skill_effect skill_effect
def skill_effect(user, skill)
# Set power and hit rate for actors
if user.is_a?(Game_Actor)
skill.power = user.skill_rate_power[skill.id]
skill.hit = user.skill_rate_tohit[skill.id]
end
# Perform the original call
effective = skill_level_skill_effect(user, skill)
# Use skill leveling system for actors
if user.is_a?(Game_Actor) and ($scene.is_a?(Scene_Battle) or FIELD_ENABLED)
skill_level_engine(user, skill)
end
return effective
end
#--------------------------------------------------------------------------
# * Skill Level Engine
# user : the one using skills (battler)
# skill : skill
#--------------------------------------------------------------------------
def skill_level_engine(user, skill)
return if user.is_a?(Game_Enemy)
# Increase EXP
user.skill_exp[skill.id] += 1
# Skill Max
level_limit = skill_hash_acquire(SKILL_LEVEL_MAX, user.id, skill.id)
# if the maximum skill level not reached
if user.skill_level[skill.id] < level_limit
# Retrieve skill experience list
exp_list = user.skill_exp_list[skill.id]
# If the skill reached enough points for a new skill level
if user.skill_exp[skill.id] == exp_list[user.skill_level[skill.id]+1]
# Increase the skill level
user.skill_level[skill.id] += 1
# Turn on level flag
user.skill_level_pop = true
# Adjust the new SP cost
skill_cost = skill_hash_acquire(SKILL_RATE_SP, user.id, skill.id)
user.skill_sp_cost[skill.id] -= skill.sp_cost * skill_cost / 100
user.skill_sp_cost[skill.id] = user.skill_sp_cost[skill.id].truncate
# SP consumption cannot be 0 or less
user.skill_sp_cost[skill.id] = 0 if user.skill_sp_cost[skill.id] < 0
# Adjust the new skill power
skill_rate_power = skill_hash_acquire(SKILL_RATE_POWER, user.id, skill.id)
user.skill_rate_power[skill.id] += skill.power * skill_rate_power / 100
user.skill_rate_power[skill.id] = user.skill_rate_power[skill.id].truncate
# Adjust skill accuracy
skill_rate_tohit = skill_hash_acquire(SKILL_RATE_TOHIT, user.id, skill.id)
user.skill_rate_tohit[skill.id] += skill.hit * skill_rate_tohit / 100
user.skill_rate_tohit[skill.id] = user.skill_rate_tohit[skill.id].truncate
# Hit Rate cannot be above 100
user.skill_rate_tohit[skill.id] = 100 if user.skill_rate_tohit[skill.id] > 100
end
end
end
#--------------------------------------------------------------------------
# * Skill Hash Acquisition System
# hash_array : hash value holding data
# user_id : the one using skills (battler)
# id : skill id
#--------------------------------------------------------------------------
def skill_hash_acquire(hash_array, user_id, id)
hash_temp = {}
skill_value = 0
hash_temp = hash_array[id] if hash_array[id] != nil
unless hash_temp == nil
skill_value = hash_temp[0] if hash_temp[0] != nil
skill_value = hash_temp[user_id] if hash_temp[user_id] != nil
end
return skill_value
end
end
#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
# This window displays usable skills on the skill and battle screens.
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
# Get skill
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))
# Acquire skill level
@actor.skill_level[skill.id] = 0 if @actor.skill_level[skill.id] == nil
# Obtain current skill icon based on skill level
name_icon = skill_name_acquire(SKILL_LEVEL_ICONS, skill, @actor.skill_level[skill.id])
name_icon = skill.icon_name if name_icon == nil
# Obtain the bitmap
bitmap = RPG::Cache.icon(name_icon)
opacity = self.contents.font.color == normal_color ? 255 : 128
# Draw Icon
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
# Obtain current skill name based on skill level
name_level = skill_name_acquire(SKILL_LEVEL_NAMES, skill, @actor.skill_level[skill.id])
if name_level == nil
name_level = skill.name
unless @actor.skill_level[skill.id] == 0 && HIDE_1LEVEL
case SKILL_SUFFIX_STYLE
when 0: name_level = skill.name + " ("+SKILL_SUFFIX+" " + (@actor.skill_level[skill.id]+1).to_s + ")"
when 1: name_level = skill.name + " ["+SKILL_SUFFIX+" " + (@actor.skill_level[skill.id]+1).to_s + "]"
when 2: name_level = skill.name + " "+SKILL_SUFFIX+" " + (@actor.skill_level[skill.id]+1).to_s
end
end
end
# Draw Name
self.contents.draw_text(x + 28, y, 204, 32, name_level, 0)
# Display revised SP Cost
@actor.skill_sp_cost[skill.id] = skill.sp_cost if @actor.skill_sp_cost[skill.id] == nil
self.contents.draw_text(x + 232, y, 48, 32, @actor.skill_sp_cost[skill.id].to_s, 2)
end
#--------------------------------------------------------------------------
# * Skill Name Acquisition System
# hash_array : hash value holding name data
# skill : skill
# level : Current level of the skill
#--------------------------------------------------------------------------
def skill_name_acquire(name_array, skill, level)
hash_temp = {}
skill_value = nil
hash_temp = name_array[skill.id] if name_array[skill.id] != nil
unless hash_temp == nil
skill_value = hash_temp[1] if hash_temp[1] != nil
skill_value = hash_temp[level+1] if hash_temp[level+1] != nil
end
return skill_value
end
end
#==============================================================================
# ** Window_Skill_Popup
#------------------------------------------------------------------------------
# This window is used to display a popup for leveled skills.
#==============================================================================
class Window_Skill_Popup < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(actor.screen_x-140, 260, 250, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
self.contents.font.name = SKILL_LEVEL_FONT
self.contents.font.size = SKILL_LEVEL_FONT_SIZE
self.contents.font.color = SKILL_LEVEL_FONT_COLOR
self.contents.draw_text(80, 0, 150, 32, "LEVEL UP!")
end
end
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# * Skill Level Up
# actor_id : Actor ID
# skill_id : Skill ID
#--------------------------------------------------------------------------
def skill_level_up(actor_id, skill_id)
actor = $game_actors[actor_id]
skill_level_set(actor_id, skill_id, actor.skill_level[skill_id]+1)
end
#--------------------------------------------------------------------------
# * Skill Level Down
# actor_id : Actor ID
# skill_id : Skill ID
#--------------------------------------------------------------------------
def skill_level_down(actor_id, skill_id)
actor = $game_actors[actor_id]
skill_level_set(actor_id, skill_id, actor.skill_level[skill_id]-1)
end
#--------------------------------------------------------------------------
# * Skill Level Setting
# actor_id : Actor ID
# skill_id : Skill ID
# level : Setting level
#--------------------------------------------------------------------------
def skill_level_set(actor_id, skill_id, level)
actor = $game_actors[actor_id]
skill = $data_skills[skill_id]
# Calculate positive or negative level adjustment
level_adjust = level - actor.skill_level[skill.id]
# Skill Max
level_limit = skill_hash_acquire(SKILL_LEVEL_MAX, actor.id, skill.id)
# Break if illegal level
return if level > level_limit or level < 0
# Level
actor.skill_level[skill.id] = level
# Reset Skill Experience
use_list = actor.skill_exp_list[skill.id]
actor.skill_exp[skill.id] = use_list[level]
# Adjust the new SP cost
skill_cost = (level_adjust * skill_hash_acquire(SKILL_RATE_SP, actor.id, skill.id))
actor.skill_sp_cost[skill.id] -= skill.sp_cost * skill_cost / 100
actor.skill_sp_cost[skill.id] = actor.skill_sp_cost[skill.id].truncate
# SP consumption cannot be 0 or less
actor.skill_sp_cost[skill.id] = 0 if actor.skill_sp_cost[skill.id] < 0
# Adjust the new skill power
skill_rate_power = (level_adjust * skill_hash_acquire(SKILL_RATE_POWER, actor.id, skill.id))
actor.skill_rate_power[skill.id] += skill.power * skill_rate_power / 100
actor.skill_rate_power[skill.id] = actor.skill_rate_power[skill.id].truncate
# Adjust skill accuracy
skill_rate_tohit = (level_adjust * skill_hash_acquire(SKILL_RATE_TOHIT, actor.id, skill.id))
actor.skill_rate_tohit[skill.id] += skill.hit * skill_rate_tohit / 100
actor.skill_rate_tohit[skill.id] = actor.skill_rate_tohit[skill.id].truncate
# Hit Rate cannot be above 100
actor.skill_rate_tohit[skill.id] = 100 if actor.skill_rate_tohit[skill.id] > 100
end
#--------------------------------------------------------------------------
# * Skill Hash Acquisition System
# hash_array : hash value holding data
# user_id : the one using skills (battler)
# id : skill id
#--------------------------------------------------------------------------
def skill_hash_acquire(hash_array, user_id, id)
hash_temp = {}
skill_value = 0
hash_temp = hash_array[id] if hash_array[id] != nil
unless hash_temp == nil
skill_value = hash_temp[0] if hash_temp[0] != nil
skill_value = hash_temp[user_id] if hash_temp[user_id] != nil
end
return skill_value
end
end
#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
# This class performs skill screen processing.
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# * Frame Update (when target window is active)
#--------------------------------------------------------------------------
alias skill_level_update_target update_target
def update_target
# Set the use flag
use_flag = false
# Obtain skill cost difference
current_skill_diff = @actor.skill_sp_cost[@skill.id] - @skill.sp_cost
# Perform the original call
skill_level_update_target
# If C button was pressed
if Input.trigger?(Input::C)
# If unable to use because SP ran out
use_flag = true if @actor.skill_can_use?(@skill.id)
# Perform if skill was usable
if use_flag
# Recalculate actor's SP
@actor.sp -= current_skill_diff
# Refresh windows
@target_window.refresh
@status_window.refresh
end
return
end
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias skill_level_update update
def update
if SKILL_LV_UP
if @active_battler.is_a?(Game_Actor) and @active_battler.skill_level_pop and @skillup
@skill_popup_window.contents_opacity -= 4
end
end
# Perform the original call
skill_level_update
end
#--------------------------------------------------------------------------
# * Make Skill Action Results
#--------------------------------------------------------------------------
alias skill_level_make_skill_action_result make_skill_action_result
def make_skill_action_result
# Obtain current effects prior to skill usage
if @active_battler.is_a?(Game_Actor)
# Get skill
@skill = $data_skills[@active_battler.current_action.skill_id]
# Obtain skill cost difference
current_skill_diff = @active_battler.skill_sp_cost[@skill.id]
# Obtain battle animations based on skill per level
@anime_1 = skill_animation_acquire(@skill, @active_battler.skill_level[@skill.id], 1)
@anime_2 = skill_animation_acquire(@skill, @active_battler.skill_level[@skill.id], 2)
# Obtain current skill name for help window
@active_battler.skill_level[@skill.id] = 0 if @active_battler.skill_level[@skill.id] == nil
name_level = skill_name_acquire(SKILL_LEVEL_NAMES, @skill, @active_battler.skill_level[@skill.id])
if name_level == nil
name_level = @skill.name
unless @active_battler.skill_level[@skill.id] == 0 && HIDE_1LEVEL
case SKILL_SUFFIX_STYLE
when 0: name_level = @skill.name + " ("+SKILL_SUFFIX+" " + (@active_battler.skill_level[@skill.id]+1).to_s + ")"
when 1: name_level = @skill.name + " ["+SKILL_SUFFIX+" " + (@active_battler.skill_level[@skill.id]+1).to_s + "]"
when 2: name_level = @skill.name + " "+SKILL_SUFFIX+" " + (@active_battler.skill_level[@skill.id]+1).to_s
end
end
end
end
# Perform the Original Call
skill_level_make_skill_action_result
# Apply reworked SP consumption and skill name
if @active_battler.is_a?(Game_Actor)
@active_battler.sp += @skill.sp_cost
@active_battler.sp -= current_skill_diff
@status_window.refresh
@help_window.set_text(name_level, 1)
end
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 2 : start action)
#--------------------------------------------------------------------------
alias skill_level_update_phase4_step2 update_phase4_step2
def update_phase4_step2
if SKILL_LV_UP
@active_battler.skill_level_pop = false if @active_battler.is_a?(Game_Actor)
@skillup = false
end
# Perform the original call
skill_level_update_phase4_step2
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 3 : animation for action performer)
#--------------------------------------------------------------------------
alias skill_level_update_phase4_step3 update_phase4_step3
def update_phase4_step3
if SKILL_LV_UP
if @active_battler.is_a?(Game_Actor) and @active_battler.skill_level_pop != false
@skillup = true
@skill_popup_window = Window_Skill_Popup.new(@active_battler)
if SKILL_LEVEL_SE != nil
Audio.se_play("Audio/SE/" + SKILL_LEVEL_SE)
sleep(0.4)
end
end
end
# Perform the original call
skill_level_update_phase4_step3
# Only if a skill is being performed
return unless @active_battler.current_action.kind == 1
# Only if an actor and changable animation
if @active_battler.is_a?(Game_Actor) and SKILL_ANIMS
# Reset animation to new animation
@active_battler.animation_id = @anime_1
end
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 4 : animation for target)
#--------------------------------------------------------------------------
alias skill_level_update_phase4_step4 update_phase4_step4
def update_phase4_step4
# Perform the original call
skill_level_update_phase4_step4
# Only if a skill is being performed
return unless @active_battler.current_action.kind == 1
# Only if an actor and changable animations
if @active_battler.is_a?(Game_Actor) and SKILL_ANIMS
# Animation for target
for target in @target_battlers
# Reset animation to new animation
target.animation_id = @anime_2
end
end
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 5 : damage display)
#--------------------------------------------------------------------------
alias update_phase4_step5_skillup update_phase4_step5
def update_phase4_step5
if SKILL_LV_UP
if @active_battler.is_a?(Game_Actor) and @skillup
@skill_popup_window.dispose
@active_battler.skill_level_pop = false
@skillup = false
end
end
# Perform the original call
update_phase4_step5_skillup
end
#--------------------------------------------------------------------------
# * Skill Animation Acquisition System
# hash_array : hash value holding name data
# skill : skill
# level : Current level of the skill
#--------------------------------------------------------------------------
def skill_animation_acquire(skill, level, index)
hash_temp = {}
skill_temp = []
case index
when 1: skill_value = @skill.animation1_id
when 2: skill_value = @skill.animation2_id
end
hash_temp = SKILL_LEVEL_ANIMS[skill.id] if SKILL_LEVEL_ANIMS[skill.id] != nil
unless hash_temp == nil
skill_temp = hash_temp[1] if hash_temp[1] != nil
skill_temp = hash_temp[level+1] if hash_temp[level+1] != nil
end
skill_value = skill_temp[index-1] if skill_temp[index-1] != nil
return skill_value
end
#--------------------------------------------------------------------------
# * Skill Name Acquisition System
# hash_array : hash value holding name data
# skill : skill
# level : Current level of the skill
#--------------------------------------------------------------------------
def skill_name_acquire(name_array, skill, level)
hash_temp = {}
skill_value = nil
hash_temp = name_array[skill.id] if name_array[skill.id] != nil
unless hash_temp == nil
skill_value = hash_temp[1] if hash_temp[1] != nil
skill_value = hash_temp[level+1] if hash_temp[level+1] != nil
end
return skill_value
end
end
양이 많아서 하루만에는 안될듯
귀차니즘이 너무나 심해서..