#=============================================================================== # # Yanfly Engine RD - Scene Battle ReDux # Last Date Updated: 2009.07.05 # Level: Normal, Hard, Lunatic # # This is actually more or less a "full" version of Scene Battle. It overwrites # the whole thing practically and constructs it in a more efficient manner. But # other than that, it's nothing more than a controllable and edittable version # of your usual default battle system. This rewrite includes a couple of new # features that I thought should have been options for the default battle system # but you're also capable of ignoring these new features should you desire. # # COMMON FUNCTIONS # Since some people would like to create their own custom effects now and then # at regular intervals, there are four common events now associated and played # during battle. One common event will occur at the start of every battle, one # will occur at the beginning of each turn, and one will occur at the end of # each turn, and the final will occur at the end of each battle. # # BATTLE MESSAGE REDUX # For those that would like to keep their party's status window intact, enable # the battle message redux to show battle messages at the top of the screen. # The status window is then commanded to update whenever an actor undergoes a # change in damage, MP usage, or a status change. # # BATTLE POPUPS # Like most modern RPG's, whenever a battler would take damage, healing, receive # a status effect, or something unique happens, a popup would appear describing # what changes occured over the battler's head. # # TEXT SKIPPING # With battle popups, some text displayed during battle becomes insignificant # and actually pointless to keep around. You can now choose what text to hide # and what should be shown. It's all in your control now. # # ACTOR ANIMATION LOCATIONS # Before, enemies never played animations on actors before. You would hear the # sound effect and then see the screen shake. Now, it's a little different. You # can set the X and Y coordinates of where you want your actors to "appear" and # animations will be played there instead. # # And once again, this script is nothing more than an edittable and customizable # default battle system. Do not confuse this for an advanced battle system. # #=============================================================================== # Instructions #=============================================================================== # # Insert this script under the Fix Scripts but above the rest of the Yanfly # Engine scripts. That way, you can maintain maximum compatibility amongst all # of the Yanfly Engine scripts. # #=============================================================================== # Updates: # ---------------------------------------------------------------------------- # o 2009.07.05 - Bugfix for absorbed damage not showing. HP and MP absorb # also appears differently. # o 2009.06.09 - Fixed state line added if states were disabled. # o 2009.06.06 - Fixed escape text causing party info to disappear. # o 2009.06.03 - Bug fixes to auto-battlers and turn zero actions. # o 2009.05.30 - Started script and finished. #=============================================================================== # # Compatibility # - Incompatible: Any custom battle systems obviously. # - Works With: Yanfly's Custom Skill Effects, Display Party Data, # - Works With: Yanfly's Display Victory Aftermath # - Alias: Sprite_Battler and Game_Battler: clear_sprite_effects # - Overwrites: Scene_Battle, a lot of it. # #=============================================================================== # Credits: # STR for Battle Message ReDux base scripting. #=============================================================================== $imported = {} if $imported == nil $imported["SceneBattleReDux"] = true module YE module REDUX module BATTLE #------------------------------------------------------------------------ # COMMMON FUNCTIONS #------------------------------------------------------------------------ # This portion lets you easily create common events for battle that occur # at regular intervals. Now you won't have to tediously create each troop # page if you were doing something like such before. #------------------------------------------------------------------------ # This determines which common events to play whenever a battle takes # place. If you do not wish to use a common event, input nil. COMMON_EVENT_START_BAT = nil # Occurs at the start of each battle. COMMON_EVENT_TURN_BEGIN = nil # Occurs at the start of each turn. COMMON_EVENT_TURN_CLOSE = nil # Occurs at the end of each turn. COMMON_EVENT_END_BATTLE = nil # Occurs at the end of each battle. #------------------------------------------------------------------------ # BATTLE MESSAGE REDUX #------------------------------------------------------------------------ # This following portion will create a unique battle message window. If # enabled, battle messages will not hide the party status window. This is # a remake of STR's Battle Message. #------------------------------------------------------------------------ BATTLE_MESSAGE_REDUX = true BATTLE_MSG_GRADIENT1 = Color.new(0,0,0,160) BATTLE_MSG_GRADIENT2 = Color.new(0,0,0,0) BATTLE_MSG_GRADIENTW = 360 BATTLE_MSG_OPACITY = 96 BATTLE_MSG_FONT_SIZE = 20 #------------------------------------------------------------------------ # BATTLE POPUPS #------------------------------------------------------------------------ # Popups will show damage dealt to battlers in the modern RPG fashion # where a number flies out of the target. This will cause any damage dealt # to battlers to appear on screen, drift upward, and fade away. Various # instances of popup rules can be adjusted with this script and you can # even add in your own should you want to make your own custom popups. #------------------------------------------------------------------------ # If you would like some states to not show popups, you can use these # tags to prevent them from appearing. # prevents popup from showing when added. # prevents popup from showing when removed. # prevents popup from showing when remaining. #------------------------------------------------------------------------ # Set this to false if you want to disable popups. ENABLE_POPUPS = true # This adjusts the general popup display. Change the values below to alter # how the popups appear in battle. POPUP_NUM = 32 # Adjusts the font size for numbers POPUP_WIDTH = 140 # Adjusts the max text width for popup POPUP_OFFSET = -12 # Adjusts the height offset # The following follow dictates major values for major popup types. Alter # them below as you see fitting. POPUP_HP = "%s" # The way HP damage/healing is shown POPUP_MP = "%s MP" # The way MP damage/healing is shown POPUP_ABSORBED = "Drain %s" # Text shown when absorbed damage POPUP_CRITICAL = "CRITICAL" # Text shown for critical hit POPUP_MISSED = "MISSED" # Text shown for missed attack POPUP_EVADED = "EVADED" # Text shown for evaded attack POPUP_FAILED = "NULLED" # Text shown for failed attack POPUP_ADD_ST = "+%s" # Text shown when state is added POPUP_REM_ST = "-%s" # Text shown when state is removed POPUP_DUR_ST = "%s" # Text shown when state is still there # This determines the fade settings for the popups. Note that both numbers # and text will fall under the same ruleset. POPUP_FADE = 24 # The fade rate of the popups POPUP_FULL = 36 # The frames the popup will remain before fading # The following determines the rules applied to the types of popups that # will appear. ID type 0 must exist! They work as follows: # # Shown: if true, this popup will show # Sz: font size of the popup # Hgt: how high this popup can climb # Bold: whether or not the font is bold # Italic: whether or not the font is italic # Red: red value of font colour used # Grn: green value of font colour used # Blu: blue value of font colour used # Font: Font used for the popup text. # # Once again, ID type 0 must exist! POPUP_HASH = { # ID => [Shown, Sz, Hgt, Bold, Italic, Red, Grn, Blu, Font] 0 => [ true, 20, 20, true, false, 255, 255, 255, "Arial"], # General 1 => [ true, 20, 50, true, false, 255, 255, 255, "Arial"], # Critical 2 => [ true, 32, 20, true, false, 255, 255, 255, "Arial"], # HP dmg 3 => [ true, 32, 20, true, false, 130, 250, 130, "Arial"], # HP heal 4 => [ true, 32, 20, true, false, 220, 180, 255, "Arial"], # MP dmg 5 => [ true, 32, 20, true, false, 160, 230, 255, "Arial"], # MP heal 6 => [ true, 20, 20, true, false, 240, 100, 100, "Arial"], # A.State 7 => [ true, 20, 20, true, false, 125, 170, 225, "Arial"], # R.State 8 => [ true, 20, 20, true, false, 255, 240, 150, "Arial"], # D.State 9 => [ true, 28, 20, true, false, 250, 190, 255, "Arial"], # AbsorbHP 10 => [ true, 28, 20, true, false, 131, 147, 202, "Arial"], # AbsorbMP } # Do not remove this. # The following determines the sound used for absorbing HP and MP. ABSORB_HP_SOUND = RPG::SE.new("Absorb1", 80, 100) ABSORB_MP_SOUND = RPG::SE.new("Absorb2", 80, 100) #------------------------------------------------------------------------ # BATTLE TEXT SKIP #------------------------------------------------------------------------ # The following lets you choose what text to skip in your battle system. # This is because some things can get rather redundant and others can # take up way too much time. Plus, you might want to disable some of # these if you enable popup text. #------------------------------------------------------------------------ # This allows the player to fastforward through battle messages by # holding down the A or C buttons. ALLOW_FAST_FORWARD = true # This part allows you to adjust whether or not you would like for the # enemy appearance messages to show. MSG_ENEMY_APPEAR = false # This part allows you to adjust whether or not you would like for # pre-emptive and surprise attack messages to appear. MSG_ADVANTAGE = true # This will enable display the current state of each battler. MSG_CURRENT_STATE = false # This will enable current action message. This goes for attacking, # guarding, using skills, and using items. MSG_CURRENT_ACTION = true # These will display various parts of the display action effects method. MSG_DISPLAY_MISC = false # This is for other methods. MSG_DISPLAY_CRITS = false # Critical hits. MSG_DISPLAY_MISSES = false # Missed attacks. MSG_DISPLAY_EVADES = false # Evaded attacks. MSG_DISPLAY_HP_DMG = false # HP damage taken. MSG_DISPLAY_MP_DMG = false # MP damage taken. MSG_DISPLAY_STATES = false # States added, removed, remaining. MSG_DISPLAY_FAILED = false # Failed attacks. #------------------------------------------------------------------------ # ACTOR ANIMATION PLAY #------------------------------------------------------------------------ # This will give your actors an invisible but animation-allowable sprite # to use during battle. This will be essentially where all the popups and # animations directed at the actors will be played. Note that actor -1 # will be choosen if the actor's index does not exist! Do not remove -1. #------------------------------------------------------------------------ ACTOR_SCREEN_COORDINATES ={ # DO NOT REMOVE INDEX -1 # Index => [Screen X, Screen Y] -1 => [ 272, 288], 0 => [ 128, 288], 1 => [ 224, 288], 2 => [ 320, 288], 3 => [ 416, 288], } # Do not remove this. # If this is set to false, none of the stuff you filled out above will # matter as no animations will be played on actors. ENABLE_ACTOR_ANIMATIONS = true # Screen shakes whenever an actor takes HP damage. Set this to false if # you would like to disable that effect. ACTOR_SCREEN_SHAKE = false end # BATTLE end # REDUX end # YE #=============================================================================== # How to Use: Lunatic Mode #=============================================================================== # # For those scripting their own unique effects into the game but would like to # make use of the popups, no problem. All you have to do is the following: # battler.popup_rule = 0 # battler.pupup_value = "Hello" # The popup rule determines the ruleset used in the module above at POPUP_HASH. # Make sure you fill out every part of the rule properly. # #=============================================================================== #=============================================================================== # Editting anything past this point may potentially result in causing computer # damage, incontinence, explosion of user's head, coma, death, and/or halitosis. # Therefore, edit at your own risk. #=============================================================================== module YE module REGEXP module STATE HIDE_APPLY = /<(?:HIDE_APPLY|hide apply)>/i HIDE_ERASE = /<(?:HIDE_ERASE|hide erase)>/i HIDE_WHILE = /<(?:HIDE_WHILE|hide while)>/i end # STATE end # REGEXP end # YE #=============================================================================== # RPG::State #=============================================================================== class RPG::State #-------------------------------------------------------------------------- # Yanfly_Cache_State_battlerd #-------------------------------------------------------------------------- def yanfly_cache_state_battlerd @hide_apply = false; @hide_erase = false; @hide_while = false self.note.split(/[\r\n]+/).each { |line| case line when YE::REGEXP::STATE::HIDE_APPLY @hide_apply = true when YE::REGEXP::STATE::HIDE_ERASE @hide_erase = true when YE::REGEXP::STATE::HIDE_WHILE @hide_while = true end } end #-------------------------------------------------------------------------- # definitions #-------------------------------------------------------------------------- def hide_apply yanfly_cache_state_battlerd if @hide_apply == nil return @hide_apply end def hide_erase yanfly_cache_state_battlerd if @hide_erase == nil return @hide_erase end def hide_while yanfly_cache_state_battlerd if @hide_while == nil return @hide_while end end # RPG::State #=============================================================================== # Sprite_Battler #=============================================================================== class Sprite_Battler < Sprite_Base #-------------------------------------------------------------------------- # alias initialize #-------------------------------------------------------------------------- alias initialize_sprite_battlerd initialize unless $@ def initialize(viewport, battler = nil) initialize_sprite_battlerd(viewport, battler) @popup_update = 0 @popup_tally = 0 end #-------------------------------------------------------------------------- # alias update #-------------------------------------------------------------------------- alias update_sprite_battlerd update unless $@ def update update_sprite_battlerd if @popup_update > 0 update_popup end end #-------------------------------------------------------------------------- # update popup #-------------------------------------------------------------------------- def update_popup @popup_update -= 1 for key in @popup_sprite key = key[0] next if @popup_sprite[key] == nil fade_rate = YE::REDUX::BATTLE::POPUP_FADE @popup_duration[key] -= 1 if @popup_duration[key] <= 0 @popup_sprite[key].opacity -= YE::REDUX::BATTLE::POPUP_FADE end if @popup_height[key] >= 0 @popup_height[key] -= 1 @popup_sprite[key].oy += 1 end if @popup_sprite[key].opacity <= 0 @popup_sprite[key].bitmap.dispose @popup_sprite[key].dispose @popup_sprite[key] = nil end end end #-------------------------------------------------------------------------- # create popup #-------------------------------------------------------------------------- def create_popup(value, popup_rules = 0) return unless YE::REDUX::BATTLE::ENABLE_POPUPS unless YE::REDUX::BATTLE::POPUP_HASH.include?(popup_rules) popup_rules = 0 end array = YE::REDUX::BATTLE::POPUP_HASH[popup_rules] return unless array[0] @popup_height = {} if @popup_height == nil bw = YE::REDUX::BATTLE::POPUP_WIDTH bh = Integer(array[1] * 2) bitmap = Bitmap.new(bw, bh) bitmap.font.name = array[8] bitmap.font.size = array[1] bitmap.font.bold = array[3] bitmap.font.italic = array[4] bitmap.font.shadow = false bitmap.font.color.set(0, 0, 0) bitmap.draw_text(0+1, 12-1, bw, bh, value, 1) bitmap.draw_text(0+1, 12+1, bw, bh, value, 1) bitmap.draw_text(0-1, 12-1, bw, bh, value, 1) bitmap.draw_text(0-1, 12+1, bw, bh, value, 1) bitmap.font.color.set(array[5], array[6], array[7]) bitmap.draw_text(0, 12, bw, bh, value, 1) @popup_sprite = {} if @popup_sprite == nil @popup_duration = {} if @popup_duration == nil i = @popup_tally @popup_height[i] = array[2] @popup_sprite[i] = ::Sprite.new(self.viewport) @popup_sprite[i].bitmap = bitmap @popup_sprite[i].ox = bw / 2 @popup_sprite[i].oy = bh / 2 @popup_sprite[i].x = self.x @popup_sprite[i].y = (self.y - self.oy / 2) + YE::REDUX::BATTLE::POPUP_OFFSET @popup_sprite[i].z = 9000 @popup_sprite[i].opacity = 256 @popup_duration[i] = YE::REDUX::BATTLE::POPUP_FULL @popup_update += YE::REDUX::BATTLE::POPUP_FULL + (256 / YE::REDUX::BATTLE::POPUP_FADE) @popup_tally += 1 end #-------------------------------------------------------------------------- # alias setup_new_effect #-------------------------------------------------------------------------- alias setup_new_effect_battlerd setup_new_effect unless $@ def setup_new_effect setup_new_effect_battlerd if @battler.popup_value != nil value = @battler.popup_value rules = @battler.popup_rules create_popup(value, rules) @battler.popup_value = nil @battler.popup_rules = nil end end end # Sprite_Battler #=============================================================================== # Game_Battler #=============================================================================== class Game_Battler #-------------------------------------------------------------------------- # Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :popup_rules attr_accessor :popup_value #-------------------------------------------------------------------------- # alias clear sprite effects #-------------------------------------------------------------------------- alias clear_sprite_effects_abc clear_sprite_effects unless $@ def clear_sprite_effects clear_sprite_effects_abc @popup_rules = 0 @popup_value = nil end end # Game_Battler #============================================================================== # Game_Actor #============================================================================== unless $imported["AnimationBattleConstruct"] class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # battler name, hue #-------------------------------------------------------------------------- def battler_name; return ""; end def battler_hue; return 0; end def screen_z; return 0; end #-------------------------------------------------------------------------- # use_sprite? #-------------------------------------------------------------------------- def use_sprite? return YE::REDUX::BATTLE::ENABLE_ACTOR_ANIMATIONS end #-------------------------------------------------------------------------- # screen x #-------------------------------------------------------------------------- def screen_x if YE::REDUX::BATTLE::ACTOR_SCREEN_COORDINATES.include?(self.index) n = YE::REDUX::BATTLE::ACTOR_SCREEN_COORDINATES[self.index][0] else n = YE::REDUX::BATTLE::ACTOR_SCREEN_COORDINATES[-1][0] end return n end #-------------------------------------------------------------------------- # screen y #-------------------------------------------------------------------------- def screen_y if YE::REDUX::BATTLE::ACTOR_SCREEN_COORDINATES.include?(self.index) n = YE::REDUX::BATTLE::ACTOR_SCREEN_COORDINATES[self.index][1] else n = YE::REDUX::BATTLE::ACTOR_SCREEN_COORDINATES[-1][1] end return n end end end #=============================================================================== # Window BattleMessageReDux #=============================================================================== class Window_BattleMessageReDux < Window_BattleMessage #-------------------------------------------------------------------------- # initialize #-------------------------------------------------------------------------- def initialize super self.x = 0 self.y = 0 self.back_opacity = 0 self.opacity = 0 self.contents.font.size = YE::REDUX::BATTLE::BATTLE_MSG_FONT_SIZE @sprite = Sprite.new(self.viewport) gw = YE::REDUX::BATTLE::BATTLE_MSG_GRADIENTW g1 = YE::REDUX::BATTLE::BATTLE_MSG_GRADIENT1 g2 = YE::REDUX::BATTLE::BATTLE_MSG_GRADIENT2 bitmap = Bitmap.new(gw, 96 + 16) bitmap.gradient_fill_rect(0, 16, gw, 96, g1, g2) @sprite.bitmap = bitmap @sprite.x = self.x @sprite.y = self.y @sprite.src_rect.height = 16 @sprite.opacity = 0 end #-------------------------------------------------------------------------- # dispose #-------------------------------------------------------------------------- def dispose super @sprite.bitmap.dispose @sprite.dispose end #-------------------------------------------------------------------------- # update #-------------------------------------------------------------------------- def update super if self.visible and (@lines.size > 0 and not @str11f) or (@text != nil or self.pause or @index > -1) @sprite.opacity += YE::REDUX::BATTLE::BATTLE_MSG_OPACITY dh = @sprite.src_rect.height if @text != nil lines = 4 else unless self.pause or @index > -1 lines = @lines.size else lines = 4 end end @sprite.src_rect.height = 16 + (lines * 24) else @sprite.opacity -= YE::REDUX::BATTLE::BATTLE_MSG_OPACITY end end end #=============================================================================== # Scene Battle #=============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # overwrite start #-------------------------------------------------------------------------- def start super @redux_msg = YE::REDUX::BATTLE::BATTLE_MESSAGE_REDUX @enable_popup = YE::REDUX::BATTLE::ENABLE_POPUPS @misc_msg = YE::REDUX::BATTLE::MSG_DISPLAY_MISC $game_temp.in_battle = true @spriteset = Spriteset_Battle.new if @redux_msg @message_window = Window_BattleMessageReDux.new else @message_window = Window_BattleMessage.new end @action_battlers = [] create_info_viewport end #-------------------------------------------------------------------------- # overwrite show_fast? #-------------------------------------------------------------------------- def show_fast? return false unless YE::REDUX::BATTLE::ALLOW_FAST_FORWARD return (Input.press?(Input::A) or Input.press?(Input::C)) end #-------------------------------------------------------------------------- # overwrite create_info_viewport #-------------------------------------------------------------------------- def create_info_viewport @info_viewport = Viewport.new(0, 288, 544, 128) @info_viewport.z = 100 @status_window = Window_BattleStatus.new @party_command_window = Window_PartyCommand.new @actor_command_window = Window_ActorCommand.new @status_window.viewport = @info_viewport @party_command_window.viewport = @info_viewport @actor_command_window.viewport = @info_viewport @status_window.x = 128 @actor_command_window.x = 544 @info_viewport.visible = false unless @redux_msg end #-------------------------------------------------------------------------- # return status window #-------------------------------------------------------------------------- def status_window return @status_window end #-------------------------------------------------------------------------- # overwrite process_battle_start #-------------------------------------------------------------------------- def process_battle_start @message_window.clear wait(10) if YE::REDUX::BATTLE::MSG_ENEMY_APPEAR for name in $game_troop.enemy_names text = sprintf(Vocab::Emerge, name) $game_message.texts.push(text) end end if YE::REDUX::BATTLE::MSG_ADVANTAGE if $game_troop.preemptive text = sprintf(Vocab::Preemptive, $game_party.name) $game_message.texts.push(text) elsif $game_troop.surprise text = sprintf(Vocab::Surprise, $game_party.name) $game_message.texts.push(text) end end wait_for_message @message_window.clear make_escape_ratio if YE::REDUX::BATTLE::COMMON_EVENT_START_BAT != nil $game_temp.common_event_id = YE::REDUX::BATTLE::COMMON_EVENT_START_BAT end process_battle_event start_party_command_selection end #-------------------------------------------------------------------------- # overwrite start_party_command_selection #-------------------------------------------------------------------------- def start_party_command_selection if $game_temp.in_battle @status_window.index = @actor_index = -1 if @party_command_window.openness == 0 @party_command_window.openness = 128 @actor_command_window.openness = 128 end @party_command_window.open @actor_command_window.open loop { update_basic @party_command_window.update @actor_command_window.update break if @info_viewport.ox == 0 @info_viewport.ox -= 16 } @status_window.refresh @active_battler = nil @info_viewport.visible = true @message_window.visible = false @party_command_window.active = true @party_command_window.index = 0 @actor_command_window.active = false $game_party.clear_actions if $game_troop.surprise or not $game_party.inputable? start_main end end end #-------------------------------------------------------------------------- # overwrite process_escape #-------------------------------------------------------------------------- def process_escape @info_viewport.visible = false unless @redux_msg @message_window.visible = true text = sprintf(Vocab::EscapeStart, $game_party.name) $game_message.texts.push(text) if $game_troop.preemptive success = true else success = (rand(100) < @escape_ratio) end Sound.play_escape if success wait_for_message battle_end(1) else @escape_ratio += 10 $game_message.texts.push('\.' + Vocab::EscapeFailure) wait_for_message $game_party.clear_actions start_main end end #-------------------------------------------------------------------------- # overwrite process victory #-------------------------------------------------------------------------- unless $imported["DisplayVictoryAftermath"] def process_victory @info_viewport.visible = false unless @redux_msg @message_window.visible = true RPG::BGM.stop $game_system.battle_end_me.play unless $BTEST $game_temp.map_bgm.play $game_temp.map_bgs.play end display_exp_and_gold display_drop_items display_level_up battle_end(0) if YE::REDUX::BATTLE::COMMON_EVENT_END_BATTLE != nil $game_temp.common_event_id = YE::REDUX::BATTLE::COMMON_EVENT_END_BATTLE end end end #-------------------------------------------------------------------------- # overwrite process_defeat #-------------------------------------------------------------------------- def process_defeat @info_viewport.visible = false unless @redux_msg @message_window.visible = true text = sprintf(Vocab::Defeat, $game_party.name) $game_message.texts.push(text) wait_for_message battle_end(2) end #-------------------------------------------------------------------------- # overwrite start_main # turn order fix included #-------------------------------------------------------------------------- def start_main if YE::REDUX::BATTLE::COMMON_EVENT_TURN_BEGIN != nil $game_temp.common_event_id = YE::REDUX::BATTLE::COMMON_EVENT_TURN_BEGIN end $game_troop.increase_turn @status_window.index = @actor_index = -1 if @redux_msg @party_command_window.openness = 128 @party_command_window.close @actor_command_window.openness = 128 @actor_command_window.close loop { update_basic @party_command_window.update @actor_command_window.update break if @info_viewport.ox == 64 if @info_viewport.ox > 64 @info_viewport.ox -= 16 else @info_viewport.ox += 16 end } else @info_viewport.visible = false @info_viewport.ox = 0 end @message_window.visible = true @party_command_window.active = false @actor_command_window.active = false @active_battler = nil @message_window.clear $game_troop.make_actions @performed_actors = [] make_action_orders wait(20) end #-------------------------------------------------------------------------- # overwrite turn end #-------------------------------------------------------------------------- def turn_end if YE::REDUX::BATTLE::COMMON_EVENT_TURN_CLOSE != nil $game_temp.common_event_id = YE::REDUX::BATTLE::COMMON_EVENT_TURN_CLOSE end $game_troop.turn_ending = true $game_party.slip_damage_effect $game_troop.slip_damage_effect $game_party.do_auto_recovery $game_troop.preemptive = false $game_troop.surprise = false process_battle_event $game_troop.turn_ending = false start_party_command_selection end #-------------------------------------------------------------------------- # overwrite set_next_active_battler #-------------------------------------------------------------------------- def set_next_active_battler @performed_actors = [] if @performed_actors == nil loop do if $game_troop.forcing_battler != nil @active_battler = $game_troop.forcing_battler @action_battlers.delete(@active_battler) $game_troop.forcing_battler = nil else make_action_orders @action_battlers -= @performed_actors @active_battler = @action_battlers.shift end @performed_actors.push(@active_battler) unless @active_battler == nil return if @active_battler == nil return if @active_battler.index != nil end end #-------------------------------------------------------------------------- # overwrite display_current_state #-------------------------------------------------------------------------- def display_current_state return unless YE::REDUX::BATTLE::MSG_CURRENT_STATE state_text = @active_battler.most_important_state_text unless state_text.empty? wait(5) text = @active_battler.name + state_text @message_window.add_instant_text(text) wait(45) @message_window.clear end end #-------------------------------------------------------------------------- # overwrite execute_action_attack #-------------------------------------------------------------------------- def execute_action_attack if YE::REDUX::BATTLE::MSG_CURRENT_ACTION text = sprintf(Vocab::DoAttack, @active_battler.name) @message_window.add_instant_text(text) end targets = @active_battler.action.make_targets display_attack_animation(targets) wait(20) for target in targets target.attack_effect(@active_battler) display_action_effects(target) end for target in targets target.perform_collapse unless target.collapse if @redux_msg and target.actor? @status_window.draw_item(target.index) if target.collapse end end end #-------------------------------------------------------------------------- # overwrite execute_action_guard #-------------------------------------------------------------------------- def execute_action_guard return unless YE::REDUX::BATTLE::MSG_CURRENT_ACTION text = sprintf(Vocab::DoGuard, @active_battler.name) @message_window.add_instant_text(text) wait(45) end #-------------------------------------------------------------------------- # overwrite execute_action_escape #-------------------------------------------------------------------------- def execute_action_escape text = sprintf(Vocab::DoEscape, @active_battler.name) @message_window.add_instant_text(text) @active_battler.escape Sound.play_escape wait(45) end #-------------------------------------------------------------------------- # overwrite execute_action_wait #-------------------------------------------------------------------------- def execute_action_wait return unless YE::REDUX::BATTLE::MSG_CURRENT_ACTION text = sprintf(Vocab::DoWait, @active_battler.name) @message_window.add_instant_text(text) wait(45) end #-------------------------------------------------------------------------- # overwrite execute_action_skill #-------------------------------------------------------------------------- unless $imported["CustomSkillEffects"] def execute_action_skill skill = @active_battler.action.skill if !skill.message1.empty? and YE::REDUX::BATTLE::MSG_CURRENT_ACTION text = @active_battler.name + skill.message1 @message_window.add_instant_text(text) end if !skill.message2.empty? and YE::REDUX::BATTLE::MSG_CURRENT_ACTION wait(10) @message_window.add_instant_text(skill.message2) end targets = @active_battler.action.make_targets display_animation(targets, skill.animation_id) @active_battler.mp -= @active_battler.calc_mp_cost(skill) if @redux_msg and @active_battler.actor? @status_window.draw_item(@active_battler.index) end $game_temp.common_event_id = skill.common_event_id for target in targets target.skill_effect(@active_battler, skill) display_action_effects(target, skill) end for target in targets target.perform_collapse unless target.collapse if @redux_msg and target.actor? @status_window.draw_item(target.index) if target.collapse end end end end #-------------------------------------------------------------------------- # overwrite execute_action_item #-------------------------------------------------------------------------- def execute_action_item item = @active_battler.action.item if YE::REDUX::BATTLE::MSG_CURRENT_ACTION text = sprintf(Vocab::UseItem, @active_battler.name, item.name) @message_window.add_instant_text(text) end targets = @active_battler.action.make_targets display_animation(targets, item.animation_id) $game_party.consume_item(item) $game_temp.common_event_id = item.common_event_id for target in targets target.item_effect(@active_battler, item) display_action_effects(target, item) end end #-------------------------------------------------------------------------- # overwrite display_critical #-------------------------------------------------------------------------- def display_critical(target, obj = nil) if target.critical #--- if @enable_popup target.popup_rules = 1 target.popup_value = YE::REDUX::BATTLE::POPUP_CRITICAL end #--- if target.actor? text = Vocab::CriticalToActor else text = Vocab::CriticalToEnemy end if YE::REDUX::BATTLE::MSG_DISPLAY_CRITS @message_window.add_instant_text(text) end wait(20) end end #-------------------------------------------------------------------------- # overwrite display_miss #-------------------------------------------------------------------------- def display_miss(target, obj = nil) popup_value = nil if obj == nil or obj.physical_attack popup_value = YE::REDUX::BATTLE::POPUP_MISSED if @enable_popup if target.actor? text = sprintf(Vocab::ActorNoHit, target.name) else text = sprintf(Vocab::EnemyNoHit, target.name) end Sound.play_miss else popup_value = YE::REDUX::BATTLE::POPUP_FAILED if @enable_popup text = sprintf(Vocab::ActionFailure, target.name) end if popup_value != nil target.popup_rules = 0 target.popup_value = popup_value end if YE::REDUX::BATTLE::MSG_DISPLAY_MISSES @message_window.add_instant_text(text) end wait(30) end #-------------------------------------------------------------------------- # overwrite display_evasion #-------------------------------------------------------------------------- def display_evasion(target, obj = nil) if @enable_popup target.popup_rules = 0 target.popup_value = YE::REDUX::BATTLE::POPUP_EVADED end if target.actor? text = sprintf(Vocab::ActorEvasion, target.name) else text = sprintf(Vocab::EnemyEvasion, target.name) end Sound.play_evasion if YE::REDUX::BATTLE::MSG_DISPLAY_EVADES @message_window.add_instant_text(text) end wait(30) end #-------------------------------------------------------------------------- # new method display absorbed #-------------------------------------------------------------------------- def display_absorbed(target, popup_value) return sprintf(YE::REDUX::BATTLE::POPUP_ABSORBED, popup_value) end #-------------------------------------------------------------------------- # overwrite display_hp_damage #-------------------------------------------------------------------------- def display_hp_damage(target, obj = nil) popup_value = nil if target.hp_damage == 0 # No damage return if obj != nil and obj.damage_to_mp return if obj != nil and obj.base_damage == 0 fmt = target.actor? ? Vocab::ActorNoDamage : Vocab::EnemyNoDamage text = sprintf(fmt, target.name) if @enable_popup target.popup_rules = 0 popup_value = YE::REDUX::BATTLE::POPUP_FAILED end elsif target.absorbed # Absorb fmt = target.actor? ? Vocab::ActorDrain : Vocab::EnemyDrain text = sprintf(fmt, target.name, Vocab::hp, target.hp_damage) if @enable_popup target.popup_rules = 9 popup_value = target.hp_damage YE::REDUX::BATTLE::ABSORB_HP_SOUND.play end elsif target.hp_damage > 0 # Damage if @enable_popup target.popup_rules = 2 popup_value = target.hp_damage end if target.actor? text = sprintf(Vocab::ActorDamage, target.name, target.hp_damage) Sound.play_actor_damage if YE::REDUX::BATTLE::ACTOR_SCREEN_SHAKE $game_troop.screen.start_shake(5, 5, 10) end else text = sprintf(Vocab::EnemyDamage, target.name, target.hp_damage) Sound.play_enemy_damage target.blink = true end else # Recovery if @enable_popup target.popup_rules = 3 popup_value = sprintf("+%d", -1 * target.hp_damage) end fmt = target.actor? ? Vocab::ActorRecovery : Vocab::EnemyRecovery text = sprintf(fmt, target.name, Vocab::hp, -target.hp_damage) Sound.play_recovery end if popup_value != nil popup_value = display_absorbed(target, popup_value) if target.absorbed target.popup_value = sprintf(YE::REDUX::BATTLE::POPUP_HP, popup_value) end if @redux_msg and target.actor? @status_window.draw_item(target.index) end if YE::REDUX::BATTLE::MSG_DISPLAY_HP_DMG @message_window.add_instant_text(text) end wait(30) end #-------------------------------------------------------------------------- # overwrite display_mp_damage #-------------------------------------------------------------------------- def display_mp_damage(target, obj = nil) return if target.dead? return if target.mp_damage == 0 popup_value = nil if target.absorbed # Absorb fmt = target.actor? ? Vocab::ActorDrain : Vocab::EnemyDrain text = sprintf(fmt, target.name, Vocab::mp, target.mp_damage) if @enable_popup target.popup_rules = 10 popup_value = target.mp_damage YE::REDUX::BATTLE::ABSORB_MP_SOUND.play end elsif target.mp_damage > 0 # Damage if @enable_popup target.popup_rules = 4 popup_value = target.mp_damage end fmt = target.actor? ? Vocab::ActorLoss : Vocab::EnemyLoss text = sprintf(fmt, target.name, Vocab::mp, target.mp_damage) else # Recovery if @enable_popup target.popup_rules = 5 popup_value = sprintf("+%d", -1 * target.mp_damage) end fmt = target.actor? ? Vocab::ActorRecovery : Vocab::EnemyRecovery text = sprintf(fmt, target.name, Vocab::mp, -target.mp_damage) Sound.play_recovery end if popup_value != nil popup_value = display_absorbed(target, popup_value) if target.absorbed target.popup_value = sprintf(YE::REDUX::BATTLE::POPUP_MP, popup_value) end if @redux_msg and target.actor? @status_window.draw_item(target.index) end if YE::REDUX::BATTLE::MSG_DISPLAY_MP_DMG @message_window.add_instant_text(text) end wait(30) end #-------------------------------------------------------------------------- # overwrite display_state_changes #-------------------------------------------------------------------------- def display_state_changes(target, obj = nil) return if target.missed or target.evaded return unless target.states_active? if @message_window.line_number < 4 and YE::REDUX::BATTLE::MSG_DISPLAY_STATES @message_window.add_instant_text("") end display_added_states(target, obj) display_removed_states(target, obj) display_remained_states(target, obj) if YE::REDUX::BATTLE::MSG_DISPLAY_STATES and @message_window.last_instant_text.empty? @message_window.back_one else wait(10) end end #-------------------------------------------------------------------------- # overwrite display_added_states #-------------------------------------------------------------------------- def display_added_states(target, obj = nil) for state in target.added_states popup_value = nil if target.actor? and !state.message1.empty? next if state.message1.empty? text = target.name + state.message1 popup_value = state.name if @enable_popup else next if state.message2.empty? text = target.name + state.message2 popup_value = state.name if @enable_popup end if popup_value != nil and !state.hide_apply target.popup_rules = 6 target.popup_value = sprintf(YE::REDUX::BATTLE::POPUP_ADD_ST, popup_value) end if @redux_msg and target.actor? @status_window.draw_item(target.index) end if YE::REDUX::BATTLE::MSG_DISPLAY_STATES @message_window.replace_instant_text(text) end wait(20) end end #-------------------------------------------------------------------------- # overwrite display_removed_states #-------------------------------------------------------------------------- def display_removed_states(target, obj = nil) for state in target.removed_states popup_value = nil next if state.message4.empty? text = target.name + state.message4 popup_value = state.name if @enable_popup if popup_value != nil and !state.hide_erase target.popup_rules = 7 target.popup_value = sprintf(YE::REDUX::BATTLE::POPUP_REM_ST, popup_value) end if @redux_msg and target.actor? @status_window.draw_item(target.index) end if YE::REDUX::BATTLE::MSG_DISPLAY_STATES @message_window.replace_instant_text(text) end wait(20) end end #-------------------------------------------------------------------------- # overwrite display_remained_states #-------------------------------------------------------------------------- def display_remained_states(target, obj = nil) for state in target.remained_states popup_value = nil next if state.message3.empty? text = target.name + state.message3 popup_value = state.name if @enable_popup if popup_value != nil and !state.hide_while target.popup_rules = 8 target.popup_value = sprintf(YE::REDUX::BATTLE::POPUP_REM_ST, popup_value) end if @redux_msg and target.actor? @status_window.draw_item(target.index) end if YE::REDUX::BATTLE::MSG_DISPLAY_STATES @message_window.replace_instant_text(text) end wait(20) end end #-------------------------------------------------------------------------- # overwrite display_failure #-------------------------------------------------------------------------- def display_failure(target, obj) return unless YE::REDUX::BATTLE::MSG_DISPLAY_FAILED if @enable_popup target.popup_rules = 0 target.popup_value = YE::REDUX::BATTLE::POPUP_FAILED end text = sprintf(Vocab::ActionFailure, target.name) @message_window.add_instant_text(text) wait(20) end end #=============================================================================== # # END OF FILE # #===============================================================================