Quote from: Blizzard on February 08, 2009, 08:56:10 am
I thought there was a system like that already (other than Minkoff's). But doesn't Minkoff's work without RTAB as well?
#==============================================================================
# ** Animated Battlers - Enhanced ver. 7.7 (03-29-2007)
#
#------------------------------------------------------------------------------
# * (2) Configuration: The Sprite Battler Class (initialize system)
#==============================================================================
#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
# This sprite is used to display the battler.It observes the Game_Character
# class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :battler_offset # Degree of action forcing
attr_accessor :skill_used # Degree of action forcing
attr_accessor :item_used # Degree of action forcing
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias mnk_init initialize
def initialize(viewport, battler = nil)
#==============================================================================
#==============================================================================
# #
# **** C O N F I G U R A T I O N S Y S T E M **** #
# #
#==============================================================================
#==============================================================================
#==========================================================================
# **** GENERAL CONTROLS **** #
#==========================================================================
# * Default Battler Style Switches
#--------------------------------------------------------------------------
$default_enemy = true # If true, these switches allows the use
$default_actor = false # of default battlers for actors/enemies
$default_enemy_id = [] # Ids of enemies using default battlers
$default_actor_id = [] # Ids of actors using default battlers
@default_collapse_actor = true # If true, restores the old 'red fade'
@default_collapse_enemy = false # collapse effect (using spritesheets)
# * Animation Frames and Animation Speed
#--------------------------------------------------------------------------
@speed = 4 # Framerate speed of the battlers
@rush_speed = 1.5 # Melee/Skill/Item motion speed of the battlers
@poses = 11 # Maximum # of poses (stances) in the template
@frames = 4 # Maximum # of frames in each pose
@frames_standard = 4 # Standard # of frames played in each pose.
# Individual Spritesheet Control Center
#--------------------------------------------------------------------------
@poses_enemy = {9 => 7} # ID and # of poses for each enemy
@frames_enemy = nil # ID and # of frames for each enemy
@poses_actor = {1 => 4, 2 => 4, 7 => 4, 8 => 4} # ID and # of poses for each actor
@frames_actor = nil # ID and # of frames for each actor.
# * Wooziness Rates
#--------------------------------------------------------------------------
@low_hp_percentage = 0.25 # Determines health% of battler for WOOZY pose.
@low_hp_actor = nil # Individual health% for actors.
@low_hp_enemy = nil # Individual health% for enemies.
#==========================================================================
# **** POSE CONTROL CENTER **** #
#==========================================================================
# Editable Template (Some people wanted to change their template design)
#--------------------------------------------------------------------------
$p1 = 0 # Sets the 'Ready Pose' ($p1) to be pose #1 in your template
$p2 = 1 # Sets the 'Struck Pose' ($p2) to be pose #2 in your template
$p3 = 2 # Sets the 'Woozy Pose' ($p3) to be pose #3 in your template
$p4 = 3 # Sets the 'Block Pose' ($p4) to be pose #4 in your template
$p5 = 4 # Sets the 'Charge Pose' ($p5) to be pose #5 in your template
$p6 = 5 # Sets the 'Retreat Pose'($p6) to be pose #6 in your template
$p7 = 6 # Sets the 'Attack Pose' ($p7) to be pose #7 in your template
$p8 = 7 # Sets the 'Item Pose' ($p8) to be pose #8 in your template
$p9 = 8 # Sets the 'Skill Pose' ($p9) to be pose #9 in your template
$p10 = 9 # Sets the 'Victory Pose'($p10)to be pose #10 in your template
$p11 = 10 # Sets the 'Defeat Pose' ($p11)to be pose #11 in your template
# Editable Template (for Custom Actor Spritesheets)
#--------------------------------------------------------------------------
$ap1 = {8 => 1, 7 => 1, 1 => 1, 2 => 1}
$ap2 = {8 => 1, 7 => 1, 1 => 1, 2 => 1} # Hilda is using a Charset graphic as a battler.
$ap3 = {8 => 1, 7 => 1, 1 => 1, 2 => 1} # The battler was copied into the Battler folder.
$ap4 = {8 => 1, 7 => 1, 1 => 1, 2 => 1} # This setup allows you to use Charactersets for your
$ap5 = {8 => 1, 7 => 1, 1 => 1, 2 => 1} # battlers.
$ap6 = {8 => 2, 7 => 2, 1 => 2, 2 => 2}
$ap7 = {8 => 1, 7 => 1, 1 => 1, 2 => 1}
$ap8 = {8 => 1, 7 => 1, 1 => 1, 2 => 1}
$ap9 = {8 => 1, 7 => 1, 1 => 1, 2 => 1}
$ap10 = {8 => 0, 7 => 0, 1 => 0, 2 => 0}
$ap11 = {8 => 3, 7 => 3, 1 => 3, 2 => 3}
# Editable Template (for Custom Enemy Spritesheets)
#--------------------------------------------------------------------------
$ep1 = {}
$ep2 = {}
$ep3 = {}
$ep4 = {}
$ep5 = {}
$ep6 = {}
$ep7 = {}
$ep8 = {}
$ep9 = {}
$ep11 = {1 => 11} # Setting the ghost to an invalid pose erases it.
#==========================================================================
# **** EXPANDED POSE CONTROL CENTER **** #
#==========================================================================
# Non-Default Poses (can expand beyond the default 11 poses here)
# (New system mimics the revised Template system. Can use 'custom' sheets)
#--------------------------------------------------------------------------
# The first value in each set indicates the index number in a spritesheet.
# This value is overrided by a value in one of the other two accompanying
# arrays... one for actor battlerss, the other for enemy battlers.
#
# To define a pose linked to a specific battler, the syntax is...
# '' hash array '' = { battler.id => pose# }
# Where Aluxes and the Ghost (RTP) would be the 1st battlers (per array),
# and the pose# would be the pose in your spritesheet.
#
# Combinations in the hash arrays are possible, so if the @poses_dying_e
# array has {1 => 5, 9 => 2}, then the GHOST (enemy #1) would be using the
# 6th pose (index 5) and the 9th enemy battler would be using the 3rd pose.
#--------------------------------------------------------------------------
@poses_setup = 6 # Choose animation pose for 'preparation'
@poses_setup_a = {}
@poses_setup_e = {9 => 4}
@poses_casting = 3 # Set 'casting' pose for skill preparation
@poses_casting_a = {}
@poses_casting_e = {9 => 2}
@poses_dying = 5 # Choose animation pose for dying throws.
@poses_dying_a = {}
@poses_dying_e = {9 => 4}
$poses_escape = 1 # Set 'coward' pose for fleeing monsters)
$poses_escape_a = {}
$poses_escape_e = {9 => 4}
$poses_crit = nil # Set pose for BIG hits
$poses_crit_a = {}
$poses_crit_e = {9 =>4}
@poses_winning = 3 # Set winning (Victory Dance before pose)
@poses_winning_a = {}
@poses_winning_e = {}
# This merely determines if a specific hero's victory pose is looping.....
@poses_winning_loops = [7] # Set victory non-freezing 'actor' as #7
# Non-Default Pose Hashes (poses dependant on .id values)
# (New system mimics the revised Template system.)
#--------------------------------------------------------------------------
# The first hash in each set indicates the id number (be it skill, item or
# otherwise, and the pose it brings up. These mimic the 2nd array type in
# the above Non-Default poses. As such, a hash value of {1 => 10) for the
# $poses_weapons hash would make the 'Bronze Sword' use the 10th index (or
# 11th spritesheet) pose... aka the 'Defeat' pose.
#
# To define an advanced pose linked to a specific battler, the syntax is...
# = { battler.id => { item/skill.id => pose# } }
# ...so this gets more complicated. But this does allow each battler to
# have his or her own unique pose, regardless of spritesheet type.
#--------------------------------------------------------------------------
@p_skill_casted = {61 => 5} # Set a specific skill to use a pose
@p_skill_casted_a = {}
@p_skill_casted_e = {}
@poses_status = {3 => 2} # Set status values to poses here
@poses_stat_a = {}
@poses_stat_e = {}
$poses_skills = {57 => 6} # Default: #57(Cross Cut) does 'Attack'
$poses_skills_a = {}
$poses_skills_e = {}
$poses_items = {13 => 3} # Default: #13(Sharp Stone) does 'Block'
$poses_items_a = {}
$poses_items_e = {}
$poses_weapons = {} # Didn't set any weapons to any poses
$poses_weaps_a = {}
$poses_weaps_e = {} # Non-functional (Enemies don't use 'em.)
#==========================================================================
# **** FRAME CONTROL CENTER **** #
#==========================================================================
# * Frames Control
#--------------------------------------------------------------------------
@frames_per_pose = {} # Set #of frames to pose(by index)
# Advanced Individual Pose/Frame Hashes # Advanced Individual Poses uses
# hashes within hashes. As a demo
$poses_actor = {} # you can see that enemy #1 has 2
$poses_enemy = {} # sets of controls: index 0 (for
# a ready pose is set to 1 frame,
# while index 3 (block) is set to 'two' frames. Likewise, for the actor's
# hash, Actor #7 (Gloria) has only 1 control hash. It sets index pose '0'
# (the ready pose again) to use four frames of animation (even though I had
# set the ready pose to just use '2' with the @frames_per_pose hash earlier.
#==========================================================================
# **** MOVEMENT CONTROL CENTER **** #
#==========================================================================
# * Forward Step System (Final Fantasy-Style)
#--------------------------------------------------------------------------
$rush_offset = 0 # How much additional space between battlers
$rush_attack = false # If true, battler steps forward to attack
$rush_skill = true # If true, battler steps forward to use skill
$rush_item = true # If true, battler steps forward to use item
# * Movement Arrays (Arrays for skill/weapon/item IDs that affect movement)
#--------------------------------------------------------------------------
$moving_item_atk = [1] # Examples are items that need to be applied.
$moving_skill_atk = [61] # Examples are martial-arts and sneak attacks
$move2center_atk = [] # Moves battler to center based on weapon id!
$move2center_item = [5] # Moves battler to center for a big item atk!
$move2center_skill = [7] # Moves battler to center for a big skill atk!
#
# * Remember, do not supply Skill or Item ID#'s that have 'None' scopes into
# either the $moving_item_atk or $moving_skill_atk hashes. These skills &
# item attacks have no target and would cause an error when trying to find
# an enemy to move towards.
#==========================================================================
# **** STATIONARY CONTROL CENTER **** #
#==========================================================================
# * Stationary Battlers (simple True/False settings)
#--------------------------------------------------------------------------
@stationary_enemies = false # If the enemies don't move while attacking
@stationary_actors = false # If the actors don't move while attacking
# * Arrays filled with skill/weapon/item IDs that halt movement
#--------------------------------------------------------------------------
$stationary_enemyid = [] # Enemies that don't RUN during melee attacks
@stationary_weapons = [] # (examples are bows & guns)
@stationary_skills = [] # (examples are bows & guns)
@stationary_items = [] # (examples are bows & guns)
#==========================================================================
# **** TRANSPARENCY CONTROL CENTER **** #
#==========================================================================
@translucency = 127 # Degree of transparency
@translucent_actor = [] # ID of actor at translucency settings
@translucent_enemy = [] # ID of enemy at translucency settings
@phasing = false # If battlers fade in/out while charging
@phasing_actor = [] # IDs of actors that fade in/out if charging
@phasing_enemy = [] # IDs of enemies that fade in/out if charging
@fade_in = true # Battler fades in if replaced or transparent
#==========================================================================
# **** CUSTOM FEATURE CENTER **** #
#==========================================================================
@mirror_enemies = true # Enemy battlers use reversed image
@calculate_speed = false # System calculates a mean/average speed
$animbat_at_delay = false # Pauses battlesystem until animation done.
#==========================================================================
# **** ADAPTATION CENTER **** #
#==========================================================================
$RTAB_Connected_Attacking = false # Needed to be on if RTAB and Con. Attk.
#==============================================================================
#==============================================================================
# DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING
# --Initialize poses
@frame, @pose = 0, 0
@last_time = 0
@last_move_time = 0
# --Initialize Battler placement and pose types
@battler_offset = 0
@skill_used = 0
@item_used = 0
# --Initialize Boolean values
@statusd = false
@dying = true
@s_pose = false
$victory = false
$defeat = false
@winning = true
# ORIGINAL Initialize call
mnk_init(viewport, battler)
# EVENT VALUE CALLS
# --Obtain the Sideview switch
$sv_mirror = $sideview_mirror
$sv_mirror = 0 if $sideview_mirror == nil
# -- Obtain the max party size
$max_member = $formation_max_member
$max_member = 4 if $formation_max_member == nil
# --Obtain the highest position for the formation
$formation_top = $formation_max_height
$formation_top = 220 if $formation_max_height == nil
# --Obtain the formation's width
$formation_width = $formation_max_width
$formation_width = 128 if $formation_max_width == nil
# --Obtain the height of the Battlestatus Window
$battlestat_height = $battlestatus_height
$battlestat_height = 160 if $battlestatus_height == nil
end
end
#==============================================================================
# ** Animated Battlers - Enhanced ver. 7.7 (03-29-2007)
#
#------------------------------------------------------------------------------
# * (3) Sprite System: The Sprite Battler Class
#==============================================================================
#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
# This sprite is used to display the battler.It observes the Game_Character
# class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
alias mnk_update update
def update
return unless @battler
if @battler.battler_name != @battler_name
@started = false
end
# Regular Update
mnk_update
# Set Translucency
if @battler.is_a?(Game_Actor) and @battler_visible
if @translucent_actor.include?(@battler.id)
if @battler.hidden
self.opacity = 0
else
self.opacity = @translucency
end
end
end
if @battler.is_a?(Game_Enemy) and @battler_visible
if @translucent_enemy.include?(@battler.id)
if @battler.hidden
self.opacity = 0
else
self.opacity = @translucency
end
end
end
# Reset hash for Advanced Pose/Frames
pose_temp = {}
# Start Routine
unless @started
@pose = state
if @battler.is_a?(Game_Enemy)
if not $default_enemy
if $default_enemy_id == nil
# Set up Spritesheet Standards
frametmp = @frames
if @frames_enemy != nil
if @frames_enemy.include?(@battler.id)
frametmp = @frames_enemy[@battler.id] if @frames_enemy[@battler.id] != nil
end
end
@width = @width / frametmp
posetmp = @poses
if @poses_enemy != nil
if @poses_enemy.include?(@battler.id)
posetmp = @poses_enemy[@battler.id] if @poses_enemy[@battler.id] != nil
end
end
@height = @height / posetmp
else
if not $default_enemy_id.include?(@battler.id)
frametmp = @frames
if @frames_enemy != nil
if @frames_enemy.include?(@battler.id)
frametmp = @frames_enemy[@battler.id] if @frames_enemy[@battler.id] != nil
end
end
@width = @width / frametmp
posetmp = @poses
if @poses_enemy != nil
if @poses_enemy.include?(@battler.id)
posetmp = @poses_enemy[@battler.id] if @poses_enemy[@battler.id] != nil
end
end
@height = @height / posetmp
end
end
end
end
# Turn off Casting pose
@battler.casted = false
@battler.casting = false
if @battler.is_a?(Game_Actor)
if not $default_actor
if $default_actor_id == nil
# Set up Spritesheet Standards
frametmp = @frames
if @frames_actor != nil
if @frames_actor.include?(@battler.id)
frametmp = @frames_actor[@battler.id] if @frames_actor[@battler.id] != nil
end
end
@width = @width / frametmp
posetmp = @poses
if @poses_actor != nil
if @poses_actor.include?(@battler.id)
posetmp = @poses_actor[@battler.id] if @poses_actor[@battler.id] != nil
end
end
@height = @height / posetmp
else
if not $default_actor_id.include?(@battler.id)
frametmp = @frames
if @frames_actor != nil
if @frames_actor.include?(@battler.id)
frametmp = @frames_actor[@battler.id] if @frames_actor[@battler.id] != nil
end
end
@width = @width / frametmp
posetmp = @poses
if @poses_actor != nil
if @poses_actor.include?(@battler.id)
posetmp = @poses_actor[@battler.id] if @poses_actor[@battler.id] != nil
end
end
@height = @height / posetmp
end
end
end
end
@battler_offset = @width * 0.75
@display_x = @battler.screen_x
@display_y = @battler.screen_y
@display_z = @battler.screen_z
@destination_x = @display_x
@destination_y = @display_y
@destination_z = @display_z
if @fade_in
self.opacity = 0
end
@started = true
end
if @pose == nil
@pose = state
end
# Cut Out Frame
# Enemy Battler Routine
if @battler.is_a?(Game_Enemy)
if $default_enemy
self.src_rect.set(@width * 0, @height * 0, @width, @height)
else
if $default_enemy_id !=nil
if $default_enemy_id.include?(@battler.id)
self.src_rect.set(@width * 0, @height * 0, @width, @height)
else
if @pose != nil
if @frame != nil
self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
end
end
end
else
if @pose != nil
if @frame != nil
self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
end
end
end
end
end
# Actor Battler Routine
if @battler.is_a?(Game_Actor)
if $default_actor
self.src_rect.set(@width * 0, @height * 0, @width, @height)
else
if $default_actor_id !=nil
if $default_actor_id.include?(@battler.id)
self.src_rect.set(@width * 0, @height * 0, @width, @height)
else
if @pose != nil
if @frame != nil
self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
end
end
end
else
if @pose != nil
if @frame != nil
self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
end
end
end
end
end
# Position Sprite
self.x = @display_x
self.y = @display_y
self.z = @display_z
self.ox = @width / 2
self.oy = @height
# Adjust sprite direction if facing the other way...
if $sv_mirror == 1
if @battler.is_a?(Game_Actor)
self.mirror = !!battler
else
if not @mirror_enemies
self.mirror = !!battler
end
end
else
if @battler.is_a?(Game_Enemy)
if @mirror_enemies
self.mirror = !!battler
end
end
end
# Setup Frames per Pose
poseframe = @frames_standard
poseframe = @frames_per_pose[@pose] if @frames_per_pose.include?(@pose)
# Set Advanced Poses for Actors
if @battler.is_a?(Game_Actor)
pose_temp = $poses_actor[@battler.id] if $poses_actor.include?(@battler.id)
poseframe = pose_temp[@pose] if pose_temp.include?(@pose)
end
# Set Advanced Poses for Enemies
if @battler.is_a?(Game_Enemy)
pose_temp = $poses_enemy[@battler.id] if $poses_enemy.include?(@battler.id)
poseframe = pose_temp[@pose] if pose_temp.include?(@pose)
end
# Setup Animation
time = Graphics.frame_count / (Graphics.frame_rate / @speed)
if @last_time < time
@frame = (@frame + 1) % poseframe
if @frame == 0
if @freeze
@frame = poseframe - 1
return
end
@pose = state
end
end
@last_time = time
# Setup Dying Animation
if @battler.dead?
if @dying == true
@pose = state
@dying = false
end
else
# Setup/Ready for Battle (Let's get ready to RUMBLE!)
if @s_pose == false
tmp_pose = pose_obtain(@poses_setup, @poses_setup_a, @poses_setup_e)
if tmp_pose != nil
@pose = tmp_pose
@s_pose = true
end
end
if @battler.is_a?(Game_Actor)
if $victory == true
if @winning == true
@pose = state
@winning = false
end
end
end
end
# Move It
move if moving
end
#--------------------------------------------------------------------------
# * Current State
#--------------------------------------------------------------------------
def state
@statusd = false
unless @battler.dead?
if @battler.is_a?(Game_Enemy) and @translucent_enemy.include?(@battler.id)
if @battler.hidden
self.opacity = 0
else
self.opacity = @translucency
end
end
if @battler.is_a?(Game_Actor) and @translucent_actor.include?(@battler.id)
if @battler.hidden
self.opacity = 0
else
self.opacity = @translucency
end
end
end
# Damage State
if [nil,{}].include?(@battler.damage)
# Battler Fine
@state = pose_obtain($p1, $ap1, $ep1)
# Battler Wounded
temp_percentage = @low_hp_percentage
if @battler.is_a?(Game_Actor)
temp_percentage = @low_hp_actor[@battler.id] if @low_hp_actor[@battler.id] != nil
end
if @battler.is_a?(Game_Enemy)
temp_percentage = @low_hp_enemy[@battler.id] if @low_hp_enemy[@battler.id] != nil
end
if @battler.hp < @battler.maxhp * temp_percentage
@state = pose_obtain($p3, $ap3, $ep3)
@statusd = true
end
# Battler Status-Effect
for i in @battler.states
tmp_pose2 = pose_array_obtain(@poses_status, @poses_stat_a, @poses_stat_e, i)
@state = tmp_pose2 if tmp_pose2 != nil
@statusd = true if tmp_pose2 != nil
end
# If Battler Dead
if @battler.dead?
# If using default battlers or default collapse
if (@default_collapse_actor and @battler.is_a?(Game_Actor)) or
(@default_collapse_enemy and @battler.is_a?(Game_Enemy)) or
($default_actor and @battler.is_a?(Game_Actor)) or
($default_enemy and @battler.is_a?(Game_Enemy)) or
($default_enemy_id.include?(@battler.id) and @battler.is_a?(Game_Enemy)) or
($default_actor_id.include?(@battler.id) and @battler.is_a?(Game_Actor))
# Do absolutely nothing :)
else
# Dying Animation pose
if @dying == true
tmp_pose = pose_obtain(@poses_dying, @poses_dying_a, @poses_dying_e)
if tmp_pose != nil
@state = tmp_pose
else
@state = pose_obtain($p11, $ap11, $ep11)
end
else
@state = pose_obtain($p11, $ap11, $ep11)
end
# Fix Opacity
if @battler.is_a?(Game_Enemy)
if @translucent_enemy.include?(@battler.id)
if @battler.hidden
self.opacity = 0
else
self.opacity = @translucency
end
else
if @battler.hidden
self.opacity = 0
else
self.opacity = 255
end
end
else
if @translucent_actor.include?(@battler.id)
if @battler.hidden
self.opacity = 0
else
self.opacity = @translucency
end
else
if @battler.hidden
self.opacity = 0
else
self.opacity = 255
end
end
end
end
end
end
# Casting State
if @battler.casted
if $para_spell_detect
if @battler.spelling?
tmp_pose = pose_obtain(@poses_casting, @poses_casting_a, @poses_casting_e)
tmp_pose2 = pose_array_obtain(@p_skill_casted, @p_skill_casted_a, @p_skill_casted_e, @battler.skill_casted)
tmp_pose = tmp_pose2 if tmp_pose2 != nil
@state = tmp_pose if tmp_pose != nil
end
else
if $scd_detect
if @battler.sd_casting
tmp_pose = pose_obtain(@poses_casting, @poses_casting_a, @poses_casting_e)
tmp_pose2 = pose_array_obtain(@p_skill_casted, @p_skill_casted_a, @p_skill_casted_e, @battler.skill_casted)
tmp_pose = tmp_pose2 if tmp_pose2 != nil
@state = tmp_pose if tmp_pose != nil
end
end
if @battler.rtp != 0
tmp_pose = pose_obtain(@poses_casting, @poses_casting_a, @poses_casting_e)
tmp_pose2 = pose_array_obtain(@p_skill_casted,@p_skill_casted_a,@p_skill_casted_e,@battler.skill_casted)
tmp_pose = tmp_pose2 if tmp_pose2 != nil
@state = tmp_pose if tmp_pose != nil
end
end
end
# Victory State
if @battler.is_a?(Game_Actor)
if $victory
if not @battler.dead?
if @winning == true
if @poses_winning != nil
tmp_pose = pose_obtain(@poses_winning, @poses_winning_a, @poses_winning_e)
@state = tmp_pose if tmp_pose != nil
end
else
tmp_pose = $p10
tmp_pose = $ap10[@battler.id] if $ap10[@battler.id] != nil
@state = tmp_pose
if not @poses_winning_loops.include?(@battler.id)
@freeze = true
end
end
else
if not @battler.dead?
tmp_pose = $p10
tmp_pose = $ap10[@battler.id] if $ap10[@battler.id] != nil
@state = tmp_pose
if not @poses_winning_loops.include?(@battler.id)
@freeze = true
end
end
end
end
# Perform check for Enemies
else
if $defeat
if not @battler.dead?
if @winning == true
if @poses_winning != nil
tmp_pose = pose_obtain(@poses_winning, @poses_winning_a, @poses_winning_e)
@state = tmp_pose if tmp_pose != nil
end
else
tmp_pose = $p10
tmp_pose = $ap10[@battler.id] if $ap10[@battler.id] != nil
@state = tmp_pose
if not @poses_winning_loops.include?(@battler.id)
@freeze = true
end
end
else
if not @battler.dead?
tmp_pose = $p10
tmp_pose = $ap10[@battler.id] if $ap10[@battler.id] != nil
@state = tmp_pose
if not @poses_winning_loops.include?(@battler.id)
@freeze = true
end
end
end
end
end
# Guarding State (not if dead OR in victory)
if not @battler.dead?
if not $victory
if @statusd == false
@state = pose_obtain($p4, $ap4, $ep4) if @battler.guarding?
end
end
end
# Moving State
if moving
# Adjust sprite direction if facing the other way...
if $sv_mirror == 1
# If enemy battler moving
if @battler.is_a?(Game_Enemy)
# Battler Moving Left
@state = pose_obtain($p5, $ap5, $ep5) if moving.eql?(0)
# Battler Moving Right
@state = pose_obtain($p6, $ap6, $ep6) if moving.eql?(1)
# Else actor battler moving
else
# Battler Moving Left
@state = pose_obtain($p6, $ap6, $ep6) if moving.eql?(0)
# Battler Moving Right
@state = pose_obtain($p5, $ap5, $ep5) if moving.eql?(1)
end
else
# If enemy battler moving
if @battler.is_a?(Game_Enemy)
# Battler Moving Left
@state = pose_obtain($p6, $ap6, $ep6) if moving.eql?(0)
# Battler Moving Right
@state = pose_obtain($p5, $ap5, $ep5) if moving.eql?(1)
# Else actor battler moving
else
# Battler Moving Left
@state = pose_obtain($p5, $ap5, $ep5) if moving.eql?(0)
# Battler Moving Right
@state = pose_obtain($p6, $ap6, $ep6) if moving.eql?(1)
end
end
end
# Return State
return @state
end
#--------------------------------------------------------------------------
# * Move
#--------------------------------------------------------------------------
def move
time = Graphics.frame_count / (Graphics.frame_rate.to_f / (@speed * 5))
if @last_move_time < time
# Pause for Animation
return if @pose != state
opa = 255
if @battler.is_a?(Game_Enemy) and @translucent_enemy.include?(@battler.id)
opa = @translucency
end
if @battler.is_a?(Game_Actor) and @translucent_actor.include?(@battler.id)
opa = @translucency
end
# Phasing
if @phasing
d1 = (@display_x - @original_x).abs
d2 = (@display_y - @original_y).abs
d3 = (@display_x - @destination_x).abs
d4 = (@display_y - @destination_y).abs
self.opacity = [opa - ([d1 + d2, d3 + d4].min * 1.75).to_i, 0].max
end
# Phasing per Actor/Enemy
if @battler.is_a?(Game_Actor)
if @phasing_actor.include?(@battler.id)
d1 = (@display_x - @original_x).abs
d2 = (@display_y - @original_y).abs
d3 = (@display_x - @destination_x).abs
d4 = (@display_y - @destination_y).abs
self.opacity = [opa - ([d1 + d2, d3 + d4].min * 1.75).to_i, 0].max
end
else
if @phasing_enemy.include?(@battler.id)
d1 = (@display_x - @original_x).abs
d2 = (@display_y - @original_y).abs
d3 = (@display_x - @destination_x).abs
d4 = (@display_y - @destination_y).abs
self.opacity = [opa - ([d1 + d2, d3 + d4].min * 1.75).to_i, 0].max
end
end
# Calculate Difference
difference_x = (@display_x - @destination_x).abs
difference_y = (@display_y - @destination_y).abs
difference_z = (@display_z - @destination_z).abs
# Done? Reset, Stop
if [difference_x, difference_y].max.between?(0, 8)
@display_x = @destination_x
@display_y = @destination_y
@display_z = @destination_z
@pose = state
return
end
# Calculate Movement Increments
increment_x = increment_y = 1
if difference_x < difference_y
increment_x = 1.0 / (difference_y.to_f / difference_x)
elsif difference_y < difference_x
increment_y = 1.0 / (difference_x.to_f / difference_y)
end
increment_z = increment_y
# Calculate Movement Speed
if @calculate_speed
total = 0; $game_party.actors.each{ |actor| total += actor.agi }
speed = @battler.agi.to_f / (total / $game_party.actors.size)
increment_x *= speed
increment_y *= speed
increment_z *= speed
end
# Multiply and Move
multiplier_x = @rush_speed * (@destination_x - @display_x > 0 ? 8 : -8)
multiplier_y = @rush_speed * (@destination_y - @display_y > 0 ? 8 : -8)
multiplier_z = @rush_speed * (@destination_z - @display_z > 0 ? 8 : -8)
@display_x += (increment_x * multiplier_x).to_i
@display_y += (increment_y * multiplier_y).to_i
@display_z += (increment_z * multiplier_z).to_i
end
@last_move_time = time
end
#--------------------------------------------------------------------------
# * Set Movement
#--------------------------------------------------------------------------
def setmove(destination_x, destination_y, destination_z)
unless (@battler.is_a?(Game_Enemy) and @stationary_enemies) or
(@battler.is_a?(Game_Actor) and @stationary_actors)
unless @stationary_weapons.include?(@battler.weapon_id) or
@stationary_skills.include?(@skill_used) or
@stationary_items.include?(@item_used)
@original_x = @display_x
@original_y = @display_y
@original_z = @display_z
@destination_x = destination_x
@destination_y = destination_y
@destination_z = destination_z
end
end
end
#--------------------------------------------------------------------------
# * Movement Check
#--------------------------------------------------------------------------
def moving
if (@display_x != @destination_x and @display_y != @destination_y and !@battler.dead?)
return (@display_x > @destination_x ? 0 : 1)
end
end
#--------------------------------------------------------------------------
# * Set Pose
#--------------------------------------------------------------------------
def pose=(pose)
@pose = pose
@frame = 0
end
#--------------------------------------------------------------------------
# * Freeze
#--------------------------------------------------------------------------
def freeze
@freeze = true
end
#--------------------------------------------------------------------------
# * Fallen Pose
#--------------------------------------------------------------------------
if @derv_anim_bat_stack.nil?
@derv_anim_bat_stack = true
alias mnk_collapse collapse
def collapse
if @default_collapse_enemy
mnk_collapse if @battler.is_a?(Game_Enemy)
end
if @default_collapse_actor
mnk_collapse if @battler.is_a?(Game_Actor)
end
if $default_enemy
mnk_collapse if @battler.is_a?(Game_Enemy)
end
if $default_actor
mnk_collapse if @battler.is_a?(Game_Actor)
end
if $default_enemy_id != nil
if $default_enemy_id.include?(@battler.id)
mnk_collapse if @battler.is_a?(Game_Enemy)
end
end
if $defend_actor.id != nil
if $default_actor_id.include?(@battler.id)
mnk_collapse if @battler.is_a?(Game_Actor)
end
end
end
end
#--------------------------------------------------------------------------
# * Obtain Pose
# pose_base : default pose to return
# pose_actor : list of poses for actors
# pose_enemy : list of poses for enemies
#--------------------------------------------------------------------------
def pose_obtain(pose_base, pose_actor, pose_enemy)
# create Arrays
pos_a = {}
pos_e = {}
# fill created Arrays & Set pose
pos_a = pose_actor
pos_e = pose_enemy
pose_now = pose_base
# Obtain pose if not a standard pose
if @battler.is_a?(Game_Actor)
pose_now = pos_a[@battler.id] if pos_a[@battler.id] != nil
else
pose_now = pos_e[@battler.id] if pos_e[@battler.id] != nil
end
return pose_now
end
#--------------------------------------------------------------------------
# * Obtain Pose from hashes
# hash_base : hash with default poses
# hash_actor : advanced list of poses for actors
# hash_enemy : advanced list of poses for enemies
# condition : value determining where to get the final pose
#--------------------------------------------------------------------------
def pose_array_obtain(hash_base, hash_actor, hash_enemy, condition)
# create Arrays
hash_b = {}
hash_a = {}
hash_e = {}
pose_temp = {}
# fill created Arrays & Set pose
hash_b = hash_base
hash_a = hash_actor
hash_e = hash_enemy
# Setup the temp Array
if @battler.is_a?(Game_Actor)
pose_temp = hash_a[@battler.id] if hash_a.include?(@battler.id)
else
pose_temp = hash_e[@battler.id] if hash_e.include?(@battler.id)
end
# Obtain the base pose based on condition (or nil)
pose_now = hash_b[condition] if hash_b.include?(condition)
# Obtain the optional actor/enemy pose based on condition (unless nil)
pose_now = pose_temp[condition] if pose_temp.include?(condition)
# Return the final pose
return pose_now
end
end
#==============================================================================
# ** Animated Battlers - Enhanced ver. 7.7 (03-29-2007)
#
#------------------------------------------------------------------------------
# * (4) Battle System: The Scene Battle class
#==============================================================================
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
alias mnkmain main
def main
# Obtain the formation style
# Only once per battle start
$formation = $formation_style
$formation = 0 if $formation_style == nil
# if Formation is random
if $formation == 8 then
$formation = rand(8).to_i
end
mnkmain
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 1 : action preparation)
#--------------------------------------------------------------------------
alias mkf_up4s1 update_phase4_step1
def update_phase4_step1(battler = @active_battler)
if $rtab_detected == true
mkf_up4s1(battler)
else
mkf_up4s1
end
if $scd_detect == true
if battler != nil
if battler.sd_casting
battler.casted = true
end
end
end
end
#--------------------------------------------------------------------------
# * End Skill Selection
#--------------------------------------------------------------------------
alias mkf_endss end_skill_select
def end_skill_select
mkf_endss
if $rtab_detected
@active_actor.skill_casted = @skill.id
else
@active_battler.skill_casted = @skill.id
end
end
#--------------------------------------------------------------------------
# * Make Skill Action Results (alias used to determine skill used)
#--------------------------------------------------------------------------
alias make_skill_action_result_anim make_skill_action_result
def make_skill_action_result(battler = @active_battler, plus_id = 0)
@rtab = !@target_battlers
if $RTAB_Connected_Attacking
make_skill_action_result_anim(battler, plus_id)
else
@rtab ? make_skill_action_result_anim(battler) : make_skill_action_result_anim
end
@skill_used = @skill.id
if $para_spell_detect == true
if battler.spelling?
battler.casted = true
end
end
end
#--------------------------------------------------------------------------
# * Make Item Action Results (alias used to determine item used)
#--------------------------------------------------------------------------
alias make_item_action_result_anim make_item_action_result
def make_item_action_result(battler = @active_battler)
@rtab = !@target_battlers
@rtab ? make_item_action_result_anim(battler) : make_item_action_result_anim
@item_used = @item.id
@item_usage = @item.scope
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 1 : action preparation) (Casting Routine)
#--------------------------------------------------------------------------
alias update_phase4_step1_anim update_phase4_step1
def update_phase4_step1(battler = @active_battler)
@rtab = !@target_battlers
if $rtab_detected == true
update_phase4_step1_anim(battler)
if battler.current_action.kind == 1 and
(not battler.current_action.forcing or @force != 2)
if battler.rtp != 0
battler.casted = true
end
end
else
update_phase4_step1_anim
end
end
#--------------------------------------------------------------------------
# * Action Animation, Movement
#--------------------------------------------------------------------------
alias mnk_update_phase4_step3 update_phase4_step3
def update_phase4_step3(battler = @active_battler)
@rtab = !@target_battlers
target = (@rtab ? battler.target : @target_battlers)[0]
# Battle Delay System
if $animbat_at_delay
# Fomar's Action Cost Detection
if $f_acb_detect
for actor in $game_party.actors
actor.vitality= 0
end
for enemy in $game_troop.enemies
enemy.vitality= 0
end
end
# Trickster's AT Detection
if $t_abs_detect
for actor in $game_party.actors
actor.at_multiplier= 0
end
for enemy in $game_troop.enemies
enemy.at_multiplier= 0
end
end
# Cogwheel RTAB Detection
if $rtab_detected
@rtab_wait_flag = true
end
end
# If enemy is a default battler
if battler.is_a?(Game_Enemy)
if $default_enemy
if @rtab then battler.white_flash = true end
if @rtab then battler.wait = 10 end
end
if $default_enemy_id != nil
if $default_enemy_id.include?(battler.id)
if @rtab then battler.white_flash = true end
if @rtab then battler.wait = 10 end
end
end
end
# If actor is a default battler
if battler.is_a?(Game_Actor)
if $default_actor
if @rtab then battler.white_flash = true end
if @rtab then battler.wait = 10 end
end
if $default_actor_id != nil
if $default_actor_id.include?(battler.id)
if @rtab then battler.white_flash = true end
if @rtab then battler.wait = 10 end
end
end
end
# Reset the 'Do Nothing' flag
dn_flag = false
# Set values and poses based on Action
case battler.current_action.kind
when 0 # Attack
# if Do Nothing, just return
if battler.current_action.basic == 3
dn_flag = true
end
if dn_flag != true
rush_type = $rush_attack
full_moving = true ; if rush_type; full_moving = false; end
if $move2center_atk.include?(battler.weapon_id); center_move=true ; end
if $stationary_enemyid.include?(battler.id) and battler.is_a?(Game_Enemy)
full_moving = false
center_move = false
rush_type = false
end
base_pose = pose_obtain(battler, $p7, $ap7, $ep7)
base_pose2 = pose_array_obtain(battler, $poses_weapons, $poses_weaps_a, $poses_weaps_e, battler.weapon_id)
base_pose = base_pose2 if base_pose2 != nil
if battler.current_action.basic == 2
# If escaping, disable all movement
full_moving = false
center_move = false
rush_type = false
# Set the graphics
temp_pose = pose_obtain(battler, $poses_escape, $poses_escape_a, $poses_escape_e)
base_pose = temp_pose if temp_pose != nil
end
end
when 1 # Skill
rush_type = $rush_skill
if $moving_skill_atk.include?(@skill_used) ; full_moving = true ; end
if $move2center_skill.include?(@skill_used) ; center_move = true ; end
base_pose = pose_obtain(battler, $p9, $ap9, $ep9)
base_pose2 = pose_array_obtain(battler, $poses_skills, $poses_skills_a, $poses_skills_e, @skill_used)
base_pose = base_pose2 if base_pose2 != nil
when 2 # Item
rush_type = $rush_item
if $moving_item_atk.include?(@item_used) or @item_scope == 1..2 ; full_moving = true ; end
if $move2center_item.include?(@item_used); center_move = true; end
base_pose = pose_obtain(battler, $p8, $ap8, $ep8)
base_pose2 = pose_array_obtain(battler, $poses_items, $poses_items_a, $poses_items_e, @item_used)
base_pose = base_pose2 if base_pose2 != nil
end
# Only perform action if 'Do Nothing' flag is off, ie... doing something...
if dn_flag != true
# Control Movement and use current pose
@moved = {} unless @moved
return if @spriteset.battler(battler).moving
if not (@moved[battler] or battler.guarding?)
offset = offset_value(battler)
if rush_type # Steps forward
@spriteset.battler(battler).setmove(battler.screen_x - offset, battler.screen_y + 1, battler.screen_z)
end
if full_moving # Runs to target
@spriteset.battler(battler).setmove(target.screen_x + offset, target.screen_y - 1, target.screen_z + 10)
end
if center_move # Runs to center
@spriteset.battler(battler).setmove(320+(offset/4), battler.screen_y-1, battler.screen_z)
end
@moved[battler] = true
return
@spriteset.battler(battler).pose = base_pose
elsif not battler.guarding?
@spriteset.battler(battler).pose = base_pose
@spriteset.battler(battler).setmove(battler.screen_x, battler.screen_y, battler.screen_z)
end
# Finish Up Skill and Item Use
case battler.current_action.kind
when 1
# Flag system that skill was used
battler.casted = false
battler.casting = false
@spriteset.battler(battler).skill_used = 0
when 2
# Flag system that item was used
@spriteset.battler(battler).item_used = 0
end
# Battle_Charge value for BattleCry script
$battle_charge = true
end
# Battle Delay System
if $animbat_at_delay
# Fomar's Action Cost Detection
if $f_acb_detect
for actor in $game_party.actors
actor.vitality= 1
end
for enemy in $game_troop.enemies
enemy.vitality= 1
end
end
# Trickster's AT Detection
if $t_abs_detect
for actor in $game_party.actors
actor.at_multiplier= 1.0
end
for enemy in $game_troop.enemies
enemy.at_multiplier= 1.0
end
end
# Cogwheel RTAB Detection
if $rtab_detected
@rtab_wait_flag = false
end
end
# Done
@moved[battler] = false
@rtab ? mnk_update_phase4_step3(battler) : mnk_update_phase4_step3
end
#--------------------------------------------------------------------------
# * Offset Calculation
#--------------------------------------------------------------------------
def offset_value(battler = @active_battler)
offst = @spriteset.battler(battler).battler_offset
offst += $rush_offset
if $sv_mirror == 1
offset = (battler.is_a?(Game_Actor) ? -(offst) : offst)
else
offset = (battler.is_a?(Game_Actor) ? offst : -(offst))
end
return offset
end
#--------------------------------------------------------------------------
# * Hit Animation
#--------------------------------------------------------------------------
alias mnk_update_phase4_step4 update_phase4_step4
def update_phase4_step4(battler = @active_battler)
for target in (@rtab ? battler.target : @target_battlers)
damage = (@rtab ? target.damage[battler] : target.damage)
critical = (@rtab ? target.critical[battler] : target.critical)
if damage.is_a?(Numeric) and damage > 0
base_pose = pose_obtain(target, $p2, $ap2, $ep2)
@spriteset.battler(target).pose = base_pose
if critical == true
temp_pose = pose_obtain(target, $poses_crit, $poses_crit_a, $poses_crit_e)
@spriteset.battler(target).pose = temp_pose if temp_pose != nil
end
end
end
@rtab ? mnk_update_phase4_step4(battler) : mnk_update_phase4_step4
end
#--------------------------------------------------------------------------
# * Victory Animation
#--------------------------------------------------------------------------
alias mnk_start_phase5 start_phase5
def start_phase5
for actor in $game_party.actors
return if @spriteset.battler(actor).moving
end
# See if an actor remains alive
for actor in $game_party.actors
unless actor.dead?
$victory = true
end
end
# See if an enemy remains alive
for enemy in $game_troop.enemies.reverse
unless enemy.dead?
$defeat = true
end
end
mnk_start_phase5
end
#--------------------------------------------------------------------------
# * Change Arrow Viewport
#--------------------------------------------------------------------------
alias mnk_start_enemy_select start_enemy_select
def start_enemy_select
mnk_start_enemy_select
@enemy_arrow.dispose
@enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2)
@enemy_arrow.help_window = @help_window
end
#--------------------------------------------------------------------------
# * Obtain Pose (Scene Battle version)
# battler : battler performing attack
# pose_base : default pose to return
# pose_actor : list of poses for actors
# pose_enemy : list of poses for enemies
#--------------------------------------------------------------------------
def pose_obtain(battler, pose_base, pose_actor, pose_enemy)
# create Arrays
pos_a = {}
pos_e = {}
# fill created Arrays & Set pose
pos_a = pose_actor
pos_e = pose_enemy
pose_now = pose_base
# Obtain pose if not a standard pose
if battler.is_a?(Game_Actor)
pose_now = pos_e[battler.id] if pos_a[battler.id] != nil
else
pose_now = pos_e[battler.id] if pos_e[battler.id] != nil
end
return pose_now
end
#--------------------------------------------------------------------------
# * Obtain Pose from hashes (Scene Battle version)
# battler : battler performing attack
# hash_base : hash with default poses
# hash_actor : advanced list of poses for actors
# hash_enemy : advanced list of poses for enemies
# condition : value determining where to get the final pose
#--------------------------------------------------------------------------
def pose_array_obtain(battler, hash_base, hash_actor, hash_enemy, condition)
# create Arrays
# create Arrays
hash_b = {}
hash_a = {}
hash_e = {}
pose_temp = {}
# fill created Arrays & Set pose
hash_b = hash_base
hash_a = hash_actor
hash_e = hash_enemy
# Setup the temp Array
if battler.is_a?(Game_Actor)
pose_temp = hash_a[battler.id] if hash_a.include?(battler.id)
else
pose_temp = hash_e[battler.id] if hash_e.include?(battler.id)
end
# Obtain the base pose based on condition (or nil)
pose_now = hash_b[condition] if hash_b.include?(condition)
# Obtain the optional actor/enemy pose based on condition (unless nil)
pose_now = pose_temp[condition] if pose_temp.include?(condition)
# Return the final pose
return pose_now
end
end
#==============================================================================
# ** Animated Battlers - Enhanced ver. 7.7 (03-29-2007)
#
#------------------------------------------------------------------------------
# * (5) Miscellaneous: Formations, Viewport and various Detection routines.
#==============================================================================
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
# Additional values for the save/load feature
attr_accessor :mnk_sm # sideview mirror
attr_accessor :mnk_fmm # formation max members
attr_accessor :mnk_fmh # formation max height
attr_accessor :mnk_fmw # formation max width
attr_accessor :mnk_bh # battlestatus height
attr_accessor :mnk_fs # formation style
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias mnk_init initialize
def initialize
# Perform the original call
mnk_init
# Create the savable values
@mnk_sm = 0
@mnk_fmm = 4
@mnk_fmh = 220
@mnk_fmw = 128
@mnk_bh = 160
@mnk_fs = 0
end
end
#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
# This class performs save screen processing.
#==============================================================================
class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# * Write Save Data
# file : write file object (opened)
#--------------------------------------------------------------------------
alias mnk_wsd write_save_data
def write_save_data(file)
# Store the globals
$game_system.mnk_sm = $sideview_mirror
$game_system.mnk_fmm = $formation_max_member
$game_system.mnk_fmh = $formation_max_height
$game_system.mnk_fmw = $formation_max_width
$game_system.mnk_bh = $battlestatus_height
$game_system.mnk_fs = $formation_style
# Perform the original call
mnk_wsd(file)
end
end
#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
# This class performs load screen processing.
#==============================================================================
class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
alias mnk_rsd read_save_data
def read_save_data(file)
#Perform the original call
mnk_rsd(file)
# ReStore the globals
$sideview_mirror = $game_system.mnk_sm
$formation_max_member = $game_system.mnk_fmm
$formation_max_height = $game_system.mnk_fmh
$formation_max_width = $game_system.mnk_fmw
$battlestatus_height = $game_system.mnk_bh
$formation_style = $game_system.mnk_fs
end
end
#==============================================================================
# ** 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
#--------------------------------------------------------------------------
# * Actor X Coordinate
#--------------------------------------------------------------------------
def screen_x
# Determine minimum horizontal space between battlers
x_spacer = $formation_width / $max_member
if self.index != nil
case $formation
when 0 # DIAGONAL PATTERN 1
if $sv_mirror == 1
return self.index * -x_spacer + (($max_member+1)*x_spacer) #202
else
return self.index * x_spacer + (640-(($max_member+1)*x_spacer))#450
end
when 1 # DIAGONAL PATTERN 2
if $sv_mirror == 1
return self.index * x_spacer + x_spacer #64
else
return self.index * -x_spacer + (640-x_spacer*2) #576
end
when 2 # 2-ROW SLANT
if $sv_mirror == 1
if self.index < ($max_member/2)
return self.index + (($max_member+1)*x_spacer) + (x_spacer * self.index)
else
return self.index + (x_spacer * self.index) - x_spacer * 0.5
end
else
if self.index < ($max_member/2)
return self.index + (640-(($max_member+1)* x_spacer)) + (-x_spacer * self.index)
else
return self.index + (640-((x_spacer*0.5)-x_spacer)) + (-x_spacer * self.index)
end
end
when 3 # 2 ROW - SLANT
if $sv_mirror == 1
if self.index < ($max_member/2)
return self.index + (x_spacer/2)+(($max_member+1)* x_spacer) + (-x_spacer * self.index)
else
return self.index + (($max_member+1)* x_spacer) + (-x_spacer * self.index)
end
else
if self.index < ($max_member/2)
return self.index + 442 + (x_spacer * self.index)
else
return self.index + 430 + (x_spacer * self.index)
end
end
when 4 # Column Pattern 1
if $sv_mirror == 1
if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )
return self.index + ($max_member*(x_spacer*1.5)) + (-(x_spacer*1.5) * (self.index-1))
else
return self.index + ($max_member*(x_spacer*1.5)) + (-(x_spacer*1.5) * self.index)
end
else
if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )
return self.index + 640-($max_member*(x_spacer*1.5)) + ((x_spacer*1.5) * (self.index-1))
else
return self.index + 640-($max_member*(x_spacer*1.5)) + ((x_spacer*1.5) * self.index)
end
end
when 5 # Column Pattern 2
if $sv_mirror == 1
if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )
return self.index + ($max_member*(x_spacer*1.5)) + (-(x_spacer*1.5) * (self.index-1))
else
return self.index + ($max_member*(x_spacer*1.5)) + (-(x_spacer*1.5) * self.index)
end
else
if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )
return self.index + 640-($max_member*(x_spacer*1.5)) + ((x_spacer*1.5) * (self.index-1))
else
return self.index + 640-($max_member*(x_spacer*1.5)) + ((x_spacer*1.5) * self.index)
end
end
when 6 # Wave Formation 1
if $sv_mirror == 1
if self.index < ($max_member/2)
return 170
else
return 90
end
else
if self.index < ($max_member/2)
return 470
else
return 550
end
end
else # Wave Formation 2
if $sv_mirror == 1
if self.index < ($max_member/2)
return 170
else
return 90
end
else
if self.index < ($max_member/2)
return 470
else
return 550
end
end
end
else
return 0
end
end
#--------------------------------------------------------------------------
# * Actor Y Coordinate
#--------------------------------------------------------------------------
def screen_y
# Determine minimum vertical space between battlers
y_spacer = (480 - $battlestat_height - $formation_top) / $max_member
if self.index != nil
case $formation
when 0
return self.index * (y_spacer*1.25) + $formation_top
when 1
return self.index * (y_spacer*1.25) + $formation_top
when 2
if self.index < ($max_member/2)
return $formation_top + ((y_spacer*2.5) * self.index)
else
return ($formation_top - (y_spacer*($max_member+1))) + ((y_spacer*2.5) * self.index) #was 60
end
when 3
if self.index < ($max_member/2)
return $formation_top + ((y_spacer*2.5) * self.index)
else
return ($formation_top - (y_spacer*($max_member+1))) + ((y_spacer*2.5) * self.index) # was 60
end
when 4
if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )
return $formation_top + ($battlestat_height/2)
else
return $formation_top + ($battlestat_height/6)
end
when 5
if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )
return $formation_top + ($battlestat_height/6)
else
return $formation_top + ($battlestat_height /2)
end
when 6
if self.index < ($max_member/2)
return $formation_top + (y_spacer * 2.5 * self.index)
else
return $formation_top + (y_spacer * 2.5 * ((self.index) - ($max_member/2)))
end
else
if self.index < ($max_member/2)
return $formation_top + (y_spacer*2.5*(($max_member/2)-1))+ (y_spacer * 2.5 * -self.index)
else
return $formation_top + (y_spacer*2.5*(($max_member/2)-1)) + (y_spacer * 2.5 * -((self.index) - ($max_member/2)))
end
end
end
end
#--------------------------------------------------------------------------
# * Actor Z Coordinate
#--------------------------------------------------------------------------
def screen_z
return screen_y
end
end
#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
# This class handles enemies. It's used within the Game_Troop class
# ($game_troop).
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * Get Battle Screen X-Coordinate
#--------------------------------------------------------------------------
def screen_x
if self.index != nil
if $sv_mirror == 1
return 640 - $data_troops[@troop_id].members[@member_index].x
else
return $data_troops[@troop_id].members[@member_index].x
end
end
end
end
#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
# This class brings together battle screen sprites. It's used within
# the Scene_Battle class.
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# * Change Enemy Viewport
#--------------------------------------------------------------------------
alias mnk_initialize initialize
def initialize
mnk_initialize
# Determine if RTAB system in use
if @real_zoom != nil
$rtab_detected = true
end
@enemy_sprites = []
for enemy in $game_troop.enemies.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport2, enemy))
end
# Tint the 2nd viewport that has ALL the battlers
@viewport2.tone=$game_screen.tone
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias mnk_update update
def update
mnk_update
# Reset the original viewport to 'untinted'
@viewport1.tone = Tone.new(0, 0, 0, 0)
end
#--------------------------------------------------------------------------
# * Find Sprite From Battler Handle
#--------------------------------------------------------------------------
def battler(handle)
for sprite in @actor_sprites + @enemy_sprites
return sprite if sprite.battler == handle
end
end
end
#==============================================================================
# ** Arrow_Base
#------------------------------------------------------------------------------
# This sprite is used as an arrow cursor for the battle screen. This class
# is used as a superclass for the Arrow_Enemy and Arrow_Actor classes.
#==============================================================================
class Arrow_Base < Sprite
#--------------------------------------------------------------------------
# * Reposition Arrows
#--------------------------------------------------------------------------
alias mnk_initialize initialize
def initialize(viewport)
mnk_initialize(viewport)
self.ox = 14
self.oy = 10
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
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :casted # if spell is casted
attr_accessor :casting # if currently casting
attr_accessor :skill_casted # ID of skill used
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias mnk_init initialize
def initialize
@casted = false
@casting = false
@skill_casted = 0
mnk_init
# ParaDog's Spell Delay Detection
if defined?(spelling?)
$para_spell_detect = true
end
# DBS Spell Delay Detection
if @sd_casting != nil
$scd_detect = true
end
# Fomar's Action Cost Detection
if @vitality != nil
$f_acb_detect = true
end
# Trickster's AT Detection
if @at_multiplier != nil
$t_abs_detect = true
end
end
end
#==============================================================================
# ** Animated Battlers - Enhanced ver. 7.7 (03-29-2007)
#
#------------------------------------------------------------------------------
# * (5) Miscellaneous: Formations, Viewport and various Detection routines.
#==============================================================================
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
# Additional values for the save/load feature
attr_accessor :mnk_sm # sideview mirror
attr_accessor :mnk_fmm # formation max members
attr_accessor :mnk_fmh # formation max height
attr_accessor :mnk_fmw # formation max width
attr_accessor :mnk_bh # battlestatus height
attr_accessor :mnk_fs # formation style
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias mnk_init initialize
def initialize
# Perform the original call
mnk_init
# Create the savable values
@mnk_sm = 0
@mnk_fmm = 4
@mnk_fmh = 220
@mnk_fmw = 128
@mnk_bh = 160
@mnk_fs = 0
end
end
#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
# This class performs save screen processing.
#==============================================================================
class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# * Write Save Data
# file : write file object (opened)
#--------------------------------------------------------------------------
alias mnk_wsd write_save_data
def write_save_data(file)
# Store the globals
$game_system.mnk_sm = $sideview_mirror
$game_system.mnk_fmm = $formation_max_member
$game_system.mnk_fmh = $formation_max_height
$game_system.mnk_fmw = $formation_max_width
$game_system.mnk_bh = $battlestatus_height
$game_system.mnk_fs = $formation_style
# Perform the original call
mnk_wsd(file)
end
end
#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
# This class performs load screen processing.
#==============================================================================
class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
alias mnk_rsd read_save_data
def read_save_data(file)
#Perform the original call
mnk_rsd(file)
# ReStore the globals
$sideview_mirror = $game_system.mnk_sm
$formation_max_member = $game_system.mnk_fmm
$formation_max_height = $game_system.mnk_fmh
$formation_max_width = $game_system.mnk_fmw
$battlestatus_height = $game_system.mnk_bh
$formation_style = $game_system.mnk_fs
end
end
#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
# This class brings together battle screen sprites. It's used within
# the Scene_Battle class.
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# * Change Enemy Viewport
#--------------------------------------------------------------------------
alias mnk_initialize initialize
def initialize
mnk_initialize
# Determine if RTAB system in use
if @real_zoom != nil
$rtab_detected = true
end
@enemy_sprites = []
for enemy in $game_troop.enemies.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport2, enemy))
end
# Tint the 2nd viewport that has ALL the battlers
@viewport2.tone=$game_screen.tone
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias mnk_update update
def update
mnk_update
# Reset the original viewport to 'untinted'
@viewport1.tone = Tone.new(0, 0, 0, 0)
end
#--------------------------------------------------------------------------
# * Find Sprite From Battler Handle
#--------------------------------------------------------------------------
def battler(handle)
for sprite in @actor_sprites + @enemy_sprites
return sprite if sprite.battler == handle
end
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
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :casted # if spell is casted
attr_accessor :casting # if currently casting
attr_accessor :skill_casted # ID of skill used
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias mnk_init initialize
def initialize
@casted = false
@casting = false
@skill_casted = 0
mnk_init
# ParaDog's Spell Delay Detection
if defined?(spelling?)
$para_spell_detect = true
end
# DBS Spell Delay Detection
if @sd_casting != nil
$scd_detect = true
end
# Fomar's Action Cost Detection
if @vitality != nil
$f_acb_detect = true
end
# Trickster's AT Detection
if @at_multiplier != nil
$t_abs_detect = true
end
end
end