I want it removed if the charges = 0.
Click my buttons
CODE
#===============================================================================
#
# Shanghai Simple Script - Draw Skills
# Last Date Updated: 2010.06.15
# Level: Normal
#
# Final Fantasy 8 had a unique and interesting mechanic called Draw. It would
# take skills from the enemy unit and actors can then use it. They had a count
# to how many times that skill can be used until it ran out. This script allows
# the possibility to do the same thing and also improves upon it.
#
# Changes from actual Final Fantasy 8 Version
# - Some skills have restrictions on which classes can draw skills from it.
# - Drawing a skill from an enemy will teach the actor that skill.
# - Drawing a skill will give a set amount of charges.
# - Skills won't disappear when all of the charges are used up.
# - Skills will cost their MP amount after all of the charges are used up.
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials but above ▼ Main. Remember to save.
#
# <draw skill>
# <draw skill: x>
# These tags will turn the current skill into a draw skill. Draw skills will
# take skills from enemies. If the second tag is used, then x charges will be
# drawn from the enemy. If the second tag isn't used, then 10 charges are drawn.
#
# <draw class: x>
# <draw class: x, x, x>
# These tags will make it so that the current skill can only be drawn by class x
# and nothing else. If these tags aren't present, the skill can be drawn by all
# classes.
#
# <cannot draw>
# This tag will make the skill undrawable. Used for boss skills that you don't
# want the player to learn.
#===============================================================================
$imported = {} if $imported == nil
$imported["DrawSkills"] = true
module SSS
# This is the maximum amount of charges you can draw for your skills.
MAXIMUM_DRAW_CHARGES = 255
# This is how the text appears when charges are drawn.
DRAW_CHARGES_MSG = "%s has drawn %d×%s!"
DRAW_CHARGES_TEXT = "×%d"
DRAW_CHARGES_SIZE = 16
end
#==============================================================================
# RPG::Skill
#==============================================================================
class RPG::Skill < RPG::UsableItem
#--------------------------------------------------------------------------
# # Draw Skill
#--------------------------------------------------------------------------
def draw_skill
return @draw_skill if @draw_skill != nil
@draw_skill = 0
self.note.split(/[\r\n]+/).each { |line|
case line
when /<(?:DRAW_SKILL|draw skill)>/i
@draw_skill = 10
when /<(?:DRAW_SKILL|draw skill):[ ](\d+)>/i
@draw_skill = $1.to_i
end
}
return @draw_skill
end
#--------------------------------------------------------------------------
# # Draw Classes
#--------------------------------------------------------------------------
def draw_classes
return @draw_classes if @draw_classes != nil
@draw_classes = []
self.note.split(/[\r\n]+/).each { |line|
case line
when /<(?:DRAW_CLASS|draw class):[ ](\d+(?:\s*,\s*\d+)*)>/i
$1.scan(/\d+/).each { |num|
@draw_classes.push(num.to_i) if num.to_i > 0 }
end
}
if @draw_classes.empty?
for i in 1..$data_classes.size do @draw_classes.push(i) end
end
return @draw_classes
end
#--------------------------------------------------------------------------
# # Cannot Draw
#--------------------------------------------------------------------------
def cannot_draw
return @cannot_draw if @cannot_draw != nil
@cannot_draw = false
self.note.split(/[\r\n]+/).each { |line|
case line
when /<(?:CANNOT_DRAW|cannot draw)>/i
@cannot_draw = true
end
}
return @cannot_draw
end
end
#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Perform Skill Cost
#--------------------------------------------------------------------------
if $imported["BattleEngineMelody"]
alias perform_skill_cost_sss_draw_skills perform_skill_cost unless $@
def perform_skill_cost(skill)
return if skill == nil or !skill.is_a?(RPG::Skill)
if actor? and draw_skill_charges(skill) > 0
use_draw_charge(skill)
else
perform_skill_cost_sss_draw_skills(skill)
end
end
#--------------------------------------------------------------------------
# * Custom Skill Costs
#--------------------------------------------------------------------------
alias custom_skill_costs_sss_draw_skills custom_skill_costs unless $@
def custom_skill_costs(skill, type)
if actor? and draw_skill_charges(skill) > 0
charges = draw_skill_charges(skill)
case type
when :perform; return
when :calc_cost; return charges
when :text_cost; return sprintf(SSS::DRAW_CHARGES_TEXT, charges)
when :can_use; return true
when :use_icon; return 0
when :suffix; return "%s"
when :font_size; return SSS::DRAW_CHARGES_SIZE
when :colour; return 0
end
else
return custom_skill_costs_sss_draw_skills(skill, type)
end
end
else # Imported Battle Engine Melody
#--------------------------------------------------------------------------
# * Calculation of MP Consumed for Skills
#--------------------------------------------------------------------------
alias calc_mp_cost_sss_draw_skills calc_mp_cost unless $@
def calc_mp_cost(skill)
if actor? and draw_skill_charges(skill) > 0
return 0
else
return calc_mp_cost_sss_draw_skills(skill)
end
end
#--------------------------------------------------------------------------
# * Determine Usable Skills
#--------------------------------------------------------------------------
alias skill_can_use_sss_draw_skills skill_can_use? unless $@
def skill_can_use?(skill)
if actor? and draw_skill_charges(skill) > 0
return false unless skill.is_a?(RPG::Skill)
return false unless movable?
return false if silent? and skill.spi_f > 0
if $game_temp.in_battle
return skill.battle_ok?
else
return skill.menu_ok?
end
else
return skill_can_use_sss_draw_skills(skill)
end
end
end
end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Draw Skill Charges
#--------------------------------------------------------------------------
def draw_skill_charges(skill)
@draw_skills = {} if @draw_skills.nil?
@draw_skills[skill.id] = 0 if @draw_skills[skill.id].nil?
return @draw_skills[skill.id]
end
#--------------------------------------------------------------------------
# * Acquire Draw Skill
#--------------------------------------------------------------------------
def acquire_draw_skill(skill, charges)
@draw_skills = {} if @draw_skills.nil?
@draw_skills[skill.id] = 0 if @draw_skills[skill.id].nil?
@draw_skills[skill.id] += charges
@draw_skills[skill.id] = [@draw_skills[skill.id], 0].max
maximum = SSS::MAXIMUM_DRAW_CHARGES
@draw_skills[skill.id] = [@draw_skills[skill.id], maximum].min
learn_skill(skill.id)
clear_battle_cache if $imported["BattleEngineMelody"]
end
#--------------------------------------------------------------------------
# * Use Draw Charge
#--------------------------------------------------------------------------
def use_draw_charge(skill)
@draw_skills = {} if @draw_skills.nil?
@draw_skills[skill.id] = 0 if @draw_skills[skill.id].nil?
@draw_skills[skill.id] -= 1
@draw_skills[skill.id] = [@draw_skills[skill.id], 0].max
maximum = SSS::MAXIMUM_DRAW_CHARGES
@draw_skills[skill.id] = [@draw_skills[skill.id], maximum].min
end
#--------------------------------------------------------------------------
# * Determine Usable Skills
#--------------------------------------------------------------------------
def skill_can_use?(skill)
return super(skill)
end
end
#==============================================================================
# ** Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * Total Skills
#--------------------------------------------------------------------------
unless method_defined?(:total_skills)
def total_skills
result = []
for action in enemy.actions
next unless action.kind == 1
skill = $data_skills[action.skill_id]
result.push(skill) unless result.include?(skill)
end
result.sort! { |a,b| a.id <=> b.id }
return result.uniq
end
end
end
#==============================================================================
# ** Window_Skill
#==============================================================================
unless $imported["BattleEngineMelody"]
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
alias draw_item_sss_draw_skills draw_item unless $@
def draw_item(index)
skill = @data[index]
if skill != nil and @actor.draw_skill_charges(skill) > 0
rect = item_rect(index)
self.contents.clear_rect(rect)
rect.width -= 4
charges = @actor.draw_skill_charges(skill)
self.contents.font.size = Font.default_size
enabled = @actor.skill_can_use?(skill)
draw_item_name(skill, rect.x, rect.y, enabled)
text = sprintf(SSS::DRAW_CHARGES_TEXT, charges)
self.contents.font.size = SSS::DRAW_CHARGES_SIZE
self.contents.draw_text(rect, text, 2)
else
draw_item_sss_draw_skills(index)
end
end
end
end
#==============================================================================
# ** Window_Draw_Skill
#==============================================================================
class Window_Draw_Skill < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor, targets, help)
yy = help.y + help.height
super(0, yy, Graphics.width, Graphics.height-yy-128)
@actor = actor
@drawing_skill = @actor.action.skill
@targets = targets
@column_max = 2
self.index = 0
refresh
self.help_window = help
end
#--------------------------------------------------------------------------
# * Get Skill
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Total Skills
#--------------------------------------------------------------------------
def total_skills
return @data.size
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def refresh
@data = []
for target in @targets
next if target.actor?
for skill in target.total_skills
@data.push(skill) if include?(skill)
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Include Skill?
#--------------------------------------------------------------------------
def include?(skill)
return false if skill.cannot_draw
return false if @data.include?(skill)
return false unless skill.draw_classes.include?(@actor.class_id)
return true
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(skill == nil ? "" : skill.description)
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
self.contents.font.size = Font.default_size
draw_item_name(skill, rect.x, rect.y, true)
charges = @drawing_skill.draw_skill
text = sprintf(SSS::DRAW_CHARGES_TEXT, charges)
self.contents.font.size = SSS::DRAW_CHARGES_SIZE
self.contents.draw_text(rect, text, 2)
end
end
end
#==============================================================================
# ** Scene_Skill
#==============================================================================
unless $imported["BattleEngineMelody"]
class Scene_Skill < Scene_Base
#--------------------------------------------------------------------------
# * Use Skill (apply effects to non-ally targets)
#--------------------------------------------------------------------------
alias use_skill_nontarget_sss_draw_skills use_skill_nontarget unless $@
def use_skill_nontarget
@actor.use_draw_charge(@skill) if @actor.draw_skill_charges(@skill) > 0
use_skill_nontarget_sss_draw_skills
end
end
end
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Execute Battle Action: Skill
#--------------------------------------------------------------------------
alias execute_action_skill_sss_draw_skill execute_action_skill unless $@
def execute_action_skill
skill = @active_battler.action.skill
if $imported["BattleEngineMelody"]
if @active_battler.actor? and skill.draw_skill > 0
execute_action_draw_skill(skill)
else
execute_action_skill_sss_draw_skill
end
else
targets = @active_battler.action.make_targets
execute_action_skill_sss_draw_skill
if @active_battler.actor? and @active_battler.draw_skill_charges(skill) > 0
@active_battler.use_draw_charge(skill)
end
if @active_battler.actor? and skill.draw_skill > 0
perform_draw_skill(skill, targets)
end
end
end
#--------------------------------------------------------------------------
# * Execute Battle Action: Draw Skill
#--------------------------------------------------------------------------
def execute_action_draw_skill(skill)
@scene_skill = skill
targets = @active_battler.action.make_targets
targets = sort_targets(targets, skill)
#--- Setup ---
action_list = skill.setup_action_list
perform_action_list(action_list, targets) unless @chain_action
lunatic_obj_effects(:before, skill)
@active_battler.perform_skill_cost(skill) unless @ignore_cost
@active_battler.action.friends_unit.update_ptb
status_window_refresh
#--- Whole ---
action_list = skill.whole_action_list
perform_action_list(action_list, targets)
#--- Target ---
action_list = skill.target_action_list
for target in targets
next if target.dead? and !skill.for_dead_friend?
perform_action_list(action_list, [target])
end
#--- Follow ---
action_list = skill.follow_action_list
perform_action_list(action_list, targets)
lunatic_obj_effects(:after, skill)
#--- Finish ---
perform_draw_skill(skill, targets)
refresh_ptb_windows unless @ptb_updated
action_list = skill.finish_action_list
perform_action_list(action_list, targets) unless @chain_action
perform_earn_jp(:skill) if $imported["SkillOverhaul"]
readjust_instant_properties if skill.instant
end
#--------------------------------------------------------------------------
# * Perform Draw Skill
#--------------------------------------------------------------------------
def perform_draw_skill(skill, targets)
Graphics.freeze
@help_window = Window_Help.new
@draw_window = Window_Draw_Skill.new(@active_battler, targets, @help_window)
if $imported["BattleEngineMelody"]
@help_window.viewport = @spriteset.viewportC
@draw_window.viewport = @spriteset.viewportC
end
if @draw_window.total_skills == 0
@help_window.dispose
@help_window = nil
@draw_window.dispose
@draw_window = nil
Graphics.transition(0)
return
end
Graphics.transition(10)
loop do
update_basic
@draw_window.update
if Input.trigger?(Input::C)
Sound.play_decision
draw_skill = @draw_window.skill
@active_battler.acquire_draw_skill(draw_skill, skill.draw_skill)
name = @active_battler.name
charges = skill.draw_skill
skill_name = draw_skill.name
text = sprintf(SSS::DRAW_CHARGES_MSG, name, charges, skill_name)
@message_window.add_instant_text(text)
break
elsif Input.trigger?(Input::B)
Sound.play_cancel
break
end
end
Graphics.freeze
@help_window.dispose
@help_window = nil
@draw_window.dispose
@draw_window = nil
Graphics.transition(10)
end
end
#===============================================================================
#
# END OF FILE
#
#===============================================================================
#
# Shanghai Simple Script - Draw Skills
# Last Date Updated: 2010.06.15
# Level: Normal
#
# Final Fantasy 8 had a unique and interesting mechanic called Draw. It would
# take skills from the enemy unit and actors can then use it. They had a count
# to how many times that skill can be used until it ran out. This script allows
# the possibility to do the same thing and also improves upon it.
#
# Changes from actual Final Fantasy 8 Version
# - Some skills have restrictions on which classes can draw skills from it.
# - Drawing a skill from an enemy will teach the actor that skill.
# - Drawing a skill will give a set amount of charges.
# - Skills won't disappear when all of the charges are used up.
# - Skills will cost their MP amount after all of the charges are used up.
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials but above ▼ Main. Remember to save.
#
# <draw skill>
# <draw skill: x>
# These tags will turn the current skill into a draw skill. Draw skills will
# take skills from enemies. If the second tag is used, then x charges will be
# drawn from the enemy. If the second tag isn't used, then 10 charges are drawn.
#
# <draw class: x>
# <draw class: x, x, x>
# These tags will make it so that the current skill can only be drawn by class x
# and nothing else. If these tags aren't present, the skill can be drawn by all
# classes.
#
# <cannot draw>
# This tag will make the skill undrawable. Used for boss skills that you don't
# want the player to learn.
#===============================================================================
$imported = {} if $imported == nil
$imported["DrawSkills"] = true
module SSS
# This is the maximum amount of charges you can draw for your skills.
MAXIMUM_DRAW_CHARGES = 255
# This is how the text appears when charges are drawn.
DRAW_CHARGES_MSG = "%s has drawn %d×%s!"
DRAW_CHARGES_TEXT = "×%d"
DRAW_CHARGES_SIZE = 16
end
#==============================================================================
# RPG::Skill
#==============================================================================
class RPG::Skill < RPG::UsableItem
#--------------------------------------------------------------------------
# # Draw Skill
#--------------------------------------------------------------------------
def draw_skill
return @draw_skill if @draw_skill != nil
@draw_skill = 0
self.note.split(/[\r\n]+/).each { |line|
case line
when /<(?:DRAW_SKILL|draw skill)>/i
@draw_skill = 10
when /<(?:DRAW_SKILL|draw skill):[ ](\d+)>/i
@draw_skill = $1.to_i
end
}
return @draw_skill
end
#--------------------------------------------------------------------------
# # Draw Classes
#--------------------------------------------------------------------------
def draw_classes
return @draw_classes if @draw_classes != nil
@draw_classes = []
self.note.split(/[\r\n]+/).each { |line|
case line
when /<(?:DRAW_CLASS|draw class):[ ](\d+(?:\s*,\s*\d+)*)>/i
$1.scan(/\d+/).each { |num|
@draw_classes.push(num.to_i) if num.to_i > 0 }
end
}
if @draw_classes.empty?
for i in 1..$data_classes.size do @draw_classes.push(i) end
end
return @draw_classes
end
#--------------------------------------------------------------------------
# # Cannot Draw
#--------------------------------------------------------------------------
def cannot_draw
return @cannot_draw if @cannot_draw != nil
@cannot_draw = false
self.note.split(/[\r\n]+/).each { |line|
case line
when /<(?:CANNOT_DRAW|cannot draw)>/i
@cannot_draw = true
end
}
return @cannot_draw
end
end
#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Perform Skill Cost
#--------------------------------------------------------------------------
if $imported["BattleEngineMelody"]
alias perform_skill_cost_sss_draw_skills perform_skill_cost unless $@
def perform_skill_cost(skill)
return if skill == nil or !skill.is_a?(RPG::Skill)
if actor? and draw_skill_charges(skill) > 0
use_draw_charge(skill)
else
perform_skill_cost_sss_draw_skills(skill)
end
end
#--------------------------------------------------------------------------
# * Custom Skill Costs
#--------------------------------------------------------------------------
alias custom_skill_costs_sss_draw_skills custom_skill_costs unless $@
def custom_skill_costs(skill, type)
if actor? and draw_skill_charges(skill) > 0
charges = draw_skill_charges(skill)
case type
when :perform; return
when :calc_cost; return charges
when :text_cost; return sprintf(SSS::DRAW_CHARGES_TEXT, charges)
when :can_use; return true
when :use_icon; return 0
when :suffix; return "%s"
when :font_size; return SSS::DRAW_CHARGES_SIZE
when :colour; return 0
end
else
return custom_skill_costs_sss_draw_skills(skill, type)
end
end
else # Imported Battle Engine Melody
#--------------------------------------------------------------------------
# * Calculation of MP Consumed for Skills
#--------------------------------------------------------------------------
alias calc_mp_cost_sss_draw_skills calc_mp_cost unless $@
def calc_mp_cost(skill)
if actor? and draw_skill_charges(skill) > 0
return 0
else
return calc_mp_cost_sss_draw_skills(skill)
end
end
#--------------------------------------------------------------------------
# * Determine Usable Skills
#--------------------------------------------------------------------------
alias skill_can_use_sss_draw_skills skill_can_use? unless $@
def skill_can_use?(skill)
if actor? and draw_skill_charges(skill) > 0
return false unless skill.is_a?(RPG::Skill)
return false unless movable?
return false if silent? and skill.spi_f > 0
if $game_temp.in_battle
return skill.battle_ok?
else
return skill.menu_ok?
end
else
return skill_can_use_sss_draw_skills(skill)
end
end
end
end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Draw Skill Charges
#--------------------------------------------------------------------------
def draw_skill_charges(skill)
@draw_skills = {} if @draw_skills.nil?
@draw_skills[skill.id] = 0 if @draw_skills[skill.id].nil?
return @draw_skills[skill.id]
end
#--------------------------------------------------------------------------
# * Acquire Draw Skill
#--------------------------------------------------------------------------
def acquire_draw_skill(skill, charges)
@draw_skills = {} if @draw_skills.nil?
@draw_skills[skill.id] = 0 if @draw_skills[skill.id].nil?
@draw_skills[skill.id] += charges
@draw_skills[skill.id] = [@draw_skills[skill.id], 0].max
maximum = SSS::MAXIMUM_DRAW_CHARGES
@draw_skills[skill.id] = [@draw_skills[skill.id], maximum].min
learn_skill(skill.id)
clear_battle_cache if $imported["BattleEngineMelody"]
end
#--------------------------------------------------------------------------
# * Use Draw Charge
#--------------------------------------------------------------------------
def use_draw_charge(skill)
@draw_skills = {} if @draw_skills.nil?
@draw_skills[skill.id] = 0 if @draw_skills[skill.id].nil?
@draw_skills[skill.id] -= 1
@draw_skills[skill.id] = [@draw_skills[skill.id], 0].max
maximum = SSS::MAXIMUM_DRAW_CHARGES
@draw_skills[skill.id] = [@draw_skills[skill.id], maximum].min
end
#--------------------------------------------------------------------------
# * Determine Usable Skills
#--------------------------------------------------------------------------
def skill_can_use?(skill)
return super(skill)
end
end
#==============================================================================
# ** Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * Total Skills
#--------------------------------------------------------------------------
unless method_defined?(:total_skills)
def total_skills
result = []
for action in enemy.actions
next unless action.kind == 1
skill = $data_skills[action.skill_id]
result.push(skill) unless result.include?(skill)
end
result.sort! { |a,b| a.id <=> b.id }
return result.uniq
end
end
end
#==============================================================================
# ** Window_Skill
#==============================================================================
unless $imported["BattleEngineMelody"]
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
alias draw_item_sss_draw_skills draw_item unless $@
def draw_item(index)
skill = @data[index]
if skill != nil and @actor.draw_skill_charges(skill) > 0
rect = item_rect(index)
self.contents.clear_rect(rect)
rect.width -= 4
charges = @actor.draw_skill_charges(skill)
self.contents.font.size = Font.default_size
enabled = @actor.skill_can_use?(skill)
draw_item_name(skill, rect.x, rect.y, enabled)
text = sprintf(SSS::DRAW_CHARGES_TEXT, charges)
self.contents.font.size = SSS::DRAW_CHARGES_SIZE
self.contents.draw_text(rect, text, 2)
else
draw_item_sss_draw_skills(index)
end
end
end
end
#==============================================================================
# ** Window_Draw_Skill
#==============================================================================
class Window_Draw_Skill < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor, targets, help)
yy = help.y + help.height
super(0, yy, Graphics.width, Graphics.height-yy-128)
@actor = actor
@drawing_skill = @actor.action.skill
@targets = targets
@column_max = 2
self.index = 0
refresh
self.help_window = help
end
#--------------------------------------------------------------------------
# * Get Skill
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Total Skills
#--------------------------------------------------------------------------
def total_skills
return @data.size
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def refresh
@data = []
for target in @targets
next if target.actor?
for skill in target.total_skills
@data.push(skill) if include?(skill)
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Include Skill?
#--------------------------------------------------------------------------
def include?(skill)
return false if skill.cannot_draw
return false if @data.include?(skill)
return false unless skill.draw_classes.include?(@actor.class_id)
return true
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(skill == nil ? "" : skill.description)
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
self.contents.font.size = Font.default_size
draw_item_name(skill, rect.x, rect.y, true)
charges = @drawing_skill.draw_skill
text = sprintf(SSS::DRAW_CHARGES_TEXT, charges)
self.contents.font.size = SSS::DRAW_CHARGES_SIZE
self.contents.draw_text(rect, text, 2)
end
end
end
#==============================================================================
# ** Scene_Skill
#==============================================================================
unless $imported["BattleEngineMelody"]
class Scene_Skill < Scene_Base
#--------------------------------------------------------------------------
# * Use Skill (apply effects to non-ally targets)
#--------------------------------------------------------------------------
alias use_skill_nontarget_sss_draw_skills use_skill_nontarget unless $@
def use_skill_nontarget
@actor.use_draw_charge(@skill) if @actor.draw_skill_charges(@skill) > 0
use_skill_nontarget_sss_draw_skills
end
end
end
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Execute Battle Action: Skill
#--------------------------------------------------------------------------
alias execute_action_skill_sss_draw_skill execute_action_skill unless $@
def execute_action_skill
skill = @active_battler.action.skill
if $imported["BattleEngineMelody"]
if @active_battler.actor? and skill.draw_skill > 0
execute_action_draw_skill(skill)
else
execute_action_skill_sss_draw_skill
end
else
targets = @active_battler.action.make_targets
execute_action_skill_sss_draw_skill
if @active_battler.actor? and @active_battler.draw_skill_charges(skill) > 0
@active_battler.use_draw_charge(skill)
end
if @active_battler.actor? and skill.draw_skill > 0
perform_draw_skill(skill, targets)
end
end
end
#--------------------------------------------------------------------------
# * Execute Battle Action: Draw Skill
#--------------------------------------------------------------------------
def execute_action_draw_skill(skill)
@scene_skill = skill
targets = @active_battler.action.make_targets
targets = sort_targets(targets, skill)
#--- Setup ---
action_list = skill.setup_action_list
perform_action_list(action_list, targets) unless @chain_action
lunatic_obj_effects(:before, skill)
@active_battler.perform_skill_cost(skill) unless @ignore_cost
@active_battler.action.friends_unit.update_ptb
status_window_refresh
#--- Whole ---
action_list = skill.whole_action_list
perform_action_list(action_list, targets)
#--- Target ---
action_list = skill.target_action_list
for target in targets
next if target.dead? and !skill.for_dead_friend?
perform_action_list(action_list, [target])
end
#--- Follow ---
action_list = skill.follow_action_list
perform_action_list(action_list, targets)
lunatic_obj_effects(:after, skill)
#--- Finish ---
perform_draw_skill(skill, targets)
refresh_ptb_windows unless @ptb_updated
action_list = skill.finish_action_list
perform_action_list(action_list, targets) unless @chain_action
perform_earn_jp(:skill) if $imported["SkillOverhaul"]
readjust_instant_properties if skill.instant
end
#--------------------------------------------------------------------------
# * Perform Draw Skill
#--------------------------------------------------------------------------
def perform_draw_skill(skill, targets)
Graphics.freeze
@help_window = Window_Help.new
@draw_window = Window_Draw_Skill.new(@active_battler, targets, @help_window)
if $imported["BattleEngineMelody"]
@help_window.viewport = @spriteset.viewportC
@draw_window.viewport = @spriteset.viewportC
end
if @draw_window.total_skills == 0
@help_window.dispose
@help_window = nil
@draw_window.dispose
@draw_window = nil
Graphics.transition(0)
return
end
Graphics.transition(10)
loop do
update_basic
@draw_window.update
if Input.trigger?(Input::C)
Sound.play_decision
draw_skill = @draw_window.skill
@active_battler.acquire_draw_skill(draw_skill, skill.draw_skill)
name = @active_battler.name
charges = skill.draw_skill
skill_name = draw_skill.name
text = sprintf(SSS::DRAW_CHARGES_MSG, name, charges, skill_name)
@message_window.add_instant_text(text)
break
elsif Input.trigger?(Input::B)
Sound.play_cancel
break
end
end
Graphics.freeze
@help_window.dispose
@help_window = nil
@draw_window.dispose
@draw_window = nil
Graphics.transition(10)
end
end
#===============================================================================
#
# END OF FILE
#
#===============================================================================