Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # BASIMPLE BATTLE SYSTEM
- # Author Molegato
- # Version 3
- #------------------------------------------------------------------------------
- # The formerly least customizable battle system on the universe, now it's
- # HUGELY customizable! HUGE hooray!
- #==============================================================================
- $imported = {} if $imported.nil?
- $imported['Molegato-Basimple Battle System'] = true
- #==============================================================================
- # CONFIGURATION, YOU CAN TOUCH THIS
- #==============================================================================
- module MOLEGATO_BASIMPLE_BS
- # Default number of frames for the poses
- FRAME_NUMBER = 4
- # Animation Speed
- FRAME_SPEED = 0.1
- # movement ratio. The bigger, the slower the movement
- MOVEMENT_RATIO = 10
- # 0 -> default
- # 1 -> no effect
- # 2 -> all blink
- DAMAGE_EFFECT = 1
- #troops with @ in their name will never auto-arrange
- ARRANGE_ENEMIES = true
- #Number of frames for each normal pose
- #Only applies if INDIVIDUAL_FN is set true
- INDIVIDUAL_FN = false
- PF_STAND = 4
- PF_MOVE = 4
- PF_MOVE_BACK = 4
- PF_HURT = 4
- PF_ATTACK = 4
- PF_ITEM = 4
- PF_PHYSICAL = 4
- PF_MAGICAL = 4
- #----------------------------------------------------------------------------
- # All the options below this line can be changed in mid-game
- #----------------------------------------------------------------------------
- #0= heroes at left, 1= heroes at right
- SIDE = 0
- #distance to the border of the screen (horizontally)
- MARGIN = 75
- #distance to the top of the lowest member of the party
- VERTICAL_PARTY_POS = 325
- #vertical separation between members of the party
- VERTICAL_SEP = 25
- #for a diagonal-ish effect, horizontal separation between members of party
- DIAGONAL_POS = 30
- #Distance the battler will be away of its target while meleeing
- MELEE_DISTANCE = 25
- #Distance the battler will move forward while casting magic
- STEP_DISTANCE = 100
- # screen y for battlers that are attacking everyone
- CENTER_DOWN = 250
- #to mirror every battler. Useful if all your battlers are facing the left and you dont want to flip'em all
- GLOBAL_MIRROR = false
- #background panning, enable by setting true
- #if activated, background 2 will move more than background 1
- #You can set the multipliers for backgroun2 panning any ammount. 1 means normal movement
- BACK_PANNING = false
- BACKPANNING_X = 2
- BACKPANNING_Y = 1
- #z value for battleback 2. Default is 1. Set it to a value greater than
- # 500 for it to ve OVER the battlers. Useful for clouds/fog/etc
- BACK2_Z = 1
- #autoscrolls
- BACK1_SCROLL_X=0
- BACK1_SCROLL_Y=0
- BACK2_SCROLL_X=0
- BACK2_SCROLL_Y=0
- end
- #==============================================================================
- # TAG INSTRUCTIONS
- #------------------------------------------------------------------------------
- #--- For Actors/enemies:
- # <guard_anim: id>
- #Sets an animation for guarding
- # <enemy_size: size>
- # <actor_size: size>
- #Both control the size of the battler. 1 means normal.
- # <enem_attack_animation: id>
- #Sets the attack animation for an ENEMY.
- #--- For Skills/items:
- # <melee>
- #The battler gets near the target while performing action
- # <cast_anim: id>
- #Shows an animation on battler before moving
- # <melee_anim: id>
- #Shows an animation on battler after moving.
- # <custom_pose: name>
- #Uses a custom pose animation, rather than the default
- # <custom_pose: name, frame_max>
- # <custom_pose: name, frame_max, loop>
- #These two variations include the maximum frame number
- #and if the animation should loop or not. (1 for loop)
- # <camera: x,y,zoom,rate_move,rate_zoom>
- # <cast_zoom_on_user: zoom,rate>
- # <hit_zoom_on_user: zoom,rate>
- # <cast_zoom_on_target: zoom,rate>
- # <hit_zoom_on_target: zoom,rate>
- # <cast_zoom_center: zoom,rate>
- # <hit_zoom_center: zoom,rate>
- #--- CUSTOM CHAIN ACTIONS
- # You can use custom actions by adding those commands on a skill/item notes
- # <c_chain: wait,frames>
- # <c_chain: pose,name>
- # <c_chain: pose,name,frames,loop>
- # <c_chain: move,self/center/target,+x,+y,ratio>
- # <c_chain: animation,self/target,id>
- # <c_chain: autoanimation,self/target>
- # <c_chain: camera,self/center/target,+x,+y,zoom,ratio>
- # <c_chain: camera_normal,rate>
- # <c_chain: use_action>
- # <c_chain: end>
- # It follows this nomenclature:
- # <c_chain>
- # <c_chain: wait,frames>;
- # <c_chain: pose,name>;
- # <c_chain: end>;
- # </c_chain>
- #--- TIPS, TRICKS & WARNINGS
- # In the tags with parameters, parameters are separated only by ','
- # That means, <tag: this,this,this> is correct, and
- # <tag: this, this, this> is wrong
- # With custom chain actions, allways remember to call the
- # 'use_action' tag at least once, or the skill won't have effect.
- # Also remember to end every custom chain action with the 'end' tag.
- #==============================================================================
- #==============================================================================
- # MID GAME OPTION CHANGE VIA SCRIPT CALL INSTRUCTIONS
- #------------------------------------------------------------------------------
- # You can change any configuration in midgame via script call.
- # This can be useful for example, if you want a certain battle to have
- # a custom battler layout, or a certain map to have a dynamic battleback.
- #
- # To do so, use this code:
- # $game_system.basimple_options.YOUROPTION=NEW_VALUE
- # The only difference between the names of the options in this module and
- # in the script call is that the option names are all lowercase.
- # So for example, if you want to enable battleback panning, use this:
- # $game_system.basimple_options.back_panning=true
- #==============================================================================
- #==============================================================================
- # END OF CONFIGURATION. EVERYTHING UNDER HERE IS A HELLISH MESS OF DEFICIENT
- # AMATEUR SCRIPTING. BE AWARE THAT MESSING WITH IT CAN RESULT IN DISASTER
- #==============================================================================
- #===============================================================================
- # BASIMPLE_OPTIONS OBJECT
- # To be able to change the options in mid-game
- #===============================================================================
- class Basimple_options
- attr_accessor :side
- attr_accessor :margin
- attr_accessor :vertical_party_pos
- attr_accessor :vertical_sep
- attr_accessor :diagonal_pos
- attr_accessor :melee_distance
- attr_accessor :step_distance
- attr_accessor :center_down
- attr_accessor :global_mirror
- attr_accessor :back_panning
- attr_accessor :backpanning_x
- attr_accessor :backpanning_y
- attr_accessor :back2_z
- attr_accessor :back1_scroll_x
- attr_accessor :back1_scroll_y
- attr_accessor :back2_scroll_x
- attr_accessor :back2_scroll_y
- def initialize
- @side=MOLEGATO_BASIMPLE_BS::SIDE
- @margin=MOLEGATO_BASIMPLE_BS::MARGIN
- @vertical_party_pos=MOLEGATO_BASIMPLE_BS::VERTICAL_PARTY_POS
- @vertical_sep=MOLEGATO_BASIMPLE_BS::VERTICAL_SEP
- @diagonal_pos=MOLEGATO_BASIMPLE_BS::DIAGONAL_POS
- @melee_distance=MOLEGATO_BASIMPLE_BS::MELEE_DISTANCE
- @step_distance=MOLEGATO_BASIMPLE_BS::STEP_DISTANCE
- @center_down=MOLEGATO_BASIMPLE_BS::CENTER_DOWN
- @global_mirror=MOLEGATO_BASIMPLE_BS::GLOBAL_MIRROR
- @back_panning=MOLEGATO_BASIMPLE_BS::BACK_PANNING
- @backpanning_x=MOLEGATO_BASIMPLE_BS::BACKPANNING_X
- @backpanning_y=MOLEGATO_BASIMPLE_BS::BACKPANNING_Y
- @back2_z=MOLEGATO_BASIMPLE_BS::BACK2_Z
- @back1_scroll_x=MOLEGATO_BASIMPLE_BS::BACK1_SCROLL_X
- @back1_scroll_y=MOLEGATO_BASIMPLE_BS::BACK1_SCROLL_Y
- @back2_scroll_x=MOLEGATO_BASIMPLE_BS::BACK2_SCROLL_X
- @back2_scroll_y=MOLEGATO_BASIMPLE_BS::BACK2_SCROLL_Y
- end
- end
- #==============================================================================
- # ■ Game_System
- #==============================================================================
- class Game_System
- attr_accessor :basimple_options
- alias basimple_initialize initialize
- def initialize
- basimple_initialize
- @basimple_options=Basimple_options.new
- end
- end
- #==============================================================================
- # ■ BattleManager
- #==============================================================================
- module BattleManager
- def self.update_pos
- action_battlers = []
- action_battlers += $game_party.members unless @surprise
- action_battlers += $game_troop.members unless @preemptive
- action_battlers.each {|battler|
- battler.update_pos
- battler.frame+=MOLEGATO_BASIMPLE_BS::FRAME_SPEED
- if frame_string=battler.frame.round()>battler.max_frame_number-1
- if battler.action=='' or battler.action=='move' or battler.action=='move_back' and battler.custom==false
- battler.frame=0
- else
- if battler.action=='attack' or battler.action=='hurt' or battler.action=='item' or battler.action=='magical' or battler.action=='physical' and battler.custom==false
- battler.frame=battler.max_frame_number-1
- else
- if battler.custom_loop==true
- battler.frame=0
- else
- battler.frame=battler.max_frame_number-1
- end
- end
- end
- end
- }
- end
- def self.init_pos
- @action_battlers = []
- @action_battlers += $game_party.members unless @surprise
- @action_battlers += $game_troop.members unless @preemptive
- @action_battlers.each {|battler|
- battler.set_x=battler.screen_x
- battler.set_y=battler.screen_y
- battler.current_x=battler.screen_x
- battler.current_y=battler.screen_y
- }
- end
- #--------------------------------------------------------------------------
- # ● battle_start
- #--------------------------------------------------------------------------
- # overwritten for fun!!
- #--------------------------------------------------------------------------
- def self.battle_start
- $game_system.battle_count += 1
- $game_party.on_battle_start
- $game_troop.on_battle_start
- $game_troop.enemy_names.each do |name|
- $game_message.add(sprintf(Vocab::Emerge, name))
- end
- if @preemptive
- $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
- elsif @surprise
- $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
- end
- init_pos
- wait_for_message
- end
- end
- #==============================================================================
- # ■ Scene_Battle
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● start
- #--------------------------------------------------------------------------
- alias basimple_start start
- def start
- $cam_x=Graphics.width/2
- $cam_y=Graphics.height/2
- $cam_zoom=1.0
- @cam_goal_x=$cam_x
- @cam_goal_y=$cam_y
- @cam_goal_zoom=$cam_zoom
- @cam_move_rate=10
- @cam_zoom_rate=10
- basimple_start
- end
- #--------------------------------------------------------------------------
- # ● update_basic
- #--------------------------------------------------------------------------
- # there used to be an infinite loop here. Its gone now.
- #--------------------------------------------------------------------------
- alias basimple_update_basic update_basic
- def update_basic
- basimple_update_basic
- BattleManager.update_pos
- if @cam_goal_x!=$cam_x or @cam_goal_y!=$cam_y or @cam_goal_zoom!=$cam_zoom
- $cam_x=($cam_x*(@cam_move_rate-1)+@cam_goal_x)/@cam_move_rate
- $cam_y=($cam_y*(@cam_move_rate-1)+@cam_goal_y)/@cam_move_rate
- $cam_zoom=($cam_zoom*(@cam_zoom_rate-1)+@cam_goal_zoom)/@cam_zoom_rate
- $cam_x=@cam_goal_x if ($cam_x-@cam_goal_x).abs<0.01 or !$cam_x
- $cam_y=@cam_goal_y if ($cam_y-@cam_goal_y).abs<0.01 or !$cam_y
- $cam_zoom=@cam_goal_zoom if ($cam_zoom-@cam_goal_zoom).abs<0.01 or !$cam_zoom
- end
- end
- def camera_move(rate,x,y,zoom)
- @cam_move_rate=rate
- @cam_zoom_rate=rate
- @cam_goal_x=x
- @cam_goal_y=y
- @cam_goal_zoom=zoom
- end
- def camera_move_default(rate)
- @cam_goal_x=Graphics.width/2
- @cam_goal_y=Graphics.height/2
- @cam_goal_zoom=1.0
- @cam_move_rate=rate
- @cam_zoom_rate=rate
- end
- #--------------------------------------------------------------------------
- # ● use_item
- #--------------------------------------------------------------------------
- # i spent a big time here
- #--------------------------------------------------------------------------
- def use_item
- use_item_interpreted
- @subject.action=""
- @subject.frame=0
- end
- #USE ITEM INTERPRETED
- def use_item_interpreted
- item = @subject.current_action.item
- if not item.has_tag?("c_chain") or item.has_tag?("c_chain")==false
- use_item_normal
- return
- end
- #CORE
- @chain=item.tag_check_multiple_multivalues("c_chain")
- @chain.each do |action|
- #wait
- if action[0]=="wait"
- abs_wait(action[1].to_i())
- end
- #pose
- if action[0]=="pose"
- if action.size==2
- @subject.action=action[1]
- @subject.frame=0
- @subject.custom=false
- else
- @subject.action=action[1]
- @subject.custom_frame=action[2].to_i()
- @subject.custom_loop=false
- @subject.custom_loop=true if action[3].to_i()==1
- @subject.frame=0
- @subject.custom=true
- end
- end
- #move
- if action[0]=="move"
- if action[1]=="self"
- in_x=@subject.screen_x
- in_y=@subject.screen_y
- end
- if action[1]=="center"
- in_x=Graphics.width/2
- in_y=Graphics.height/2
- end
- if action[1]=="target"
- if item.for_all?
- in_x=Graphics.width/2
- in_x=$game_system.basimple_options.center_down
- else
- in_x=@subject.current_action.make_targets.compact[0].screen_x
- in_x=@subject.current_action.make_targets.compact[0].screen_y
- end
- end
- @subject.set_x=in_x+action[2].to_i()
- @subject.set_y=in_y+action[3].to_i()
- @subject.ratio=action[4].to_i()
- end
- #show animation
- if action[0]=="animation"
- if action[1]=="self"
- show_animation([@subject], action[2].to_i())
- end
- if action[1]=="target"
- show_animation(@subject.current_action.make_targets.compact, action[2].to_i())
- end
- end
- #show auto animation
- if action[0]=="autoanimation"
- if action[1]=="self"
- show_animation([@subject], item.animation_id)
- end
- if action[1]=="target"
- show_animation(@subject.current_action.make_targets.compact, item.animation_id)
- end
- end
- #camera
- if action[0]=="camera"
- if action[1]=="self"
- in_x=@subject.set_x
- in_y=@subject.set_y
- end
- if action[1]=="center"
- in_x=Graphics.width/2
- in_y=Graphics.height/2
- end
- if action[1]=="target"
- if item.for_all?
- in_x=Graphics.width/2
- in_x=$game_system.basimple_options.center_down
- else
- in_x=@subject.current_action.make_targets.compact[0].screen_x
- in_x=@subject.current_action.make_targets.compact[0].screen_y
- end
- end
- @cam_goal_x=in_x+action[2].to_i()
- @cam_goal_y=in_y+action[3].to_i()
- @cam_goal_zoom=action[4].to_f()
- @cam_move_rate=action[5].to_f()
- @cam_zoom_rate=action[5].to_f()
- end
- #camera_normal
- if action[0]=="camera_normal"
- camera_move_default(action[1].to_i())
- end
- #use_action
- if action[0]=="use_action"
- targets = @subject.current_action.make_targets.compact
- targets.each {|target| item.repeats.times {
- invoke_item(target, item)
- target.action=""
- } }
- end
- #set back to normal
- if action[0]=="end"
- @subject.custom=false
- @subject.ratio=MOLEGATO_BASIMPLE_BS::MOVEMENT_RATIO
- end
- end
- end
- # USE ITEM NORMAL
- def use_item_normal
- item = @subject.current_action.item
- #show cast anim
- if item.tag_check_multivalues(item.note,"cast_anim")
- show_animation([@subject], item.tag_check_multivalues(item.note,"cast_anim")[0].to_i())
- end
- @subject.action="move"
- @subject.frame=0
- @subject.ratio=MOLEGATO_BASIMPLE_BS::MOVEMENT_RATIO
- #change pos
- if item.has_tag?("melee")
- if item.for_all?
- @subject.set_x=Graphics.width/2
- @subject.set_y=$game_system.basimple_options.center_down
- else
- @subject.set_x=@subject.current_action.make_targets.compact[0].screen_x-$game_system.basimple_options.melee_distance*@subject.face_direction
- @subject.set_y=@subject.current_action.make_targets.compact[0].screen_y
- end
- end
- if not item.has_tag?("melee")
- if item.for_all?
- @subject.set_x=@subject.screen_x+$game_system.basimple_options.step_distance*@subject.face_direction
- @subject.set_y=$game_system.basimple_options.center_down
- else
- @subject.set_x=@subject.screen_x+$game_system.basimple_options.step_distance*@subject.face_direction
- @subject.set_y=@subject.current_action.make_targets.compact[0].screen_y
- end
- end
- #change zoom and camera
- if item.tag_check_multivalues(item.note,"camera")
- @cam_goal_x=item.tag_check_multivalues(item.note,"camera")[0].to_i()
- @cam_goal_y=item.tag_check_multivalues(item.note,"camera")[1].to_i()
- @cam_goal_zoom=item.tag_check_multivalues(item.note,"camera")[2].to_f()
- @cam_move_rate=item.tag_check_multivalues(item.note,"camera")[3].to_i()
- @cam_zoom_rate=item.tag_check_multivalues(item.note,"camera")[4].to_i()
- end
- if item.tag_check_multivalues(item.note,"cast_zoom_on_user")
- @cam_goal_x=@subject.set_x
- @cam_goal_y=@subject.set_y
- @cam_goal_zoom=item.tag_check_multivalues(item.note,"cast_zoom_on_user")[0].to_f()
- @cam_move_rate=item.tag_check_multivalues(item.note,"cast_zoom_on_user")[1].to_i()
- @cam_zoom_rate=item.tag_check_multivalues(item.note,"cast_zoom_on_user")[1].to_i()
- end
- if item.tag_check_multivalues(item.note,"cast_zoom_on_target")
- if item.for_all?
- @cam_goal_x=Graphics.width/2
- @cam_goal_y=$game_system.basimple_options.center_down
- else
- @cam_goal_x=@subject.current_action.make_targets.compact[0].screen_x
- @cam_goal_y=@subject.current_action.make_targets.compact[0].screen_y
- end
- @cam_goal_zoom=item.tag_check_multivalues(item.note,"cast_zoom_on_target")[0].to_f()
- @cam_move_rate=item.tag_check_multivalues(item.note,"cast_zoom_on_target")[1].to_i()
- @cam_zoom_rate=item.tag_check_multivalues(item.note,"cast_zoom_on_target")[1].to_i()
- end
- if item.tag_check_multivalues(item.note,"cast_zoom_center")
- @cam_goal_x=Graphics.width/2
- @cam_goal_y=Graphics.height/2
- @cam_goal_zoom=item.tag_check_multivalues(item.note,"cast_zoom_center")[0].to_f()
- @cam_move_rate=item.tag_check_multivalues(item.note,"cast_zoom_center")[1].to_i()
- @cam_zoom_rate=item.tag_check_multivalues(item.note,"cast_zoom_center")[1].to_i()
- end
- #wait for the movement
- abs_wait(30)
- #change graphic
- @subject.custom=false
- if item.tag_check_multivalues(item.note,"custom_pose")
- if item.tag_check_multivalues(item.note,"custom_pose").size>1
- @subject.custom_frame=item.tag_check_multivalues(item.note,"custom_pose")[1].to_i()
- else
- @subject.custom_frame=MOLEGATO_BASIMPLE_BS::FRAME_NUMBER
- end
- if item.tag_check_multivalues(item.note,"custom_pose").size>2
- @subject.custom_loop=(item.tag_check_multivalues(item.note,"custom_pose")[2].to_i()==1)
- else
- @subject.custom_loop=false
- end
- @subject.action=item.tag_check_multivalues(item.note,"custom_pose")[0]
- @subject.custom=true
- end
- custom=@subject.custom
- if item.is_a?(RPG:: Skill) && item.id == @subject.attack_skill_id
- if custom==false
- @subject.action="attack"
- end
- else
- if item.is_a?(RPG:: Skill) && item.id == @subject.guard_skill_id
- @subject.action="stand"
- #show guard anim
- if @subject.actor?
- if item.tag_check_multivalues(@subject.actor.note,"guard_anim")
- show_animation([@subject], item.tag_check_multivalues(@subject.actor.note,"guard_anim")[0].to_i())
- end
- else
- if item.tag_check_multivalues(@subject.enemy.note,"guard_anim")
- show_animation([@subject], item.tag_check_multivalues(@subject.enemy.note,"guard_anim")[0].to_i())
- end
- end
- else
- if item.is_a?(RPG:: Skill) && item.physical?
- if custom==false
- @subject.action="physical"
- end
- end
- if item.is_a?(RPG:: Skill) && item.magical?
- if custom==false
- @subject.action="magical"
- end
- end
- if item.is_a?(RPG:: Item)
- if custom==false
- @subject.action="item"
- end
- end
- end
- end
- @subject.frame=0
- #show melee anim
- if item.tag_check_multivalues(item.note,"melee_anim")
- show_animation([@subject], item.tag_check_multivalues(item.note,"melee_anim")[0].to_i())
- else
- #wait some more
- abs_wait(15)
- end
- #hit camera
- if !item.tag_check_multivalues(item.note,"hit_zoom_on_user")
- camera_move_default(10)
- abs_wait(30)
- end
- if item.tag_check_multivalues(item.note,"hit_zoom_on_user")
- @cam_goal_x=@subject.set_x
- @cam_goal_y=@subject.set_y
- @cam_goal_zoom=item.tag_check_multivalues(item.note,"hit_zoom_on_user")[0].to_f()
- @cam_move_rate=item.tag_check_multivalues(item.note,"hit_zoom_on_user")[1].to_i()
- @cam_zoom_rate=item.tag_check_multivalues(item.note,"hit_zoom_on_user")[1].to_i()
- abs_wait(30)
- end
- if item.tag_check_multivalues(item.note,"hit_zoom_on_target")
- if item.for_all?
- @cam_goal_x=Graphics.width/2
- @cam_goal_y=$game_system.basimple_options.center_down
- else
- @cam_goal_x=@subject.current_action.make_targets.compact[0].screen_x
- @cam_goal_y=@subject.current_action.make_targets.compact[0].screen_y
- end
- @cam_goal_zoom=item.tag_check_multivalues(item.note,"hit_zoom_on_target")[0].to_f()
- @cam_move_rate=item.tag_check_multivalues(item.note,"hit_zoom_on_target")[1].to_i()
- @cam_zoom_rate=item.tag_check_multivalues(item.note,"hit_zoom_on_target")[1].to_i()
- abs_wait(30)
- end
- if item.tag_check_multivalues(item.note,"hit_zoom_center")
- @cam_goal_x=Graphics.width/2
- @cam_goal_y=Graphics.height/2
- @cam_goal_zoom=item.tag_check_multivalues(item.note,"hit_zoom_center")[0].to_f()
- @cam_move_rate=item.tag_check_multivalues(item.note,"hit_zoom_center")[1].to_i()
- @cam_zoom_rate=item.tag_check_multivalues(item.note,"hit_zoom_center")[1].to_i()
- abs_wait(30)
- end
- #normal stuff
- @log_window.display_use_item(@subject, item)
- @subject.use_item(item)
- refresh_status
- targets = @subject.current_action.make_targets.compact
- targets.each {|target| item.repeats.times {
- if item.damage.to_hp? and not item.damage.recover?
- target.action="hurt"
- target.frame=0
- end} }
- if not $imported["YEA-BattleEngine"]
- if targets.size==1
- show_animation(targets, item.animation_id,targets[0].animation_mirror)
- else
- show_animation(targets, item.animation_id)
- end
- end
- targets.each {|target| item.repeats.times {
- invoke_item(target, item)
- target.action=""
- } }
- #restart graphic and pos
- @subject.action="move_back"
- @subject.frame=0
- @subject.set_x=@subject.screen_x
- @subject.set_y=@subject.screen_y
- camera_move_default(10)
- abs_wait(30)
- end
- #--------------------------------------------------------------------------
- # show animation
- #--------------------------------------------------------------------------
- # because of the mirror
- #--------------------------------------------------------------------------
- def show_animation(targets, animation_id, mirror = false)
- if animation_id < 0
- show_attack_animation(targets)
- else
- show_normal_animation(targets, animation_id, mirror)
- end
- @log_window.wait
- wait_for_animation
- end
- def show_attack_animation(targets)
- if @subject.actor?
- show_normal_animation(targets, @subject.atk_animation_id1, false)
- show_normal_animation(targets, @subject.atk_animation_id2, true)
- else
- if @subject.enemy
- if @subject.enemy.tag_check_multivalues(@subject.enemy.note,"enem_attack_animation")
- show_normal_animation(targets, @subject.enemy.tag_check_multivalues(@subject.enemy.note,"enem_attack_animation")[0].to_i(),false)
- else
- Sound.play_enemy_attack
- abs_wait_short
- end
- end
- end
- end
- end
- #==============================================================================
- # ■ Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- attr_accessor :current_x
- attr_accessor :current_y
- attr_accessor :set_x
- attr_accessor :set_y
- attr_accessor :action
- attr_accessor :frame
- attr_accessor :size
- attr_accessor :custom_frame
- attr_accessor :custom_loop
- attr_accessor :custom_anim_speed
- attr_accessor :custom
- attr_accessor :ratio
- #--------------------------------------------------------------------------
- # ● initialize
- #--------------------------------------------------------------------------
- def initialize(index, enemy_id)
- super()
- @index = index
- @enemy_id = enemy_id
- enemy = $data_enemies[@enemy_id]
- @original_name = enemy.name
- @letter = ""
- @plural = false
- @screen_x = 0
- @screen_y = 0
- @battler_hue = enemy.battler_hue
- @hp = mhp
- @mp = mmp
- @current_x=0
- @current_y=0
- @set_x=0
- @set_y=0
- @action = ''
- @frame=0.0
- @custom=false
- @ratio=10
- if enemy.tag_check_multivalues(enemy.note,"enemy_size")
- @size=enemy.tag_check_multivalues(enemy.note,"enemy_size")[0].to_f
- else
- @size=1
- end
- @custom_frame=MOLEGATO_BASIMPLE_BS::FRAME_NUMBER
- @custom_loop=false
- @custom_anim_speed=MOLEGATO_BASIMPLE_BS::FRAME_SPEED
- end
- def max_frame_number
- if MOLEGATO_BASIMPLE_BS::INDIVIDUAL_FN==false
- return MOLEGATO_BASIMPLE_BS::FRAME_NUMBER
- else
- return @custom_frame if @custom==true
- return MOLEGATO_BASIMPLE_BS::PF_STAND if action=='stand' or action==''
- return MOLEGATO_BASIMPLE_BS::PF_MOVE if action=='move'
- return MOLEGATO_BASIMPLE_BS::PF_MOVE_BACK if action=='move_back'
- return MOLEGATO_BASIMPLE_BS::PF_HURT if action=='hurt'
- return MOLEGATO_BASIMPLE_BS::PF_ATTACK if action=='attack'
- return MOLEGATO_BASIMPLE_BS::PF_ITEM if action=='item'
- return MOLEGATO_BASIMPLE_BS::PF_MAGICAL if action=='magical'
- return MOLEGATO_BASIMPLE_BS::PF_PHYSICAL if action=='physical'
- return @custom_frame
- end
- end
- def battler_name
- if MOLEGATO_BASIMPLE_BS::FRAME_NUMBER==1
- frame_string=''
- else
- frame_string=@frame.round().to_s()
- end
- if action==''
- return enemy.battler_name+'/'+'stand'+frame_string
- else
- return enemy.battler_name+'/'+action+frame_string
- end
- end
- def update_pos
- @current_x=(@current_x*(@ratio-1)+@set_x)/@ratio
- @current_y=(@current_y*9+@set_y)/10
- end
- def screen_x
- if MOLEGATO_BASIMPLE_BS::ARRANGE_ENEMIES==false or $game_troop.troop.name[/@/mi]=="@"
- return @screen_x
- else
- if $game_system.basimple_options.side==0
- return Graphics.width-$game_system.basimple_options.margin - $game_system.basimple_options.diagonal_pos*self.index
- else
- return $game_system.basimple_options.margin + $game_system.basimple_options.diagonal_pos*self.index
- end
- end
- end
- def screen_y
- if MOLEGATO_BASIMPLE_BS::ARRANGE_ENEMIES==false or $game_troop.troop.name[/@/mi]=="@"
- return @screen_y
- else
- return $game_system.basimple_options.vertical_party_pos-self.index*$game_system.basimple_options.vertical_sep
- end
- end
- def animation_mirror
- if $game_system.basimple_options.global_mirror==false
- if $game_system.basimple_options.side==0
- return false
- else
- return true
- end
- else
- if $game_system.basimple_options.side==0
- return true
- else
- return false
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● perform damage_effect
- #--------------------------------------------------------------------------
- # cause it was annoying.
- #--------------------------------------------------------------------------
- def perform_damage_effect
- if MOLEGATO_BASIMPLE_BS::DAMAGE_EFFECT==0 or MOLEGATO_BASIMPLE_BS::DAMAGE_EFFECT==2
- @sprite_effect_type = :blink
- Sound.play_enemy_damage
- end
- end
- def face_direction
- if $game_system.basimple_options.side==0
- if actor?
- return 1
- else
- return -1
- end
- else
- if actor?
- return -1
- else
- return 1
- end
- end
- end
- end
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- attr_accessor :current_x
- attr_accessor :current_y
- attr_accessor :set_x
- attr_accessor :set_y
- attr_accessor :action
- attr_accessor :frame
- attr_accessor :size
- attr_accessor :custom_frame
- attr_accessor :custom_loop
- attr_accessor :custom_anim_speed
- attr_accessor :custom
- attr_accessor :ratio
- #--------------------------------------------------------------------------
- # ● setup
- #--------------------------------------------------------------------------
- def setup(actor_id)
- @actor_id = actor_id
- @name = actor.name
- @nickname = actor.nickname
- init_graphics
- @class_id = actor.class_id
- @level = actor.initial_level
- @exp = {}
- @equips = []
- @battler_hue = 0
- init_exp
- init_skills
- init_equips(actor.equips)
- clear_param_plus
- recover_all
- @current_x=0
- @current_y=0
- @set_x=0
- @set_y=0
- @action = ''
- @frame=0.0
- @custom=false
- @ratio=10
- if actor.tag_check_multivalues(actor.note,"actor_size")
- @size=actor.tag_check_multivalues(actor.note,"actor_size")[0].to_f
- else
- @size=1
- end
- @custom_frame=MOLEGATO_BASIMPLE_BS::FRAME_NUMBER
- @custom_loop=false
- @custom_anim_speed=MOLEGATO_BASIMPLE_BS::FRAME_SPEED
- end
- def max_frame_number
- if MOLEGATO_BASIMPLE_BS::INDIVIDUAL_FN==false
- return MOLEGATO_BASIMPLE_BS::FRAME_NUMBER
- else
- return @custom_frame if @custom==true
- return MOLEGATO_BASIMPLE_BS::PF_STAND if action=='stand' or action==''
- return MOLEGATO_BASIMPLE_BS::PF_MOVE if action=='move'
- return MOLEGATO_BASIMPLE_BS::PF_MOVE_BACK if action=='move_back'
- return MOLEGATO_BASIMPLE_BS::PF_HURT if action=='hurt'
- return MOLEGATO_BASIMPLE_BS::PF_ATTACK if action=='attack'
- return MOLEGATO_BASIMPLE_BS::PF_ITEM if action=='item'
- return MOLEGATO_BASIMPLE_BS::PF_MAGICAL if action=='magical'
- return MOLEGATO_BASIMPLE_BS::PF_PHYSICAL if action=='physical'
- return @custom_frame
- end
- end
- #--------------------------------------------------------------------------
- # ● screen_whatever
- #--------------------------------------------------------------------------
- def screen_z
- return 100
- end
- def screen_x
- if $game_system.basimple_options.side==0
- return $game_system.basimple_options.margin + $game_system.basimple_options.diagonal_pos*self.index
- else
- return Graphics.width-$game_system.basimple_options.margin - $game_system.basimple_options.diagonal_pos*self.index
- end
- end
- def screen_y
- return $game_system.basimple_options.vertical_party_pos-self.index*$game_system.basimple_options.vertical_sep
- end
- def battler_name
- if MOLEGATO_BASIMPLE_BS::FRAME_NUMBER==1
- frame_string=''
- else
- frame_string=@frame.round().to_s()
- end
- if action==''
- return face_name+"/"+'stand'+frame_string
- else
- return face_name+"/"+action+frame_string
- end
- end
- def update_pos
- @current_x=(@current_x*(@ratio-1)+@set_x)/@ratio
- @current_y=(@current_y*9+@set_y)/10
- end
- #--------------------------------------------------------------------------
- # ● use sprite
- #--------------------------------------------------------------------------
- def use_sprite?
- return true
- end
- def animation_mirror
- if $game_system.basimple_options.global_mirror==false
- if $game_system.basimple_options.side==0
- return true
- else
- return false
- end
- else
- if $game_system.basimple_options.side==0
- return false
- else
- return true
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● perform damage effect
- #--------------------------------------------------------------------------
- # edited cause it annoyed me
- #--------------------------------------------------------------------------
- def perform_damage_effect
- if MOLEGATO_BASIMPLE_BS::DAMAGE_EFFECT==0
- $game_troop.screen.start_shake(5, 5, 10)
- @sprite_effect_type = :blink
- Sound.play_actor_damage
- end
- if MOLEGATO_BASIMPLE_BS::DAMAGE_EFFECT==2
- @sprite_effect_type = :blink
- Sound.play_actor_damage
- end
- end
- def face_direction
- if $game_system.basimple_options.side==0
- if actor?
- return 1
- else
- return -1
- end
- else
- if actor?
- return -1
- else
- return 1
- end
- end
- end
- end
- #==============================================================================
- # ■ Sprite_Battler
- #==============================================================================
- class Sprite_Battler < Sprite_Base
- alias basimple_update update
- def update
- basimple_update
- update_size
- if $game_system.basimple_options.global_mirror==false
- if $game_system.basimple_options.side==0
- self.mirror=@battler.enemy?
- else
- self.mirror=@battler.actor?
- end
- else
- if $game_system.basimple_options.side==0
- self.mirror=@battler.actor?
- else
- self.mirror=@battler.enemy?
- end
- end
- end
- def update_size
- if @battler and @battler.size!=get_size
- @size=@battler.size
- end
- if @size!=1 or $cam_zoom!=1
- self.zoom_x=get_size
- self.zoom_y=get_size
- end
- end
- def update_position
- self.x = ((@battler.current_x-$cam_x)*$cam_zoom+Graphics.width/2).to_i()
- self.y = ((@battler.current_y-$cam_y)*$cam_zoom+Graphics.height/2).to_i()
- self.z = self.y*2
- end
- def set_size(new_size)
- @size=new_size
- end
- def get_size
- if !@size
- @size=1
- end
- return @size*$cam_zoom
- end
- end
- class Game_Battler < Game_BattlerBase
- def face_direction
- if $game_system.basimple_options.side==0
- if actor?
- return 1
- else
- return -1
- end
- else
- if actor?
- return -1
- else
- return 1
- end
- end
- end
- end
- #==============================================================================
- # ■ Spriteset_Battle
- #==============================================================================
- class Spriteset_Battle
- #--------------------------------------------------------------------------
- # battleback blues
- #--------------------------------------------------------------------------
- def create_battleback1
- @back1_sprite = Plane.new(@viewport1)
- @back1_sprite.bitmap = battleback1_bitmap
- @back1_sprite.z = 0
- @scroll1_x=0
- @scroll1_y=0
- end
- def create_battleback2
- @back2_sprite = Plane.new(@viewport1)
- @back2_sprite.bitmap = battleback2_bitmap
- @back2_sprite.z = 1
- if $game_system.basimple_options.back_panning
- @back2_sprite.z = $game_system.basimple_options.back2_z
- end
- @scroll2_x=0
- @scroll2_y=0
- end
- def update_battleback1
- return if not battleback1_name
- @back1_sprite.zoom_x=$cam_zoom
- @back1_sprite.zoom_y=$cam_zoom
- @scroll1_x+=$game_system.basimple_options.back1_scroll_x
- @scroll1_y+=$game_system.basimple_options.back1_scroll_y
- @back1_sprite.ox=(($cam_x)*$cam_zoom)-Graphics.width/2 +@scroll1_x
- @back1_sprite.oy=(($cam_y)*$cam_zoom)-Graphics.height/2 +@scroll1_y
- end
- def update_battleback2
- return if not battleback2_name
- @back2_sprite.zoom_x=$cam_zoom
- @back2_sprite.zoom_y=$cam_zoom
- @scroll2_x+=$game_system.basimple_options.back2_scroll_x
- @scroll2_y+=$game_system.basimple_options.back2_scroll_y
- if $game_system.basimple_options.back_panning
- @back2_sprite.ox=(($cam_x*$game_system.basimple_options.backpanning_x)*$cam_zoom)-Graphics.width/2 +@scroll2_x
- @back2_sprite.oy=(($cam_y*$game_system.basimple_options.backpanning_y)*$cam_zoom)-Graphics.height/2 +@scroll2_y
- else
- @back2_sprite.ox=(($cam_x)*$cam_zoom)-Graphics.width/2 +@scroll2_x
- @back2_sprite.oy=(($cam_y)*$cam_zoom)-Graphics.height/2 +@scroll2_y
- end
- end
- #--------------------------------------------------------------------------
- # create_actors
- #--------------------------------------------------------------------------
- # cause they needed to be visible
- #--------------------------------------------------------------------------
- def create_actors
- @actor_sprites = $game_party.members.reverse.collect do |actor|
- Sprite_Battler.new(@viewport1, actor)
- end
- end
- #--------------------------------------------------------------------------
- # update_actors
- #--------------------------------------------------------------------------
- def update_actors
- @actor_sprites.each {|sprite| sprite.update }
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment