#============================================================================== # Crystal Engine - Skill Levels #------------------------------------------------------------------------------ # Current Version: 1.00 #============================================================================== $imported ||= {} $imported["CE-SkillLevels"] = true =begin This script make it so that actor's skill have individual levels that affect the damage done by the skill. Skill level up by being used by actors and level up, increasing in power. ------------------------------------------------------------------------------- Notetags: Skill Notes # Causes the skill to not be affected by this script =end module CRYSTAL module FF2 module SKILLS #------------------------------------------------------------------------ # * Max Level for a Given Skill #------------------------------------------------------------------------ MAX_LEVEL = 16 #------------------------------------------------------------------------ # * Skill EXP Needed for a Level Up #------------------------------------------------------------------------ EXP_FOR_LEVEL = 100 #------------------------------------------------------------------------ # * Does an Attack Need to Connect in Order to Cause an Increase #------------------------------------------------------------------------ HIT_REQUIRED = false #------------------------------------------------------------------------ # * Message for a Level Up #------------------------------------------------------------------------ LEVEL_MESSAGE = "%s's %s Level Increased!" #------------------------------------------------------------------------ # * Modified Damage Formula #------------------------------------------------------------------------ DAMAGE_FORMULA = "%s * [(skill_level / 2.0), 1].max" #------------------------------------------------------------------------ # * MP Cost Formula #------------------------------------------------------------------------ MP_COST_FORMULA = "%s * skill_level" #------------------------------------------------------------------------ # * TP Cost Formula #------------------------------------------------------------------------ TP_COST_FORMULA = "%s" #------------------------------------------------------------------------ # * Name Format #------------------------------------------------------------------------ NAME_FORMAT = "%s Lv. %s" end end end #============================================================================== # Editing beyond this point may cause stone, zombie, mist frenzy, and/or toad, # so edit at your own risk. #============================================================================== module CRYSTAL module CHECK #-------------------------------------------------------------------------- # * Checks if you have a certain script installed #-------------------------------------------------------------------------- def self.require(self_name, script, site = "http://crystalnoel42.wordpress.com") unless $imported["CE-BasicModule"] msg = "The script '#{self_name}' requires the latest\n" msg += "version of 'Crystal Engine - Basic Module' to work properly\n" msg += "Go to http://crystalnoel42.wordpress.com/ to download this script." raise SyntaxError.new(msg) end unless $imported[script] msg = "The script '#{self_name}' requires the latest\n" msg += "version of #{scripts_list(script)} to work properly\n" msg += "Go to #{site} to download this script." raise SyntaxError.new(msg) end end require("Crystal Engine - Skill Levels", "CE-BasicModule") #-------------------------------------------------------------------------- # * Script Name Guide #-------------------------------------------------------------------------- class </i end end #============================================================================== # ** RPG::UsableItem::Damage #------------------------------------------------------------------------------ # The data class for damage. #============================================================================== class RPG::UsableItem::Damage #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :skill_id # The skill id for the damage #-------------------------------------------------------------------------- # * Evaluate Damage #-------------------------------------------------------------------------- alias eval_ce_ff2_skill_levels_rpg_usableitem_damage eval def eval(a, b, v) value = eval_ce_ff2_skill_levels_rpg_usableitem_damage(a, b, v) if a.actor? && !a.no_advancement? if @skill_id && !$data_skills[@skill_id].no_levels? formula = CRYSTAL::FF2::SKILLS::DAMAGE_FORMULA skill_level = a.skill_levels[@skill_id] value = Kernel.eval(sprintf(formula, value)) end end value end end #============================================================================== # ** DataManager #------------------------------------------------------------------------------ # This module manages the database and game objects. Almost all of the # global variables used by the game are initialized by this module. #============================================================================== module DataManager #-------------------------------------------------------------------------- # * Load Database #-------------------------------------------------------------------------- class <= CRYSTAL::FF2::SKILLS::EXP_FOR_LEVEL if $game_party.in_battle user.increase_skills.push(item.id) else @skill_levels[item.id] += 1 end user.skill_exp[item.id] = 0 end end end #============================================================================== # ** Game_Actor #------------------------------------------------------------------------------ # This class handles actors. It is used within the Game_Actors class # ($game_actors) and is also referenced from the Game_Party class ($game_party). #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :skill_levels attr_accessor :skill_exp attr_accessor :increase_skills #-------------------------------------------------------------------------- # * Setup #-------------------------------------------------------------------------- alias setup_ce_ff2_skill_levels setup def setup(actor_id) setup_ce_ff2_skill_levels(actor_id) return if no_advancement? @skill_levels = {} @skill_exp = {} skills.each do |skill| next if skill.no_levels? @skill_levels[skill.id] = 1 @skill_exp[skill.id] = 0 end @increase_skills = [] end #-------------------------------------------------------------------------- # * Learn Skill #-------------------------------------------------------------------------- alias learn_skill_ce_ff2_skill_levels learn_skill def learn_skill(skill_id) return if skill_learn?($data_skills[skill_id]) learn_skill_ce_ff2_skill_levels(skill_id) return if $data_skills[skill_id].no_levels? return if no_advancement? @skill_levels[skill_id] = 1 @skill_exp[skill_id] = 0 end end #============================================================================== # ** Window_SkillList #------------------------------------------------------------------------------ # This window is for displaying a list of available skills on the skill window. #============================================================================== class Window_SkillList < Window_Selectable #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(index) skill = @data[index] if skill rect = item_rect(index) rect.width -= 4 draw_skill_name(skill, @actor, rect.x, rect.y, enable?(skill)) draw_skill_cost(rect, skill) end end #-------------------------------------------------------------------------- # * Draw Item Name # enabled : Enabled flag. When false, draw semi-transparently. #-------------------------------------------------------------------------- def draw_skill_name(skill, actor, x, y, enabled = true, width = 172) return unless skill return unless actor draw_icon(skill.icon_index, x, y, enabled) change_color(normal_color, enabled) fmt = CRYSTAL::FF2::SKILLS::NAME_FORMAT old_fmt = actor.no_advancement? || skill.no_levels? text = old_fmt ? skill.name : sprintf(fmt, skill.name, actor.skill_levels[skill.id]) draw_text(x + 24, y, width, line_height, text) end end