#=============================================================================== # # Shanghai Simple Script - Optima Shift # Last Date Updated: 2010.05.11 # Level: Hard # # The people who have played Final Fantasy XIII are familiar with the Optima # Change system (or Paradigm Shift for the English version). This shift changes # each character's skills and such for the battle and makes them choose new # strategies. This script does not mimic the whole Optima Change battle system # but borrows the skill switching bit from it. #=============================================================================== # 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. # # # Makes the skill appear in Attacker Optimas. Ignores automatic Optima. # # # Makes the skill apear in Blaster Optimas. Ignores automatic Optima. # # # Makes the skill appear in Defender Optimas. Ignores automatic Optima. # # # Makes the skill appear in Jammer Optimas. Ignores automatic Optima. # # # Makes the skill appear in Enhancer Optimas. Ignores automatic Optima. # # # Makes the skill appear in Healer Optimas. Ignores automatic Optima. # # Insert these into your skill's noteboxes. They will set which skills belong # in which Optima family. If you don't use them, the automatic Optima organizer # will do it for you, but it may be not to your liking. #=============================================================================== $imported = {} if $imported == nil $imported["OptimaShift"] = true module SSS # These set the names for each of the optima modes. OPTIMA_SETTINGS ={ # Type => [Full Name, Abbrv., Color] :atk => ["Attacker", "ATK", 2], :bla => ["Blaster", "BLA", 4], :def => ["Defender", "DEF", 6], :jam => ["Jammer", "JAM", 7], :enh => ["Enhancer", "ENH", 5], :hlr => ["Healer", "HLR", 3], } # Remove this and your script won't work. # These elements will be ignored when making ATTACKER optimas. OPTIMA_IGNORE_ELEMENTS = [1, 2] # This hash sets the default Optima for each actor. DEFAULT_OPTIMA ={ 1 => "ATTACKER", 2 => "ATTACKER", 3 => "BLASTER", 4 => "HEALER", } # Remove this and your script won't work. # This sets it so that if the current Optima is a Defender, guarding will # have super guard properties. OPTIMA_SUPER_GUARD = true end #============================================================================== # RPG::Skill #============================================================================== class RPG::Skill < RPG::UsableItem #-------------------------------------------------------------------------- # * Optimas #-------------------------------------------------------------------------- def optimas return @optimas unless @optimas.nil? @optimas = [] self.note.split(/[\r\n]+/).each { |line| case line when /<(?:ATTACKER_OPTIMA|attacker optima)>/i @optimas.push("ATTACKER") when /<(?:BLASTER_OPTIMA|blaster optima)>/i @optimas.push("BLASTER") when /<(?:DEFENDER_OPTIMA|defender optima)>/i @optimas.push("DEFENDER") when /<(?:JAMMER_OPTIMA|jammer optima)>/i @optimas.push("JAMMER") when /<(?:ENHANCER_OPTIMA|enhancer optima)>/i @optimas.push("ENHANCER") when /<(?:HEALER_OPTIMA|healer optima)>/i @optimas.push("HEALER") end } return unless @optimas.empty? if self.for_opponent? elements = self.element_set elements -= SSS::OPTIMA_IGNORE_ELEMENTS if elements.empty? @optimas.push("ATTACKER") if self.base_damage > 0 if self.plus_state_set.empty? or not self.minus_state_set.empty? @optimas.push("JAMMER") end else @optimas.push("BLASTER") if self.base_damage > 0 if self.plus_state_set.empty? or not self.minus_state_set.empty? @optimas.push("JAMMER") end end elsif self.for_user? @optimas.push("DEFENDER") elsif self.for_friend? @optimas.push("HEALER") if self.base_damage < 0 @optimas.push("HEALER") if not self.minus_state_set.empty? @optimas.push("ENHANCER") if not self.plus_state_set.empty? end end end #============================================================================== # ** Scene_Title #============================================================================== class Scene_Title < Scene_Base #-------------------------------------------------------------------------- # * Load Database #-------------------------------------------------------------------------- alias load_database_sss_optima_shift load_database unless $@ def load_database load_database_sss_optima_shift create_optimas end #-------------------------------------------------------------------------- # * Load Battle Test Database #-------------------------------------------------------------------------- alias load_bt_database_sss_optima_shift load_bt_database unless $@ def load_bt_database load_bt_database_sss_optima_shift create_optimas end #-------------------------------------------------------------------------- # * Create Optimas #-------------------------------------------------------------------------- def create_optimas for skill in $data_skills next if skill.nil? skill.optimas end end end #============================================================================== # ** Game_BattleAction #============================================================================== class Game_BattleAction #-------------------------------------------------------------------------- # * Skill Evaluation (target designation) # target : Target battler #-------------------------------------------------------------------------- def evaluate_skill_with_target(target) target.clear_action_results if ["ATTACKER", "BLASTER", "HEALER"].include?(battler.current_optima) target.make_obj_damage_value(battler, skill) if skill.for_opponent? return target.hp_damage.to_f / [target.hp, 1].max else recovery = [-target.hp_damage, target.maxhp - target.hp].min value = recovery.to_f / target.maxhp for state in skill.plus_state_set next if target.state?(state_id) value += [state_probability(state_id) / 10, 1].max end for state_id in skill.minus_state_set next unless target.state?(state_id) value += 10 end return value end elsif ["DEFENDER", "JAMMER", "ENHANCER"] value = 0 if skill.for_user? recovery = [-target.hp_damage, target.maxhp - target.hp].min value += recovery.to_f / target.maxhp end for state in skill.minus_state_set value += 10 if target.state?(state_id) end for state in skill.plus_state_set next if target.state?(state_id) value += [state_probability(state_id) / 10, 1].max end return value end return 0 end end #============================================================================== # ** Game_Actor #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Get Skill Object Array #-------------------------------------------------------------------------- alias skills_sss_optima_shift skills def skills return skills_sss_optima_shift unless $game_temp.in_battle skill_array = [] for skill in skills_sss_optima_shift skill_array.push(skill) if skill.optimas.include?(current_optima) end return skill_array end #-------------------------------------------------------------------------- # * Get [Super Guard] Option #-------------------------------------------------------------------------- alias super_guard_sss_optima_shift super_guard unless $@ def super_guard return true if current_optima == "DEFENDER" return super_guard_sss_optima_shift end #-------------------------------------------------------------------------- # * Current Optima #-------------------------------------------------------------------------- def current_optima @current_optima = SSS::DEFAULT_OPTIMA[@actor_id] if @current_optima == nil return @current_optima end #-------------------------------------------------------------------------- # * Current Optima= #-------------------------------------------------------------------------- def current_optima=(new_optima) old_optima = @current_optima @current_optima = new_optima.to_s.upcase make_action unless old_optima == @current_optima end #-------------------------------------------------------------------------- # * Create Battle Action (for automatic battle) #-------------------------------------------------------------------------- def make_action @make_auto_skill = true if $imported["BattleEngineMelody"] create_optima_action if $imported["BattleEngineMelody"] @make_auto_skill = nil action_bonus_speed if $scene.is_a?(Scene_Battle) and $scene.atb? end end #-------------------------------------------------------------------------- # * Create Optima Action #-------------------------------------------------------------------------- def create_optima_action @action.clear return unless movable? action_list = [] action = Game_BattleAction.new(self) if current_optima == "ATTACKER" action.set_attack action.evaluate action_list.push(action) elsif current_optima == "DEFENDER" action.set_guard action.value = 5 action_list.push(action) else action.set_guard action.value = 5 action_list.push(action) end for skill in skills action = Game_BattleAction.new(self) action.set_skill(skill.id) action.evaluate action_list.push(action) end max_value = 0 for action in action_list if action.value > max_value @action = action max_value = action.value end end end end #=============================================================================== # # END OF FILE # #===============================================================================