#============================================================================== # š™ 퓬‘¬“x•ÏXiVXj ™š #------------------------------------------------------------------------------ # Ver.1_20080112ƒX #============================================================================== #============================================================================== # ÁÖÀÇ : »çÀ̵åºä ÀüÅõ¿Í´Â º´¿ëÇÏÁö ¸¶¼¼¿ä.. #============================================================================== module LRM #---------------------------------------------------------------------------- # ÀüüÀÇ ÀüÅõ¼Óµµ º¯°æ.. 1·Î°¥¼ö·Ï ´À·ÁÁý´Ï´Ù. (4ÀÌ»óÀº µÇµµ·Ï ÇÏÁö ¸¶¼¼¿ä) #---------------------------------------------------------------------------- BATTLE_ALTER_WHOLE_SPEED = 2 # ‰Šú‚Í1 #---------------------------------------------------------------------------- # œ 퓬ŠJŽn‚ÉŠÖ‚·‚鑬“x•ÏX #---------------------------------------------------------------------------- BATTLE_ALTER_PROCESS_BATTLE_START = 0 # ‰Šú‚Í10 BATTLE_ALTER_START_MAIN = 0 # ‰Šú‚Í20 BATTLE_ALTER_PROCESS_ACTION = 0 # ‰Šú‚Í5 #---------------------------------------------------------------------------- # œ ƒXƒe?ƒgŽ©‘R‰ðœŽž‚Ì‘¬“x•ÏX #---------------------------------------------------------------------------- BATTLE_ALTER_REMOVE_STATE_AUTO_BEFORE = 5 # ‰Šú‚Í5 BATTLE_ALTER_REMOVE_STATE_AUTO_AFTER = 30 # ‰Šú‚Í30 #---------------------------------------------------------------------------- # œ Œ»Ý‚̃Xƒe?ƒg‚ð?Ž¦‚·‚鑬“x•ÏX #---------------------------------------------------------------------------- BATTLE_ALTER_DISPLAY_CURRENT_STATE_BEFORE = 5 # ‰Šú‚Í5 BATTLE_ALTER_DISPLAY_CURRENT_STATE_AFTER = 45 # ‰Šú‚Í45 #---------------------------------------------------------------------------- # œ s“®ŽÀs‚ÉŠÖ‚·‚鑬“x•ÏX #---------------------------------------------------------------------------- BATTLE_ALTER_EXECUTE_ACTION_ATTACK = 20 # ‰Šú‚Í20 BATTLE_ALTER_EXECUTE_ACTION_GUARD = 45 # ‰Šú‚Í45 BATTLE_ALTER_EXECUTE_ACTION_ESCAPE = 45 # ‰Šú‚Í45 BATTLE_ALTER_EXECUTE_ACTION_WAIT = 45 # ‰Šú‚Í45 BATTLE_ALTER_EXECUTE_ACTION_SKILL = 10 # ‰Šú‚Í10 #---------------------------------------------------------------------------- # œ •¶Í?Ž¦‚ÉŠÖ‚·‚鑬“x•ÏX #---------------------------------------------------------------------------- BATTLE_ALTER_DISPLAY_ANIMATION = 20 # ‰Šú‚Í20 BATTLE_ALTER_DISPLAY_ATTACK_ANIMATION = 15 # ‰Šú‚Í15 BATTLE_ALTER_DISPLAY_NORMAL_ANIMATION_SINGLE = 20 # ‰Šú‚Í20 BATTLE_ALTER_DISPLAY_NORMAL_ANIMATION_WHOLE = 20 # ‰Šú‚Í20 BATTLE_ALTER_DISPLAY_ACTION_EFFECTS_BEFORE = 5 # ‰Šú‚Í5 BATTLE_ALTER_DISPLAY_ACTION_EFFECTS_AFTER = 30 # ‰Šú‚Í30 BATTLE_ALTER_DISPLAY_CRITICAL = 20 # ‰Šú‚Í20 BATTLE_ALTER_DISPLAY_MISS = 30 # ‰Šú‚Í30 BATTLE_ALTER_DISPLAY_EVASION = 30 # ‰Šú‚Í30 BATTLE_ALTER_DISPLAY_HP_DAMAGE = 30 # ‰Šú‚Í30 BATTLE_ALTER_DISPLAY_MP_DAMAGE = 30 # ‰Šú‚Í30 BATTLE_ALTER_DISPLAY_STATE_CHANGES = 10 # ‰Šú‚Í10 BATTLE_ALTER_DISPLAY_ADDED_STATES = 20 # ‰Šú‚Í20 BATTLE_ALTER_DISPLAY_REMOVED_STATES = 20 # ‰Šú‚Í20 BATTLE_ALTER_DISPLAY_REAINED_STATES = 20 # ‰Šú‚Í20 BATTLE_ALTER_DISPLAY_FAILURE = 20 # ‰Šú‚Í20 end class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # œ ˆê’莞ŠÔƒEƒFƒCƒg #-------------------------------------------------------------------------- def wait(duration, no_fast = false) for i in 0...duration / LRM::BATTLE_ALTER_WHOLE_SPEED update_basic break if not no_fast and i >= duration / 2 and show_fast? end end #-------------------------------------------------------------------------- # œ 퓬ŠJŽn‚̈— #-------------------------------------------------------------------------- def process_battle_start @message_window.clear wait(LRM::BATTLE_ALTER_PROCESS_BATTLE_START) for name in $game_troop.enemy_names text = sprintf(Vocab::Emerge, name) $game_message.texts.push(text) end 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 wait_for_message @message_window.clear make_escape_ratio process_battle_event start_party_command_selection end #-------------------------------------------------------------------------- # œ 퓬ˆ—‚ÌŽÀsŠJŽn°ÔÀÓ µ¥ÀÌÅÍ º£À̽º¿¡ ¸ÞÀÎ #-------------------------------------------------------------------------- def start_main $game_troop.increase_turn @info_viewport.visible = false @info_viewport.ox = 0 @message_window.visible = true @party_command_window.active = false @actor_command_window.active = false @status_window.index = @actor_index = -1 @active_battler = nil @message_window.clear $game_troop.make_actions make_action_orders wait(LRM::BATTLE_ALTER_START_MAIN) end #-------------------------------------------------------------------------- # œ 퓬s“®‚̈—°ÔÀÓÀÇ ½Â¸® ó¸® #-------------------------------------------------------------------------- def process_action return if judge_win_loss return if $game_temp.next_scene != nil set_next_active_battler if @active_battler == nil turn_end return end return if @active_battler.dead? @message_window.clear wait(LRM::BATTLE_ALTER_PROCESS_ACTION) @active_battler.white_flash = true unless @active_battler.action.forcing @active_battler.action.prepare end if @active_battler.action.valid? execute_action end unless @active_battler.action.forcing @message_window.clear remove_states_auto display_current_state end @active_battler.white_flash = false @message_window.clear end #-------------------------------------------------------------------------- # œ ƒXƒeÀüÅõ ¾Ö´Ï ¸ÞÀ̼ÇÀÇ º¯°æ #-------------------------------------------------------------------------- def remove_states_auto last_st = @active_battler.states @active_battler.remove_states_auto if @active_battler.states != last_st wait(LRM::BATTLE_ALTER_REMOVE_STATE_AUTO_BEFORE) display_state_changes(@active_battler) wait(LRM::BATTLE_ALTER_REMOVE_STATE_AUTO_AFTER) @message_window.clear end end #-------------------------------------------------------------------------- # œ Œ»Ý‚̃XÀüÅõ ¾Ö´Ï¸ÞÀ̼ÇÀÇ À©µµ¿ì #-------------------------------------------------------------------------- def display_current_state state_text = @active_battler.most_important_state_text unless state_text.empty? wait(LRM::BATTLE_ALTER_DISPLAY_CURRENT_STATE_BEFORE) text = @active_battler.name + state_text @message_window.add_instant_text(text) wait(LRM::BATTLE_ALTER_DISPLAY_CURRENT_STATE_AFTER) @message_window.clear end end #-------------------------------------------------------------------------- # œ 퓬s“®‚ÌŽÀs ÀüÅõ ¾Ö´Ï¸ÞÀ̼ÇÀ» Ç¥½ÃÇÒ ´ë»ó ÁöÁ¤ #-------------------------------------------------------------------------- def execute_action_attack text = sprintf(Vocab::DoAttack, @active_battler.name) @message_window.add_instant_text(text) targets = @active_battler.action.make_targets display_attack_animation(targets) wait(LRM::BATTLE_ALTER_EXECUTE_ACTION_ATTACK) for target in targets target.attack_effect(@active_battler) display_action_effects(target) end end #-------------------------------------------------------------------------- # œ 퓬s“®‚ÌŽÀs : –hŒä #-------------------------------------------------------------------------- def execute_action_guard text = sprintf(Vocab::DoGuard, @active_battler.name) @message_window.add_instant_text(text) wait(LRM::BATTLE_ALTER_EXECUTE_ACTION_GUARD) end #-------------------------------------------------------------------------- # œ 퓬s“®‚ÌŽÀs : “¦‘– #-------------------------------------------------------------------------- def execute_action_escape text = sprintf(Vocab::DoEscape, @active_battler.name) @message_window.add_instant_text(text) @active_battler.escape Sound.play_escape wait(LRM::BATTLE_ALTER_EXECUTE_ACTION_ESCAPE) end #-------------------------------------------------------------------------- # œ 퓬s“®‚ÌŽÀs : ‘Ò? #-------------------------------------------------------------------------- def execute_action_wait text = sprintf(Vocab::DoWait, @active_battler.name) @message_window.add_instant_text(text) wait(LRM::BATTLE_ALTER_EXECUTE_ACTION_WAIT) end #-------------------------------------------------------------------------- # œ 퓬s“®‚ÌŽÀs : ƒXƒLƒ‹ #-------------------------------------------------------------------------- def execute_action_skill skill = @active_battler.action.skill text = @active_battler.name + skill.message1 @message_window.add_instant_text(text) unless skill.message2.empty? wait(LRM::BATTLE_ALTER_EXECUTE_ACTION_SKILL) @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) $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 end #-------------------------------------------------------------------------- # œ ƒAƒjƒ?ƒVƒ‡ƒ“‚Ì?Ž¦ #-------------------------------------------------------------------------- def display_animation(targets, animation_id) if animation_id < 0 display_attack_animation(targets) else display_normal_animation(targets, animation_id) end wait(LRM::BATTLE_ALTER_DISPLAY_ANIMATION) wait_for_animation end #-------------------------------------------------------------------------- # œ UŒ‚ƒAƒjƒ?ƒVƒ‡ƒ“‚Ì?Ž¦ #-------------------------------------------------------------------------- def display_attack_animation(targets) if @active_battler.is_a?(Game_Enemy) Sound.play_enemy_attack wait(LRM::BATTLE_ALTER_DISPLAY_ATTACK_ANIMATION, true) else aid1 = @active_battler.atk_animation_id aid2 = @active_battler.atk_animation_id2 display_normal_animation(targets, aid1, false) display_normal_animation(targets, aid2, true) end wait_for_animation end #-------------------------------------------------------------------------- # œ ’ÊíƒAƒjƒ?ƒVƒ‡ƒ“‚Ì?Ž¦ #-------------------------------------------------------------------------- def display_normal_animation(targets, animation_id, mirror = false) animation = $data_animations[animation_id] if animation != nil to_screen = (animation.position == 3) # ˆÊ’u‚ªu‰æ–Êv‚©H for target in targets.uniq target.animation_id = animation_id target.animation_mirror = mirror wait(LRM::BATTLE_ALTER_DISPLAY_NORMAL_ANIMATION_SINGLE, true) unless to_screen end wait(LRM::BATTLE_ALTER_DISPLAY_NORMAL_ANIMATION_WHOLE, true) if to_screen end end #-------------------------------------------------------------------------- # œ s“®Œ‹‰Ê‚Ì?Ž¦ #-------------------------------------------------------------------------- def display_action_effects(target, obj = nil) unless target.skipped line_number = @message_window.line_number wait(LRM::BATTLE_ALTER_DISPLAY_ACTION_EFFECTS_BEFORE) display_critical(target, obj) display_damage(target, obj) display_state_changes(target, obj) if line_number == @message_window.line_number display_failure(target, obj) unless target.states_active? end if line_number != @message_window.line_number wait(LRM::BATTLE_ALTER_DISPLAY_ACTION_EFFECTS_AFTER) end @message_window.back_to(line_number) end end #-------------------------------------------------------------------------- # œ ƒNƒŠƒeƒBƒJƒ‹ƒqƒbƒg‚Ì?Ž¦ #-------------------------------------------------------------------------- def display_critical(target, obj = nil) if target.critical if target.actor? text = Vocab::CriticalToActor else text = Vocab::CriticalToEnemy end @message_window.add_instant_text(text) wait(LRM::BATTLE_ALTER_DISPLAY_CRITICAL) end end #-------------------------------------------------------------------------- # œ ?ƒX‚Ì?Ž¦ #-------------------------------------------------------------------------- def display_miss(target, obj = nil) if obj == nil or obj.physical_attack if target.actor? text = sprintf(Vocab::ActorNoHit, target.name) else text = sprintf(Vocab::EnemyNoHit, target.name) end Sound.play_miss else text = sprintf(Vocab::ActionFailure, target.name) end @message_window.add_instant_text(text) wait(LRM::BATTLE_ALTER_DISPLAY_MISS) end #-------------------------------------------------------------------------- # œ ‰ñ”ð‚Ì?Ž¦ #-------------------------------------------------------------------------- def display_evasion(target, obj = nil) if target.actor? text = sprintf(Vocab::ActorEvasion, target.name) else text = sprintf(Vocab::EnemyEvasion, target.name) end Sound.play_evasion @message_window.add_instant_text(text) wait(LRM::BATTLE_ALTER_DISPLAY_EVASION) end #-------------------------------------------------------------------------- # œ HP ?ƒ?ƒW?Ž¦ #-------------------------------------------------------------------------- def display_hp_damage(target, obj = nil) if target.hp_damage == 0 # ƒm??ƒ?ƒW 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) elsif target.absorbed # ‹zŽû fmt = target.actor? ? Vocab::ActorDrain : Vocab::EnemyDrain text = sprintf(fmt, target.name, Vocab::hp, target.hp_damage) elsif target.hp_damage > 0 # ?ƒ?ƒW if target.actor? text = sprintf(Vocab::ActorDamage, target.name, target.hp_damage) Sound.play_actor_damage $game_troop.screen.start_shake(5, 5, 10) else text = sprintf(Vocab::EnemyDamage, target.name, target.hp_damage) Sound.play_enemy_damage target.blink = true end else # ‰ñ•œ fmt = target.actor? ? Vocab::ActorRecovery : Vocab::EnemyRecovery text = sprintf(fmt, target.name, Vocab::hp, -target.hp_damage) Sound.play_recovery end @message_window.add_instant_text(text) wait(LRM::BATTLE_ALTER_DISPLAY_HP_DAMAGE) end #-------------------------------------------------------------------------- # œ MP ?ƒ?ƒW?Ž¦ #-------------------------------------------------------------------------- def display_mp_damage(target, obj = nil) return if target.dead? return if target.mp_damage == 0 if target.absorbed # ‹zŽû fmt = target.actor? ? Vocab::ActorDrain : Vocab::EnemyDrain text = sprintf(fmt, target.name, Vocab::mp, target.mp_damage) elsif target.mp_damage > 0 # ?ƒ?ƒW fmt = target.actor? ? Vocab::ActorLoss : Vocab::EnemyLoss text = sprintf(fmt, target.name, Vocab::mp, target.mp_damage) else # ‰ñ•œ fmt = target.actor? ? Vocab::ActorRecovery : Vocab::EnemyRecovery text = sprintf(fmt, target.name, Vocab::mp, -target.mp_damage) Sound.play_recovery end @message_window.add_instant_text(text) wait(LRM::BATTLE_ALTER_DISPLAY_MP_DAMAGE) end #-------------------------------------------------------------------------- # œ ƒXƒe?ƒg•Ï‰»‚Ì?Ž¦ #-------------------------------------------------------------------------- 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 @message_window.add_instant_text("") end display_added_states(target, obj) display_removed_states(target, obj) display_remained_states(target, obj) if @message_window.last_instant_text.empty? @message_window.back_one else wait(LRM::BATTLE_ALTER_DISPLAY_STATE_CHANGES) end end #-------------------------------------------------------------------------- # œ •t‰Á‚³‚ꂽƒXƒe?ƒg‚Ì?Ž¦ #-------------------------------------------------------------------------- def display_added_states(target, obj = nil) for state in target.added_states if target.actor? next if state.message1.empty? text = target.name + state.message1 else next if state.message2.empty? text = target.name + state.message2 end if state.id == 1 # 퓬•s? target.perform_collapse end @message_window.replace_instant_text(text) wait(LRM::BATTLE_ALTER_DISPLAY_ADDED_STATES) end end #-------------------------------------------------------------------------- # œ ‰ðœ‚³‚ꂽƒXƒe?ƒg‚Ì?Ž¦ #-------------------------------------------------------------------------- def display_removed_states(target, obj = nil) for state in target.removed_states next if state.message4.empty? text = target.name + state.message4 @message_window.replace_instant_text(text) wait(LRM::BATTLE_ALTER_DISPLAY_REMOVED_STATES) end end #-------------------------------------------------------------------------- # œ •Ï‰»‚µ‚È‚©‚Á‚½ƒXƒe?ƒg‚Ì?Ž¦ #-------------------------------------------------------------------------- def display_remained_states(target, obj = nil) for state in target.remained_states next if state.message3.empty? text = target.name + state.message3 @message_window.replace_instant_text(text) wait(LRM::BATTLE_ALTER_DISPLAY_REAINED_STATES) end end #-------------------------------------------------------------------------- # œ Ž¸”s‚Ì?Ž¦ #-------------------------------------------------------------------------- def display_failure(target, obj) text = sprintf(Vocab::ActionFailure, target.name) @message_window.add_instant_text(text) wait(LRM::BATTLE_ALTER_DISPLAY_FAILURE) end end