#============================================================================== # Crystal Engine - FF2 Core #------------------------------------------------------------------------------ # Current Version: 1.00 #============================================================================== $imported ||= {} $imported["CE-FF2Core"] = true =begin This script sets up some of the basic functions of the Final Fantasy II style advancement system. This script does nothing on it's own but it is required to run the other advancement scripts. ------------------------------------------------------------------------------ Notetags: Actor Notes # Cause the actor to ignore all of the FF2 Scripts Enemy Notes # Specify the enemy's rank for rank based calculations =end module CRYSTAL module FF2 module GENERAL #------------------------------------------------------------------------ # * Display the Level of Actors # This only hides the level from the the menu and level up messages # actors still gain EXP and level up normally. To prevent stats from # increasing upon a level up, modify the stat curves so that there is # never an increase. #------------------------------------------------------------------------ DISPLAY_LEVEL = false #------------------------------------------------------------------------ # * Display Skills Learned Upon Level Up #------------------------------------------------------------------------ DISPLAY_SKILL_LEARN = true #------------------------------------------------------------------------ # * Default Rank for Enemies #------------------------------------------------------------------------ DEFAULT_RANK = 1 #------------------------------------------------------------------------ # * Formula for Determining Actor Rank # This one uses the actor's level to gradually rank up the actor #------------------------------------------------------------------------ ACTOR_RANK_FORMULA = "[1, [level / 6, 16].min].max" #------------------------------------------------------------------------ # * Formula Used for Rank Based Calculations #------------------------------------------------------------------------ RANK_DIFFERENCE_FORMULA = "10 + b.rank - a.rank" end module VICTORY #-------------------------------------------------------------------------- # * Use Base Parameters for Level Up Display #-------------------------------------------------------------------------- BASE_PARAMS = false #-------------------------------------------------------------------------- # * Include Equips in Victory Stat Changes (irrelivant if top is true) #-------------------------------------------------------------------------- INCLUDE_EQUIPS = false #-------------------------------------------------------------------------- # * Include Stat Rates (irrelivant if top is true) #-------------------------------------------------------------------------- INCLUDE_RATES = false end module PROCESSOR #------------------------------------------------------------------------ # * Run Rank Based Increase Evaluation #------------------------------------------------------------------------ def self.rank_based_eval(a, b, v = $game_variables) [eval(CRYSTAL::FF2::GENERAL::RANK_DIFFERENCE_FORMULA), 0].max rescue 10 end 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 end end CRYSTAL::CHECK.require("Crystal Engine - FF2 Core", "CE-BasicModule") #============================================================================== # ** RPG::Actor #------------------------------------------------------------------------------ # The data class for actors. #============================================================================== class RPG::Actor < RPG::BaseItem #-------------------------------------------------------------------------- # * Exclude From All FF2 Systems #-------------------------------------------------------------------------- def no_advancement? @note =~ //i end end #============================================================================== # ** RPG::Enemy #------------------------------------------------------------------------------ # The data class for enemies. #============================================================================== class RPG::Enemy < RPG::BaseItem #-------------------------------------------------------------------------- # * Rank #-------------------------------------------------------------------------- def rank @note =~ //i ? $1.to_i : CRYSTAL::FF2::GENERAL::DEFAULT_RANK end end #============================================================================== # ** BattleManager #------------------------------------------------------------------------------ # This module manages battle progress. #============================================================================== module BattleManager #-------------------------------------------------------------------------- # * EXP Acquisition and Level Up Display #-------------------------------------------------------------------------- class < 8 select(0) activate else unselect deactivate end create_contents draw_all_items end #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) skill = @data[index] return if skill.nil? rect.width -= 4 if skill.is_a?(Array) draw_equip_name(skill, @actor, rect.x, rect.y, true) else draw_skill_name(skill, @actor, rect.x, rect.y, true) end end #-------------------------------------------------------------------------- # * Draw Item Name # enabled : Enabled flag. When false, draw semi-transparently. #-------------------------------------------------------------------------- def draw_equip_name(equip, actor, x, y, enabled = true, width = 172) return unless equip return unless actor fmt = CRYSTAL::FF2::WEAPONS::WEAPON_LEVEL_FORMAT case equip[0] when :weapon icon = CRYSTAL::FF2::WEAPONS::WEAPON_ICONS[equip[1]] term = equip[1] == 0 ? CRYSTAL::FF2::WEAPONS::BAREHANDED_TERM : Vocab.wtype(equip[1]) text = sprintf(fmt, term, @actor.weapon_levels[:weapons][equip[1]]) when :armor icon = CRYSTAL::FF2::WEAPONS::SHIELD_ICONS[equip[1]] term = Vocab.atype(equip[1]) text = sprintf(fmt, term, @actor.weapon_levels[:armors][equip[1]]) end draw_icon(icon, x, y, enabled) change_color(normal_color, enabled) draw_text(x + 24, y, width, line_height, text) 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 # Window_VictorySkills