Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=======================================================
- # Akea Animated Battle System
- # Author: Raizen
- # Community: http://www.centrorpg.com/
- # Compatibility: RMVXAce
- #=======================================================
- # =========================Don't modify==============================
- $imported ||= Hash.new
- $imported[:lune_animated_battle] = true
- module Lune_Anime_Battle
- Battle_Poses = []
- Battle_Position = []
- Actions = []
- Actor = []
- Enemy = []
- Enemy_Poses = []
- Conditions = []
- Actor_Conditions = Array.new(load_data("Data/Actors.rvdata2").size)
- Enemy_Conditions = Array.new(load_data("Data/Enemies.rvdata2").size)
- for n in 0...load_data("Data/Actors.rvdata2").size
- Actor_Conditions[n] = Array.new
- end
- for n in 0...load_data("Data/Enemies.rvdata2").size
- Enemy_Conditions[n] = Array.new
- end
- # =========================Don't modify==============================
- # Configuration starts here
- #=======================================================
- # INSTRUCTIONS
- # Most of the configuration is made here and on Database notetags
- # notetags -------
- #<castskill n>
- # castskills makes a battle animation on the user,
- # useful for elemental skill,
- # change the n for the id of the battle animation
- #<animation n>
- # animation makes a battle animation on the target,
- # useful for a skill that has many battle animations on a same
- # target, or healing spells on the allies
- # change the n for the id of the battle animation
- # <playmovie name>
- # movie animation, use it the way you use animation tag, put the movie name in the
- # place of the name.
- #<movement n>
- # movement is the battler moving sprites, this is preconfigured below on the script
- # the n is the id of the Action.
- #<move_hit n>
- # same as above, but the movement will be on the target
- #<wait_for n>
- # waits n frames before doing the next action
- #<make_hit n>
- # this function allows you to hit the enemy during the skill, replace n
- # with the % of damage of the skill, for examplo
- #<make_hit 10> will make 10% damage from the skill at the middle of the animation
- #<scriptcall n>
- # this function allows script calls during the battle animations,
- # just add as many as you want and call them by their id on notepad
- # put inside '' the script call from the script you are adding
- Script_Call[0] = 'akea_camera(0)'
- Script_Call[1] = 'akea_camera(1)'
- Script_Call[2] = 'akea_camera(2)'
- # Put if this damage will be shown on the message log, if using damage pop-ups
- # you can deactivate the show log function
- Show_On_Log = true
- # All these notetags can be added either on the skills, or the items
- #=======================================================
- # Correction of the attack position of the character
- Offset_X = 50 # Em X
- Offset_Y = 5 # Em Y
- # Correction of the attack position of the enemy
- E_Offset_X = -50
- E_Offset_Y = 5
- # Spritesheets, use one for each character
- # If there are more, put them in the same image
- # The image must be in the folder Graphics/Battlers
- # Battle_Poses[n] = 'Image Name' # n is the actor id on database
- Battle_Poses[1] = 'Erik'
- Battle_Poses[2] = 'Luna'
- Battle_Poses[3] = 'Safira2'
- Battle_Poses[4] = 'Monk'
- # Spritesheets, use one for each enemy
- # Same as above, the id is the enemy id on database,
- # if the enemy is not listed here, it will be used its
- # default graphics
- Enemy_Poses[8] = 'scorpion2'
- Enemy_Poses[31] = 'ifrito'
- Enemy_Poses[32] = 'bafomet'
- # Default configuration settings for the spritesheets
- # Actor[n] = {
- Actor[1] = {
- 'Frames' => 4, # Max Frames Quantity in the Spritesheet
- 'Positions' => 32, # Max Positions Quantity
- }
- Actor[2] = {
- 'Frames' => 4, # Max Frames Quantity in the Spritesheet
- 'Positions' => 32, # Max Positions Quantity
- }
- Actor[3] = {
- 'Frames' => 4, # Max Frames Quantity in the Spritesheet
- 'Positions' => 32, # Max Positions Quantity
- }
- Actor[4] = {
- 'Frames' => 4, # Max Frames Quantity in the Spritesheet
- 'Positions' => 32, # Max Positions Quantity
- }
- # With the enemies
- Enemy[8] = {
- 'Frames' => 4, # Max Frames Quantity in the Spritesheet
- 'Positions' => 14, # Max Positions Quantity
- }
- Enemy[31] = {
- 'Frames' => 4, # Max Frames Quantity in the Spritesheet
- 'Positions' => 14, # Max Positions Quantity
- }
- Enemy[32] = {
- 'Frames' => 4, # Max Frames Quantity in the Spritesheet
- 'Positions' => 32, # Max Positions Quantity
- }
- # Character position in battle, if there are more then 4,
- # just add new lines below.
- # Battle_Position[n] = [pos em x, pos em y]
- Battle_Position[0] = [400, 190]
- Battle_Position[1] = [440, 230]
- Battle_Position[2] = [400, 270]
- Battle_Position[3] = [440, 310]
- # Offset from initial position, for entrance animation, in case oyu
- # do not want that initial animation in battle, just Start_off = [0, 0, 0]
- # Where Start_off = [offset in x, offset in y, Action id]
- Start_off = [250, 0, 7]
- # Initial Animation, this animation can be addded on notetags in The actors
- # on database, these animation will be played in the beginning of the battle
- # for no animations, just leave the actors notetag in blank
- # true for all, false for one
- Start_all = false
- # Default standing animation
- Standard = {
- # Use the condition settings below to configure this part
- 'Stand' => 1, # default, when actor/enemy is standing
- 'Damage' => 2, # When hit
- 'Weak' => 3, # When low on HP
- 'Dead' => 4, # When fallen
- 'Victory' => 5, # Winning
- }
- # HP necessary to enter "weak" position in %
- Hp = 30
- #==============================================================================
- #------------------------------------------------------------------------------
- # Conditions - Here is configured the characters conditions
- # can be added as many as you like.
- # All of then have the same pattern
- # [Spritesheet line, speed of animation, number of frames, loops?, mirror?, time, turns]
- # speed of animation - the lowe the number the faster
- # number of frames - quantity of frames for this pose
- # loops? - if it loops the animation or finishes in the last frame(true or false)
- # mirror? - if it mirrors the sprite(true or false)
- # time - the time it will take to do the movement
- # tunrs - number of turns in this condition
- # To add it in a skill use <condition n> on notetags
- #------------------------------------------------------------------------------
- #==============================================================================
- #==============================================================================
- # Conditions[1] => Stand Condition
- #==============================================================================
- Conditions[1] = [0, 10, 4, true, false]
- #==============================================================================
- # Conditions[2] => Damage Condition
- #==============================================================================
- Conditions[2] = [3, 10, 4, false, false, 30]
- #==============================================================================
- # Conditions[3] => Weak Condition
- #==============================================================================
- Conditions[3] = [2, 15, 4, true, false, 30]
- #==============================================================================
- # Conditions[4] => Dead Condition
- #==============================================================================
- Conditions[4] = [12, 15, 4, false, false, 30]
- #==============================================================================
- # Conditions[5] => Victory Condition
- #==============================================================================
- Conditions[5] = [7, 10, 4, true, false, 30]
- #==============================================================================
- # Conditions[6] => Defense Condition
- #==============================================================================
- Conditions[6] = [1, 10, 4, false, false, 30, 2]
- # Specific conditions for party and enemies, for an actor configure as...
- # Actor_Conditions[actor_id][.....Same as Conditions
- # Or for enemies
- # Enemy_Conditions[enemy_id][....Same as conditions
- #==============================================================================
- # Conditions[1] => Stand Condition - Actor 1
- #==============================================================================
- Actor_Conditions[1][1] = [0, 10, 5, 2, false]
- #==============================================================================
- # Conditions[1] => Stand Condition - Enemy 1
- #==============================================================================
- Enemy_Conditions[1][1] = [0, 10, 5, 2, false]
- #==============================================================================
- #------------------------------------------------------------------------------
- # Actions - Here is defined the action animation of characters
- # Can be added as many as you want.
- #------------------------------------------------------------------------------
- #==============================================================================
- #==============================================================================
- #------------------------------------------------------------------------------
- # Movement Poses(1-20) - For organizing only
- #------------------------------------------------------------------------------
- #==============================================================================
- #==============================================================================
- # Actions[1] => go to target
- #==============================================================================
- Actions[1] = {
- 'Movement' => 'enemy', # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 25, # in frames
- 'Speed' => 2, # time taken to change the frame
- 'Frame' => 8, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => true, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[2] => return to position
- #==============================================================================
- Actions[2] = {
- 'Movement' => 'return', # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 15, # in frames
- 'Speed' => 2, # time taken to change the frame
- 'Frame' => 8, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => true, # if the animation loops
- 'Mirror' => true, # if mirrored
- }
- #==============================================================================
- # Actions[3] => movemento to the left
- #==============================================================================
- Actions[3] = {
- 'Movement' => [-100, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 5, # in frames
- 'Speed' => 10, # time taken to change the frame
- 'Frame' => 8, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => true, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[4] => movemento to the left(lower)
- #==============================================================================
- Actions[4] = {
- 'Movement' => [-30, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 10, # in frames
- 'Speed' => 5, # time taken to change the frame
- 'Frame' => 9, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => false, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[5] => movemento to the right
- #==============================================================================
- Actions[5] = {
- 'Movement' => [100, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 5, # in frames
- 'Speed' => 10, # time taken to change the frame
- 'Frame' => 8, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => true, # if the animation loops
- 'Mirror' => true, # if mirrored
- }
- #==============================================================================
- # Actions[6] => movemento to the right(lower)
- #==============================================================================
- Actions[6] = {
- 'Movement' => [30, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 10, # in frames
- 'Speed' => 5, # time taken to change the frame
- 'Frame' => 8, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => true, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[7] => go to initial position
- #==============================================================================
- Actions[7] = {
- 'Movement' => 'return', # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 40, # in frames
- 'Speed' => 2, # time taken to change the frame
- 'Frame' => 9, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => false, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[8] => return to initial position(no mirror)
- #==============================================================================
- Actions[8] = {
- 'Movement' => 'return', # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 15, # in frames
- 'Speed' => 2, # time taken to change the frame
- 'Frame' => 8, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => true, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[9] => movemento to the right(taking damage)
- #==============================================================================
- Actions[9] = {
- 'Movement' => [20, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 10, # in frames
- 'Speed' => 5, # time taken to change the frame
- 'Frame' => 3, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => true, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[10] => return to initial position (slower)
- #==============================================================================
- Actions[10] = {
- 'Movement' => 'return', # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 16, # in frames
- 'Speed' => 8, # time taken to change the frame
- 'Frame' => 8, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => true, # if the animation loops
- 'Mirror' => true, # if mirrored
- }
- #==============================================================================
- # Actions[11] => movement to the direction: up(taking damage)
- #==============================================================================
- Actions[11] = {
- 'Movement' => [0, -100], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 10, # in frames
- 'Speed' => 5, # time taken to change the frame
- 'Frame' => 3, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => true, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[12] => movement to the direction: up(jumping)
- #==============================================================================
- Actions[12] = {
- 'Movement' => [0, -60], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 10, # in frames
- 'Speed' => 5, # time taken to change the frame
- 'Frame' => 9, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => true, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[13] => movement to the direction: down(jumping)
- #==============================================================================
- Actions[13] = {
- 'Movement' => [0, 60], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 10, # in frames
- 'Speed' => 5, # time taken to change the frame
- 'Frame' => 9, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => true, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[14] => movement to the direction: right(jumping)
- #==============================================================================
- Actions[14] = {
- 'Movement' => [30, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 10, # in frames
- 'Speed' => 5, # time taken to change the frame
- 'Frame' => 9, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => true, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[15] => movement to the direction: down(taking damage)
- #==============================================================================
- Actions[15] = {
- 'Movement' => [0, 30], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 10, # in frames
- 'Speed' => 5, # time taken to change the frame
- 'Frame' => 3, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => true, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- #------------------------------------------------------------------------------
- # Static Poses(21-40) - For organization
- #------------------------------------------------------------------------------
- #==============================================================================
- #==============================================================================
- # Actions[21] => initial battle animation
- #==============================================================================
- Actions[21] = {
- 'Movement' => [0, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 40, # in frames
- 'Speed' => 10, # time taken to change the frame
- 'Frame' => 7, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => false, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[22] => spell cast
- #==============================================================================
- Actions[22] = {
- 'Movement' => [0, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 15, # in frames
- 'Speed' => 5, # time taken to change the frame
- 'Frame' => 10, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => false, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[23] => defense movement
- #==============================================================================
- Actions[23] = {
- 'Movement' => [0, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 30, # in frames
- 'Speed' => 10, # time taken to change the frame
- 'Frame' => 1, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => false, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[24] => taking damage
- #==============================================================================
- Actions[24] = {
- 'Movement' => [0, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 40, # in frames
- 'Speed' => 10, # time taken to change the frame
- 'Frame' => 3, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => false, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[25] => initial battle pose
- #==============================================================================
- Actions[25] = {
- 'Movement' => [0, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 40, # in frames
- 'Speed' => 10, # time taken to change the frame
- 'Frame' => 0, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => false, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- #------------------------------------------------------------------------------
- # Attack poses (41-and on)
- #------------------------------------------------------------------------------
- #==============================================================================
- #==============================================================================
- # Actions[41] => attack movement 1
- #==============================================================================
- Actions[41] = {
- 'Movement' => [0, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 22, # in frames
- 'Speed' => 3, # time taken to change the frame
- 'Frame' => 4, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => false, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[42] => attack movement 1 (mirrored)
- #==============================================================================
- Actions[42] = {
- 'Movement' => [0, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 12, # in frames
- 'Speed' => 3, # time taken to change the frame
- 'Frame' => 4, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => false, # if the animation loops
- 'Mirror' => true, # if mirrored
- }
- #==============================================================================
- # Actions[43] => attack movement 2
- #==============================================================================
- Actions[43] = {
- 'Movement' => [0, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 12, # in frames
- 'Speed' => 3, # time taken to change the frame
- 'Frame' => 5, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => false, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[44] => attack movement 2 (mirrored)
- #==============================================================================
- Actions[44] = {
- 'Movement' => [0, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 12, # in frames
- 'Speed' => 3, # time taken to change the frame
- 'Frame' => 5, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => false, # if the animation loops
- 'Mirror' => true, # if mirrored
- }
- #==============================================================================
- # Actions[45] => attack movement 3
- #==============================================================================
- Actions[45] = {
- 'Movement' => [0, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 12, # in frames
- 'Speed' => 3, # time taken to change the frame
- 'Frame' => 6, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => false, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[46] => attack movement 3 (mirrored)
- #==============================================================================
- Actions[46] = {
- 'Movement' => [0, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 12, # in frames
- 'Speed' => 3, # time taken to change the frame
- 'Frame' => 6, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => false, # if the animation loops
- 'Mirror' => true, # if mirrored
- }
- #==============================================================================
- # Actions[47] => attack movement 4
- #==============================================================================
- Actions[47] = {
- 'Movement' => [0, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 12, # in frames
- 'Speed' => 3, # time taken to change the frame
- 'Frame' => 13, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => false, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # Actions[48] => attack movement 5(on ar)
- #==============================================================================
- Actions[48] = {
- 'Movement' => [0, 0], # 'enemy' or [x, y] go to position in x and y
- 'Jump_Height' => 30, # Max Jump Height(0 for no jump)
- 'Time' => 12, # in frames
- 'Speed' => 3, # time taken to change the frame
- 'Frame' => 16, # position on the spritesheet
- 'Frames' => 4, #Max Frame quantity of this action on the spritesheet
- 'Looping' => false, # if the animation loops
- 'Mirror' => false, # if mirrored
- }
- #==============================================================================
- # HERE STARTS THE SCRIPT
- #==============================================================================
- end
- #==============================================================================
- # ** Scene_Battle
- #------------------------------------------------------------------------------
- # Esta classe executa o processamento da tela de batalha.
- #==============================================================================
- class Scene_Battle < Scene_Base
- alias :lune_anime_update :update
- alias :lune_anime_start :start
- alias :lune_anime_process_action :process_action
- alias :lune_anime_execute_action :execute_action
- alias :lune_anime_turn_end :turn_end
- #--------------------------------------------------------------------------
- # * Fase inicial
- #--------------------------------------------------------------------------
- def start(*args, &block)
- @start_battler_positions = Array.new
- $akea_hit_porcentage = 0
- for n in 0...$game_party.battle_members.size
- $game_party.battle_members[n].update_current_condition(0)
- $game_party.battle_members[n].screen_y = Lune_Anime_Battle::Battle_Position[n][1]
- $game_party.battle_members[n].screen_x = Lune_Anime_Battle::Battle_Position[n][0]
- @start_battler_positions << [all_battle_members[n].screen_x, all_battle_members[n].screen_y]
- $game_party.battle_members[n].screen_y += Lune_Anime_Battle::Start_off[1]
- $game_party.battle_members[n].screen_x += Lune_Anime_Battle::Start_off[0]
- end
- for n in 0...$game_troop.members.size
- $game_troop.members[n].update_current_condition(0)
- @start_battler_positions << [$game_troop.members[n].screen_x, $game_troop.members[n].screen_y]
- if Lune_Anime_Battle::Enemy[$game_troop.members[n].enemy_id]
- $game_troop.members[n].screen_x -= Lune_Anime_Battle::Start_off[0]
- $game_troop.members[n].screen_y -= Lune_Anime_Battle::Start_off[1]
- end
- end
- all_battle_members.each{|member| member.insert_actions}
- lune_anime_start(*args, &block)
- move_initial_battlers
- end
- #--------------------------------------------------------------------------
- # * Processamento pós-inicio
- #--------------------------------------------------------------------------
- def post_start
- super
- battle_start if @poss_start
- end
- #--------------------------------------------------------------------------
- # * Movimento inicial dos battlers
- #--------------------------------------------------------------------------
- def move_initial_battlers
- return if Lune_Anime_Battle::Start_off[2] == 0
- for n in 0...$game_party.battle_members.size
- insert_battle_commands(Lune_Anime_Battle::Start_off[2], $game_party.battle_members[n])
- end
- for n in 0...$game_troop.members.size
- if Lune_Anime_Battle::Enemy[$game_troop.members[n].enemy_id]
- insert_battle_commands(Lune_Anime_Battle::Start_off[2], $game_troop.members[n])
- end
- end
- @poss_start = false
- post_start
- @poss_start = true
- looping_basic_animations
- if Lune_Anime_Battle::Start_all
- for n in 0...$game_party.battle_members.size
- insert_start_commands_anime($game_party.battle_members[n])
- looping_basic_animations
- end
- else
- @random_anim = rand($game_party.battle_members.size)
- insert_start_commands_anime($game_party.battle_members[@random_anim])
- looping_basic_animations
- end
- end
- #--------------------------------------------------------------------------
- # * Animações iniciais dos battlers
- #--------------------------------------------------------------------------
- def looping_basic_animations
- loop do
- move_battlers_start
- Graphics.update
- @spriteset.update
- break if all_battle_members.count{|battler| battler.battle_actions.empty?} == all_battle_members.size
- end
- end
- #--------------------------------------------------------------------------
- # * Movimento inicial dos battlers
- #--------------------------------------------------------------------------
- def move_battlers_start
- move_battlers
- go_to_next_command = false
- for n in 0...all_battle_members.size
- unless all_battle_members[n].battle_actions.empty?
- all_battle_members[n].decrease_timer
- go_to_next_command = true
- if all_battle_members[n].battle_actions.first.size == 7
- show_normal_animation(all_battle_members[n].battle_actions.first[0], all_battle_members[n].battle_actions.first[1])
- all_battle_members[n].remove_actions
- return
- end
- if all_battle_members[n].battle_actions.first[2] <= 0
- if all_battle_members[n].battle_actions[1] == nil
- change_character_animation(all_battle_members[n].battle_actions.first[0], get_condition(n, all_battle_members[all_battle_members[n].battle_actions.first[0]].current_condition))
- end
- if all_battle_members[n].battle_actions[1] && all_battle_members[n].battle_actions[1].size == 13
- change_character_animation(all_battle_members[n].battle_actions[1][0], [all_battle_members[n].battle_actions[1][1],all_battle_members[n].battle_actions[1][10],all_battle_members[n].battle_actions[1][3],all_battle_members[n].battle_actions[1][4], all_battle_members[n].battle_actions[1][11]])
- all_battle_members[n].battle_actions[1][7] = (all_battle_members[n].battle_actions[1][5] - all_battle_members[n].screen_x) / all_battle_members[n].battle_actions[1][9]
- all_battle_members[n].battle_actions[1][8] = (all_battle_members[n].battle_actions[1][6] - all_battle_members[n].screen_y) / all_battle_members[n].battle_actions[1][9]
- end
- all_battle_members[n].remove_actions
- end
- end
- end
- if go_to_next_command
- return
- end
- end
- #--------------------------------------------------------------------------
- # * Execução da ação de inicio
- #--------------------------------------------------------------------------
- def insert_start_commands_anime(subject)
- @subject = subject
- battle_notes = @subject.actor.note
- for n in 0...battle_notes.size - 11
- if battle_notes[n..n+9] == "<movement "
- y = 0
- y += 1 until battle_notes[n+10+y] == '>'
- insert_battle_commands(battle_notes[n+10..n+9+y].to_i, @subject)
- elsif battle_notes[n..n+10] == "<animation "
- y = 0
- y += 1 until battle_notes[n+11+y] == '>'
- insert_battle_animations(battle_notes[n+11..n+11+y].to_i, @subject)
- elsif battle_notes[n..n+10] == "<castskill "
- y = 0
- y += 1 until battle_notes[n+11+y] == '>'
- insert_self_battle_animations(battle_notes[n+11..n+11+y].to_i, @subject)
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Movimento dos battlers
- #--------------------------------------------------------------------------
- def move_battlers
- for n in 0...all_battle_members.size
- next if all_battle_members[n].battle_actions.empty? || all_battle_members[n].battle_actions.first.size <= 7
- all_battle_members[n].execute_actions if all_battle_members.count {|battler| battler.battle_actions.size <= 1 } == all_battle_members.size || all_battle_members[n].battle_actions.size >= 2
- end
- end
- #--------------------------------------------------------------------------
- # * Obter Condição Atual
- #--------------------------------------------------------------------------
- def get_condition(n, condition)
- if all_battle_members[n].actor?
- if Lune_Anime_Battle::Actor_Conditions[all_battle_members[n].id][condition]
- return Lune_Anime_Battle::Actor_Conditions[all_battle_members[n].id][condition]
- else
- return Lune_Anime_Battle::Conditions[condition]
- end
- else
- if Lune_Anime_Battle::Enemy_Conditions[all_battle_members[n].enemy_id][condition]
- return Lune_Anime_Battle::Enemy_Conditions[all_battle_members[n].enemy_id][condition]
- else
- return Lune_Anime_Battle::Conditions[condition]
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Atualização de batalha
- #--------------------------------------------------------------------------
- def update(*args, &block)
- if $game_troop.all_dead?
- for n in 0...all_battle_members.size
- change_character_animation(n, Lune_Anime_Battle::Standard['Victory']) if all_battle_members[n].alive?
- end
- @adp_pics.each{|pic| pic.opacity = 0} if $imported[:akea_battledamage]
- BattleManager.process_victory
- end
- move_battlers
- go_to_next_command = false
- for n in 0...all_battle_members.size
- unless all_battle_members[n].battle_actions.empty?
- if all_battle_members[n].battle_actions.first[0] == "Wait_For" && all_battle_members[n].battle_actions.first[2] >= 1
- all_battle_members[n].decrease_timer
- p all_battle_members[n].battle_actions.first[2]
- next
- elsif all_battle_members[n].battle_actions.first[0] == "Script_Call" && all_battle_members[n].battle_actions.first[2] == 1
- all_battle_members[n].decrease_timer
- conf = Lune_Anime_Battle::Script_Call[all_battle_members[n].battle_actions.first[1]]
- eval(conf)
- if all_battle_members[n].battle_actions.first.size == 13 && all_battle_members[n].battle_actions.size > 1
- change_character_animation(all_battle_members[n].battle_actions[0][0], [all_battle_members[n].battle_actions[0][1],all_battle_members[n].battle_actions[0][10],all_battle_members[n].battle_actions[0][3],all_battle_members[n].battle_actions[0][4], all_battle_members[n].battle_actions[0][11]])
- end
- next
- elsif all_battle_members[n].battle_actions.first[0] == "Make_Hit"
- $akea_hit_porcentage = all_battle_members[n].battle_actions.first[1]
- use_item
- $akea_hit_porcentage = 0
- all_battle_members[n].remove_actions
- next
- elsif all_battle_members[n].battle_actions.first[0] == "Movie" && all_battle_members[n].battle_actions.first[2] == 1
- all_battle_members[n].decrease_timer
- Graphics.play_movie('Movies/' + all_battle_members[n].battle_actions.first[3])
- all_battle_members[n].remove_actions
- next
- end
- if all_battle_members[n].battle_actions.first[0].is_a?(Integer) && all_battle_members[n].battle_actions.first[0] != n
- all_battle_members[all_battle_members[n].battle_actions[0][0]].insert_actions(all_battle_members[n].battle_actions.first)
- all_battle_members[n].remove_actions
- return
- end
- all_battle_members[n].decrease_timer if all_battle_members.count {|battler| battler.battle_actions.size <= 1 } == all_battle_members.size || all_battle_members[n].battle_actions.size >= 2
- go_to_next_command = true
- if all_battle_members[n].battle_actions.first.size == 7 && all_battle_members[n].battle_actions.first[2] == $data_animations[all_battle_members[n].battle_actions.first[1]].frame_max - 1
- show_normal_animation(all_battle_members[n].battle_actions.first[0], all_battle_members[n].battle_actions.first[1])
- next
- elsif all_battle_members[n].battle_actions.first.size == 7 && all_battle_members[n].battle_actions.first[2] == 0
- all_battle_members[n].remove_actions
- if all_battle_members[n].battle_actions.first.size == 13
- change_character_animation(all_battle_members[n].battle_actions[0][0], [all_battle_members[n].battle_actions[0][1],all_battle_members[n].battle_actions[0][10],all_battle_members[n].battle_actions[0][3],all_battle_members[n].battle_actions[0][4], all_battle_members[n].battle_actions[0][11]])
- end
- end
- if all_battle_members[n].battle_actions.first[2] <= 0
- if all_battle_members[n].battle_actions[1] == nil
- change_character_animation(all_battle_members[n].battle_actions.first[0], get_condition(n, all_battle_members[all_battle_members[n].battle_actions.first[0]].current_condition))
- else
- if all_battle_members.count {|battler| battler.battle_actions.size <= 2 } == all_battle_members.size
- unless @akea_on_battle_moves
- all_battle_members[n].remove_actions if all_battle_members[n].battle_actions.size <= 2
- next
- end
- process_event
- lune_anime_process_action
- @akea_on_battle_moves = false
- all_battle_members.each{|m| change_character_animation(m.battle_actions[0][0], [m.battle_actions[0][1],m.battle_actions[0][10],m.battle_actions[0][3],m.battle_actions[0][4], m.battle_actions[0][11]]) unless m.battle_actions.empty?}
- end
- end
- if all_battle_members[n].battle_actions[1] && all_battle_members[n].battle_actions[1].size == 13
- if @akea_on_battle_moves && all_battle_members[n].battle_actions.size <= 2
- all_battle_members[n].remove_actions
- next
- end
- change_character_animation(all_battle_members[n].battle_actions[1][0], [all_battle_members[n].battle_actions[1][1],all_battle_members[n].battle_actions[1][10],all_battle_members[n].battle_actions[1][3],all_battle_members[n].battle_actions[1][4], all_battle_members[n].battle_actions[1][11]])
- all_battle_members[n].battle_actions[1][7] = (all_battle_members[n].battle_actions[1][5] - all_battle_members[n].screen_x) / all_battle_members[n].battle_actions[1][9]
- all_battle_members[n].battle_actions[1][8] = (all_battle_members[n].battle_actions[1][6] - all_battle_members[n].screen_y) / all_battle_members[n].battle_actions[1][9]
- end
- all_battle_members[n].remove_actions
- end
- end
- end
- if go_to_next_command
- super
- return
- end
- lune_anime_update(*args, &block) if all_battle_members.count {|battler| battler.battle_actions.size <= 1 } == all_battle_members.size
- end
- #--------------------------------------------------------------------------
- # * Processamento de ações
- #--------------------------------------------------------------------------
- def process_action
- if !@subject || !@subject.current_action
- @atbs_actions = []
- @subject = BattleManager.next_subject
- @reuse_targets = @subject.current_action.make_targets.compact if @subject && @subject.current_action
- if @subject && (@subject.actor? || Lune_Anime_Battle::Enemy[@subject.enemy_id]) && @subject.current_action
- battle_notes = @subject.current_action.item.note
- if @subject.current_action.item.id == 1 && @subject.actor? && @subject.equips[0] && @subject.current_action.item.is_a?(RPG::Skill)
- battle_notes = @subject.equips[0].note
- end
- @akea_on_battle_moves = true
- if battle_notes.include?('<teamskill') && $imported[:akea_team_battle]
- atbs_team_skill(battle_notes)
- return
- end
- for n in 0...battle_notes.size - 11
- if battle_notes[n..n+9] == "<movement "
- y = 0
- y += 1 until battle_notes[n+10+y] == '>'
- insert_battle_commands(battle_notes[n+10..n+9+y].to_i)
- elsif battle_notes[n..n+9] == "<wait_for "
- y = 0
- y += 1 until battle_notes[n+10+y] == '>'
- insert_battle_wait(battle_notes[n+10..n+9+y].to_i)
- elsif battle_notes[n..n+9] == "<wait_tar "
- y = 0
- y += 1 until battle_notes[n+10+y] == '>'
- for z in 0...@reuse_targets.size
- old_subject = @subject
- insert_battle_wait(battle_notes[n+10..n+9+y].to_i,@reuse_targets[z])
- @subject = old_subject
- end
- elsif battle_notes[n..n+9] == "<move_hit "
- y = 0
- y += 1 until battle_notes[n+10+y] == '>'
- for z in 0...@reuse_targets.size
- old_subject = @subject
- insert_battle_commands(battle_notes[n+10..n+9+y].to_i, @reuse_targets[z], @subject)
- @subject = old_subject
- end
- elsif battle_notes[n..n+11] == "<scriptcall "
- y = 0
- y += 1 until battle_notes[n+12+y] == '>'
- insert_battle_script(battle_notes[n+12..n+11+y].to_i)
- elsif battle_notes[n..n+9] == "<make_hit "
- y = 0
- y += 1 until battle_notes[n+10+y] == '>'
- insert_battle_damage(battle_notes[n+10..n+9+y].to_i)
- elsif battle_notes[n..n+10] == "<a_special "
- msgbox("Requires Akea Special Skill!!") unless $imported[:akea_special_skill]
- y = 0
- y += 1 until battle_notes[n+11+y] == '>'
- insert_akea_special(battle_notes[n+11..n+11+y].to_i)
- targets = @subject.current_action.make_targets.compact
- $game_troop.members.each {|troop| @spriteset.enemy_opacity($game_troop.members.index(troop), 0) unless targets.include?(troop)}
- $game_party.members.each {|actor| @spriteset.actor_opacity($game_party.members.index(actor), 0) unless @subject == actor}
- elsif battle_notes[n..n+10] == "<animation "
- y = 0
- y += 1 until battle_notes[n+11+y] == '>'
- insert_battle_animations(battle_notes[n+11..n+11+y].to_i)
- elsif battle_notes[n..n+10] == "<playmovie "
- y = 0
- y += 1 until battle_notes[n+11+y] == '>'
- insert_battle_animations(battle_notes[n+11..n+11+y])
- elsif battle_notes[n..n+10] == "<castskill "
- y = 0
- y += 1 until battle_notes[n+11+y] == '>'
- insert_self_battle_animations(battle_notes[n+11..n+11+y].to_i)
- elsif battle_notes[n..n+10] == "<condition "
- y = 0
- y += 1 until battle_notes[n+11+y] == '>'
- all_battle_members[@subject.index].current_condition = battle_notes[n+11..n+11+y].to_i
- end
- end
- return
- end
- end
- lune_anime_process_action
- end
- #--------------------------------------------------------------------------
- # * Adicionando animações do usuário
- #--------------------------------------------------------------------------
- def insert_battle_commands(n = 1, subject = nil, enen = nil)
- @subject = subject if subject
- action = Lune_Anime_Battle::Actions[n]
- enemy = @reuse_targets
- if action['Movement'].is_a?(String)
- if action['Movement'] == 'enemy'
- if @subject.actor?
- x = enemy.first.screen_x + Lune_Anime_Battle::Offset_X
- y = enemy.first.screen_y + Lune_Anime_Battle::Offset_Y
- else
- x = enemy.first.screen_x + Lune_Anime_Battle::E_Offset_X
- y = enemy.first.screen_y + Lune_Anime_Battle::E_Offset_Y
- end
- else
- index = 0
- if @subject.enemy?
- index += $game_party.battle_members.size
- end
- x = @start_battler_positions[@subject.index + index][0]
- y = @start_battler_positions[@subject.index + index][1]
- end
- else
- reserve_battle_actions = @subject.battle_actions.dup
- reserve_battle_actions.pop until reserve_battle_actions.empty? || reserve_battle_actions.last[0] == all_battle_members.index(@subject)
- if reserve_battle_actions.empty?
- x = action['Movement'][0] + @subject.screen_x
- y = action['Movement'][1] + @subject.screen_y
- if @subject.enemy?
- x -= action['Movement'][0] * 2
- end
- else
- x = action['Movement'][0] + reserve_battle_actions.last[5]
- y = action['Movement'][1] + reserve_battle_actions.last[6]
- if @subject.enemy?
- x -= action['Movement'][0] * 2
- y -= action['Movement'][1] * 2
- end
- end
- end
- get_to_x = (x - @subject.screen_x) / action['Time']
- get_to_y = (y - @subject.screen_y) / action['Time']
- if enen
- if enen.actor?
- @subject.insert_actions([all_battle_members.index(@subject),action['Frame'], action['Time'], action['Frames'], action['Looping'], x, y, get_to_x, get_to_y, action['Time'], action['Speed'], action['Mirror'], action['Jump_Height']])
- else
- enen.insert_actions([all_battle_members.index(@subject),action['Frame'], action['Time'], action['Frames'], action['Looping'], x, y, get_to_x, get_to_y, action['Time'], action['Speed'], action['Mirror'], action['Jump_Height']])
- end
- else
- @subject.insert_actions([all_battle_members.index(@subject),action['Frame'], action['Time'], action['Frames'], action['Looping'], x, y, get_to_x, get_to_y, action['Time'], action['Speed'], action['Mirror'], action['Jump_Height']])
- change_character_animation(@subject.battle_actions[0][0], [@subject.battle_actions[0][1],@subject.battle_actions[0][10],@subject.battle_actions[0][3],@subject.battle_actions[0][4], @subject.battle_actions[0][11]])
- end
- end
- #--------------------------------------------------------------------------
- # * Adicionando animações de batalha
- #--------------------------------------------------------------------------
- def insert_battle_animations(n = 0, dmg = 0)
- enemy = @reuse_targets
- if n == 0
- @subject.insert_actions(["Make_Hit", dmg])
- elsif n.is_a?(String)
- @subject.insert_actions(["Movie", dmg, 1, n])
- else
- @subject.insert_actions([enemy, n])
- @subject.battle_actions.last[2] = $data_animations[n].frame_max
- end
- if @subject.battle_actions.size == 1
- @subject.battle_actions.last[5] = 0
- @subject.battle_actions.last[6] = 0
- else
- @subject.battle_actions.last[5] = @subject.battle_actions[@subject.battle_actions.size - 2][5]
- @subject.battle_actions.last[6] = @subject.battle_actions[@subject.battle_actions.size - 2][6]
- @subject.insert_actions(@subject.battle_actions[@subject.battle_actions.size - 2])
- end
- end
- def insert_battle_damage(n)
- insert_battle_animations(0, n)
- end
- def insert_battle_script(n)
- @subject.insert_actions(["Script_Call", n, 1])
- end
- def insert_battle_wait(n, sub = nil)
- if sub
- sub.insert_actions(["Wait_For", 0, n])
- else
- @subject.insert_actions(["Wait_For", 0, n])
- end
- end
- #--------------------------------------------------------------------------
- # * Adicionando animações no usuário
- #--------------------------------------------------------------------------
- def insert_self_battle_animations(n = 0)
- enemy = [@subject]
- @subject.insert_actions([enemy, n])
- last_battler = false
- @subject.battle_actions.last[2] = $data_animations[n].frame_max
- for n in 0... @subject.battle_actions.size - 1
- last_battler = n if @subject.battle_actions[n][0] == @subject.index
- end
- if @subject.battle_actions.size == 1 || !last_battler
- @subject.battle_actions.last[5] = 0
- @subject.battle_actions.last[6] = 0
- else
- @subject.battle_actions.last[5] = @subject.battle_actions[last_battler][5]
- @subject.battle_actions.last[6] = @subject.battle_actions[last_battler][6]
- @subject.insert_actions(@subject.battle_actions[last_battler])
- end
- end
- #--------------------------------------------------------------------------
- # * Mudar a Sprite de batalha
- #--------------------------------------------------------------------------
- def change_character_animation(id, array)
- if array.is_a?(Integer)
- array = get_condition(id, array)
- end
- return if array[1] == nil
- all_battle_members[id].condition_time = array[6] if array[6] && all_battle_members[id].condition_time == 0
- all_battle_members[id].change_stance(array[0])
- all_battle_members[id].change_frames(array[1],array[2])
- all_battle_members[id].mirror_battler(array[4])
- all_battle_members[id].battler_loops?(array[3])
- all_battle_members[id].reset_count = true unless all_battle_members[id].dead?
- end
- #--------------------------------------------------------------------------
- # * Uso de habilidades/itens
- #--------------------------------------------------------------------------
- def use_item
- targets = @reuse_targets
- item = @subject.current_action.item
- if item.damage.type != 0 && item.damage.type != 3
- dm = Lune_Anime_Battle::Standard['Damage']
- targets.each {|target|
- change_character_animation(all_battle_members.index(target), dm)
- }
- end
- @log_window.display_use_item(@subject, item) if $akea_hit_porcentage == 0 || Lune_Anime_Battle::Show_On_Log
- @subject.use_item(item)
- refresh_status
- show_animation(targets, item.animation_id) if $akea_hit_porcentage == 0
- targets.each {|target| item.repeats.times { invoke_item(target, item) }}
- if $game_troop.all_dead? && $akea_hit_porcentage == 0
- for n in 0...all_battle_members.size
- change_character_animation(n, Lune_Anime_Battle::Standard['Victory']) if all_battle_members[n].alive?
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Execução da ação
- #--------------------------------------------------------------------------
- def execute_action
- lune_anime_execute_action
- return if $game_troop.all_dead?
- for n in 0...all_battle_members.size
- all_battle_members[n].current_hp_condition
- change_character_animation(n, get_condition(n, all_battle_members[n].current_condition))
- end
- end
- #--------------------------------------------------------------------------
- # * Final do turno
- #--------------------------------------------------------------------------
- def turn_end
- for n in 0...all_battle_members.size
- all_battle_members[n].condition_turn
- all_battle_members[n].update_current_condition(1)
- change_character_animation(n, get_condition(n, all_battle_members[n].current_condition))
- end
- lune_anime_turn_end
- end
- end
- #==============================================================================
- # ** Game_Enemy
- #------------------------------------------------------------------------------
- # Esta classe gerencia os inimigos. Ela é utilizada internamente pela
- # classe Game_Troop ($game_troop).
- #==============================================================================
- class Game_Enemy < Game_Battler
- alias :lunemy_anime_initialize :initialize
- #--------------------------------------------------------------------------
- # * Aquisição da ID da animação de ataque normal
- #--------------------------------------------------------------------------
- def atk_animation_id1
- 0
- end
- #--------------------------------------------------------------------------
- # * Aquisição da ID da animação de ataque normal
- #--------------------------------------------------------------------------
- def atk_animation_id2
- 0
- end
- attr_accessor :current_position
- attr_accessor :frame_count
- attr_accessor :frame_rate
- attr_accessor :frame_index
- attr_accessor :battler_mirror
- attr_accessor :looping_animation
- attr_accessor :reset_count
- #--------------------------------------------------------------------------
- # * Inicialização do objeto
- # actor_id : ID do herói
- #--------------------------------------------------------------------------
- def initialize(index, enemy_id)
- lunemy_anime_initialize(index, enemy_id)
- @battler_name = Lune_Anime_Battle::Enemy_Poses[enemy_id] if Lune_Anime_Battle::Enemy_Poses[enemy_id]
- @frame_count = 0
- @frame_rate = 0
- @current_position = 0
- @battler_mirror = false
- @looping_animation = 1
- @reset_count == true
- end
- #--------------------------------------------------------------------------
- # * Definição de uso de sprites
- #--------------------------------------------------------------------------
- def use_sprite?
- return true
- end
- #--------------------------------------------------------------------------
- # * Aquisição do coordenada Z na tela
- #--------------------------------------------------------------------------
- def screen_z
- return 110
- end
- #--------------------------------------------------------------------------
- # * Mudança de pose
- #--------------------------------------------------------------------------
- def change_stance(n)
- @current_position = n
- end
- #--------------------------------------------------------------------------
- # * Mudança de frames
- #--------------------------------------------------------------------------
- def change_frames(rate, index)
- @frame_count = 0
- @frame_rate = rate
- @frame_index = index
- end
- #--------------------------------------------------------------------------
- # * Espelhar o personagem?
- #--------------------------------------------------------------------------
- def mirror_battler(mirror = false)
- @battler_mirror = mirror
- end
- #--------------------------------------------------------------------------
- # * Loops?
- #--------------------------------------------------------------------------
- def battler_loops?(loop = 1)
- @looping_animation = loop
- end
- end
- #==============================================================================
- # ** Spriteset_Battle
- #------------------------------------------------------------------------------
- # Esta classe reune os sprites da tela de batalha. Esta classe é usada
- # internamente pela classe Scene_Battle.
- #==============================================================================
- class Spriteset_Battle
- #--------------------------------------------------------------------------
- # * Criação dos sprites dos heróis
- # Por padrão, não são exibidas imagens para os heróis.
- #--------------------------------------------------------------------------
- def create_actors
- @actor_sprites = $game_party.members.reverse.collect do |actor|
- Sprite_Battler.new(@viewport1, actor)
- end
- end
- end
- #==============================================================================
- # ** Game_Actor
- #------------------------------------------------------------------------------
- # Esta classe gerencia os heróis. Ela é utilizada internamente pela classe
- # Game_Actors ($game_actors). A instância desta classe é referenciada
- # pela classe Game_Party ($game_party).
- #==============================================================================
- class Game_Actor < Game_Battler
- alias :lune_anime_initialize :initialize
- attr_accessor :current_position
- attr_accessor :frame_count
- attr_accessor :frame_rate
- attr_accessor :frame_index
- attr_accessor :battler_mirror
- attr_accessor :looping_animation
- attr_accessor :reset_count
- #--------------------------------------------------------------------------
- # * Inicialização do objeto
- # actor_id : ID do herói
- #--------------------------------------------------------------------------
- def initialize(actor_id)
- lune_anime_initialize(actor_id)
- @battler_name = Lune_Anime_Battle::Battle_Poses[actor_id]
- @frame_count = 0
- @frame_rate = 0
- @current_position = 0
- @battler_mirror = false
- @looping_animation = 1
- @reset_count == true
- end
- #--------------------------------------------------------------------------
- # * Definição de uso de sprites
- #--------------------------------------------------------------------------
- def use_sprite?
- return true
- end
- #--------------------------------------------------------------------------
- # * Aquisição do coordenada Z na tela
- #--------------------------------------------------------------------------
- def screen_z
- return 110
- end
- #--------------------------------------------------------------------------
- # * Mudança de pose
- #--------------------------------------------------------------------------
- def change_stance(n)
- @current_position = n
- end
- #--------------------------------------------------------------------------
- # * Mudança de frames
- #--------------------------------------------------------------------------
- def change_frames(rate, index)
- @frame_count = 0
- @frame_rate = rate
- @frame_index = index
- end
- #--------------------------------------------------------------------------
- # * Espelhar o personagem?
- #--------------------------------------------------------------------------
- def mirror_battler(mirror = false)
- @battler_mirror = mirror
- end
- #--------------------------------------------------------------------------
- # * Loops?
- #--------------------------------------------------------------------------
- def battler_loops?(loop = 1)
- @looping_animation = loop
- end
- end
- #==============================================================================
- # ** Sprite_Battler
- #------------------------------------------------------------------------------
- # Este sprite é usado para exibir lutadores. Ele observa uma instância
- # da classe Game_Battler e automaticamente muda as condições do sprite.
- #==============================================================================
- class Sprite_Battler < Sprite_Base
- alias :lune_animation_initialize :initialize
- alias :lune_anime_update_bitmap :update_bitmap
- alias :lune_anime_revert_to_normal :revert_to_normal
- #--------------------------------------------------------------------------
- # * Inicialização do processo
- #--------------------------------------------------------------------------
- def initialize(viewport, battler = nil)
- lune_animation_initialize(viewport, battler)
- @charac_index = 0
- @charac_pattern = 0
- if @battler.actor? || Lune_Anime_Battle::Enemy[@battler.enemy_id]
- @battler.frame_index = get_condition(Lune_Anime_Battle::Standard['Stand'], 2)
- @battler.frame_rate = get_condition(Lune_Anime_Battle::Standard['Stand'], 1)
- @battler.frame_count = 0
- @battler.current_position = get_condition(Lune_Anime_Battle::Standard['Stand'], 0)
- end
- end
- def get_condition(condition, n)
- if @battler.actor?
- if Lune_Anime_Battle::Actor_Conditions[@battler.id][condition]
- return Lune_Anime_Battle::Actor_Conditions[@battler.id][condition][n]
- else
- return Lune_Anime_Battle::Conditions[condition][n]
- end
- else
- if Lune_Anime_Battle::Enemy_Conditions[@battler.enemy_id][condition]
- return Lune_Anime_Battle::Enemy_Conditions[@battler.enemy_id][condition][n]
- else
- return Lune_Anime_Battle::Conditions[condition][n]
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Atualização do retângulo de origem
- #--------------------------------------------------------------------------
- def update_battler_position
- update_battler_movement
- if @battler.enemy?
- @cut_w = bitmap.width / Lune_Anime_Battle::Enemy[battler.enemy_id]['Frames']
- @cut_h = bitmap.height / Lune_Anime_Battle::Enemy[battler.enemy_id]['Positions']
- else
- @cut_w = bitmap.width / Lune_Anime_Battle::Actor[battler.id]['Frames']
- @cut_h = bitmap.height / Lune_Anime_Battle::Actor[battler.id]['Positions']
- end
- sx = @charac_index * @cut_w
- sy = @battler.current_position * @cut_h
- self.src_rect.set(sx, sy, @cut_w, @cut_h)
- end
- #--------------------------------------------------------------------------
- # * Atualização do frame
- #--------------------------------------------------------------------------
- def update_battler_movement
- if @battler.reset_count == true
- @charac_index = 0
- @battler.reset_count = false
- end
- @battler.frame_count += 1
- self.mirror = @battler.battler_mirror
- return unless @battler.frame_count % @battler.frame_rate == 0
- if @battler.looping_animation == 2
- if @charac_index == (@battler.frame_index - 1)
- @battler.looping_condition = true
- @charac_index -= 1
- elsif @charac_index < (@battler.frame_index - 1)
- @battler.looping_condition = false if @charac_index == 0
- @battler.looping_condition ? @charac_index -= 1 : @charac_index += 1
- end
- elsif @charac_index == (@battler.frame_index - 1) && @battler.looping_animation == 1
- @charac_index = 0
- elsif @charac_index < (@battler.frame_index - 1)
- @charac_index += 1
- end
- end
- #--------------------------------------------------------------------------
- # * Atualização do bitmap de origem
- #--------------------------------------------------------------------------
- def update_bitmap
- lune_anime_update_bitmap
- update_battler_position if @battler.actor? || Lune_Anime_Battle::Enemy[@battler.enemy_id]
- end
- #--------------------------------------------------------------------------
- # * Atualização da origem
- #--------------------------------------------------------------------------
- def update_origin
- if bitmap
- if @battler.enemy? && !Lune_Anime_Battle::Enemy[@battler.enemy_id]
- self.ox = bitmap.width / 2
- self.oy = bitmap.height
- elsif @battler.enemy?
- self.ox = bitmap.width / (2* Lune_Anime_Battle::Enemy[battler.enemy_id]['Frames'])
- self.oy = bitmap.height / Lune_Anime_Battle::Enemy[battler.enemy_id]['Positions']
- else
- self.ox = bitmap.width / (2* Lune_Anime_Battle::Actor[battler.id]['Frames'])
- self.oy = bitmap.height / Lune_Anime_Battle::Actor[battler.id]['Positions']
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Voltar ao normal
- #--------------------------------------------------------------------------
- def revert_to_normal
- lune_anime_revert_to_normal
- return if (@battler.enemy? && !Lune_Anime_Battle::Enemy[@battler.enemy_id]) || !bitmap
- if @battler.enemy?
- self.ox = bitmap.width / (2* Lune_Anime_Battle::Enemy[battler.enemy_id]['Frames'])
- else
- self.ox = bitmap.width / (2* Lune_Anime_Battle::Actor[battler.id]['Frames'])
- end
- end
- #--------------------------------------------------------------------------
- # * Atualização do efeito de colapso
- #--------------------------------------------------------------------------
- def update_collapse
- return unless @battler.enemy?
- self.blend_type = 1
- self.color.set(255, 128, 128, 128)
- self.opacity = 256 - (48 - @effect_duration) * 6
- end
- end
- #==============================================================================
- # ** Game_Battler
- #------------------------------------------------------------------------------
- # Esta classe gerencia os battlers. Controla a adição de sprites e ações
- # dos lutadores durante o combate.
- # É usada como a superclasse das classes Game_Enemy e Game_Actor.
- #==============================================================================
- class Game_Battler < Game_BattlerBase
- alias :lune_anime_initialize_b :initialize
- alias :lune_anime_execute :execute_damage
- attr_accessor :current_condition
- attr_reader :battler_wait
- attr_accessor :screen_x
- attr_accessor :screen_y
- attr_accessor :battle_actions
- attr_accessor :condition_time
- attr_accessor :looping_condition
- attr_accessor :jump_height
- #--------------------------------------------------------------------------
- # * Inicialização do objeto
- #--------------------------------------------------------------------------
- def initialize
- lune_anime_initialize_b
- @battle_actions = Array.new
- @battler_wait = 0
- @screen_x = 0
- @screen_y = 0
- @condition_time = 0
- @starting_battle_x = 0
- @starting_battle_y = 0
- @jump_height = 0
- @looping_condition = false
- @current_condition = Lune_Anime_Battle::Standard['Stand']
- end
- def current_hp_condition
- hp_calc = self.hp * 100 / self.mhp
- if hp_calc > Lune_Anime_Battle::Hp
- @current_condition = Lune_Anime_Battle::Standard['Stand'] if @current_condition == Lune_Anime_Battle::Standard['Dead'] || @current_condition == Lune_Anime_Battle::Standard['Stand']
- return Lune_Anime_Battle::Standard['Stand']
- elsif self.hp != 0
- @current_condition = Lune_Anime_Battle::Standard['Weak'] if @current_condition == Lune_Anime_Battle::Standard['Dead'] || @current_condition == Lune_Anime_Battle::Standard['Stand']
- return Lune_Anime_Battle::Standard['Weak']
- else
- @current_condition = Lune_Anime_Battle::Standard['Dead']
- @battle_actions = []
- return Lune_Anime_Battle::Standard['Dead']
- end
- end
- def update_current_condition(condition)
- if self.hp == 0 || condition == 0 || @condition_time <= 0
- @current_condition = current_hp_condition
- @condition_time = 0
- return
- end
- end
- def insert_actions(array = 0)
- if array == 0
- @starting_battle_x = self.screen_x
- @starting_battle_y = self.screen_y
- @battle_actions = []
- else
- @battle_actions << array
- end
- @looping_condition = false
- end
- def unshift_actions(array = 0)
- if array == 0
- @battle_actions = []
- else
- @battle_actions.unshift(array)
- end
- @looping_condition = false
- end
- def execute_actions
- return if @battle_actions.empty?
- self.screen_x += @battle_actions.first[7]
- self.screen_y += @battle_actions.first[8] + get_jump_height
- if @battle_actions.first[2] <= 1
- self.screen_x = @battle_actions.first[5]
- self.screen_y = @battle_actions.first[6]
- @starting_battle_x = self.screen_x
- @starting_battle_y = self.screen_y
- end
- end
- def get_jump_height
- if @battle_actions.first[5] < @starting_battle_x
- jump_peak = (@starting_battle_x - @battle_actions.first[5])/2
- jump_peak += @battle_actions.first[5]
- pos_x = (jump_peak - self.screen_x).to_f / [jump_peak, 1].max
- [@battle_actions.first[12] * pos_x, @battle_actions.first[12]].min
- else
- jump_peak = (@battle_actions.first[5] - @starting_battle_x)/2
- jump_peak += @starting_battle_x
- pos_x = (jump_peak - self.screen_x).to_f / [jump_peak, 1].max
- pos_x *= -1
- [@battle_actions.first[12] * pos_x, @battle_actions.first[12]].min
- end
- end
- def decrease_timer
- return if @battle_actions.empty?
- @battle_actions.first[2] -= 1
- end
- def remove_actions
- if @battle_actions.size > 1 && @battle_actions[1][0].is_a?(Integer)
- get_to_x = (@battle_actions[1][5] - all_battle_members[@battle_actions[1][0]].screen_x) / @battle_actions[1][9]
- get_to_y = (@battle_actions[1][6] - all_battle_members[@battle_actions[1][0]].screen_y) / @battle_actions[1][9]
- @battle_actions[1][7] = get_to_x
- @battle_actions[1][8] = get_to_y
- end
- @battle_actions.shift
- end
- def condition_turn
- @condition_time -= 1
- end
- #--------------------------------------------------------------------------
- # * Aquisição combinada de todos os membros aliados e inimigos
- #--------------------------------------------------------------------------
- def all_battle_members
- $game_party.members + $game_troop.members
- end
- end
- #==============================================================================
- # ** Game_ActionResult
- #------------------------------------------------------------------------------
- # Esta classe gerencia os resultados das ações nos combates.
- # Esta classe é usada internamente pela classe Game_Battler.
- #==============================================================================
- class Game_ActionResult
- alias :akea_animated_make_damage :make_damage
- #--------------------------------------------------------------------------
- # * Criação do dano
- # value : valor do dano
- # item : objeto
- #--------------------------------------------------------------------------
- def make_damage(value, item)
- unless $akea_hit_porcentage == 0
- value *= $akea_hit_porcentage
- value /= 100
- value = value.to_i
- end
- akea_animated_make_damage(value, item)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement