2007.07.06 09:14

스크립트

조회 수 789 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
스크립트 넣으면 한줄로 되서 이상하게 될 때가 있던데.. #때문에..

이거 자동으로 마추게 하려면 어떻게 하지요-_-;;

일일이 하자니 너무 오래걸려요..ㅠㅠ 포기

이 스크립트는 RTAP인데..

어떻게좀..ㅠㅠ

# 리얼타임·액티브 배틀(RTAB) Ver 1.05 # 배포원·서포트URL # http://members.jcom.home.ne.jp/cogwheel/ class Scene_Battle #-------------------------------------------------------------------------- # ● 공개 인스턴스 변수 #-------------------------------------------------------------------------- attr_reader :status_window # 스테이터스 윈도우 attr_reader :spriteset # 배틀 스프라이트 attr_reader :scroll_time # 스크린 이동 기본 시간 attr_reader :zoom_rate # 적 버틀러 기본 위치 attr_reader :drive # 카메라 구동 attr_accessor :force # 액션 강제도 attr_accessor :camera # 현재의 카메라 소지자 #-------------------------------------------------------------------------- # ● ATB기초 셋업 #-------------------------------------------------------------------------- def atb_setup # ATB초기화 # speed : 배틀 스피드 결정. 값이 작을 정도 빠른 # @active : 액티브도 설정 # 3 : 항상 액티브 상태 # 2 : 스킬·아이템 선택중만 액티브 게이지가 멈추는 # 1 : 2상태에 가세해 타겟 선택시도 웨이트가 걸리는 # 0 : 1상태에 가세해 커멘드 입력시에도 웨이트가 걸리는 # @action : 타인이 행동중에 자신도 행동을 일으키는 것을 허락할까 # 3 : 자신이 행동 불능이 아닌 한 한정해 허락하는 # 2 : 자신이 데미지를 받지 않은 한 허락하는 # 1 : 2상태에 가세해 타겟이 행동하고 있지 않는 한 허락하는 # 0 : 행동을 허락하지 않는다. 차례로 행동 끝마칠 때까지 기다리는 # @anime_wait : true으로 하면(자) 배틀 애니메이션·데미지 표시중은 웨이트가 걸리는 # @damage_wait : 데미지 표시 대기 시간(단위는 프레임) # @enemy_speed : 적의 사고 속도. 1(이)라면 즉시 행동. # 1프레임마다 ,1/@enemy_speed의 확률로 행동을 일으키는 # @force : 강제 액션으로 스킬 사용시의 강제 상태 # 2:스킬은 모두 영창 하지 않고 , 반드시 즉시 실행 # 1:단독 스킬은 영창 해 , 제휴 스킬만 즉시 실행 # 0:전 스킬 영창을 실시할 뿐(만큼) # ($scene.force = x 과 하는 것으로써 , 통상 이벤트의 스크립트로부터 변경 가능) # @drive : 카메라 구동ON/OFF. true그리고 구동ON,false그리고 구동OFF # @scroll_time : 스크린 이동에 필요로 하는 기본 시간 # @zoom_rate = [i, j] : 에너미의 줌율 # i 이 화면 최상부에 배치했을 때의 확대율 # j 이 화면 최하부에 배치했을 때의 확대율 # 1 배로 하고 싶을 때도 ,1.0 라고 반드시 소수로 설정하는 것 speed = 150 @active = 1 @action = 2 @anime_wait = false @damage_wait = 10 @enemy_speed = 40 @force = 2 @drive = true @scroll_time = 15 @zoom_rate = [0.2, 1.0] @help_time = 40 @escape == false @camera = nil @max = 0 @turn_cnt = 0 @help_wait = 0 @action_battlers = [] @synthe = [] @spell_p = {} @spell_e = {} @command_a = false @command = [] @party = false for battler in $game_party.actors + $game_troop.enemies spell_reset(battler) battler.at = battler.agi * rand(speed / 2) battler.damage_pop = {} battler.damage = {} battler.damage_sp = {} battler.critical = {} battler.recover_hp = {} battler.recover_sp = {} battler.state_p = {} battler.state_m = {} battler.animation = [] if battler.is_a?(Game_Actor) @max += battler.agi end end @max *= speed @max /= $game_party.actors.size for battler in $game_party.actors + $game_troop.enemies battler.atp = 100 * battler.at / @max end end #-------------------------------------------------------------------------- # ● AT게이지Max시SE #-------------------------------------------------------------------------- def fullat_se Audio.se_play("Audio/SE/033-switch02", 80, 100) end #-------------------------------------------------------------------------- # ● 레벨업SE #-------------------------------------------------------------------------- def levelup_se Audio.se_play("Audio/SE/056-Right02", 80, 100) end #-------------------------------------------------------------------------- # ● 스킬 습득SE #-------------------------------------------------------------------------- def skill_se Audio.se_play("Audio/SE/056-Right02", 80, 150) end end class Window_Base < Window #-------------------------------------------------------------------------- # ● ATG 의 묘화 # actor : 엑터 # x : 묘화처 X 좌표 # y : 묘화처 Y 좌표 # width : 묘화처의 폭 #-------------------------------------------------------------------------- def draw_actor_atg(actor, x, y, width = 144) if @at_gauge == nil # plus_x:X좌표의 위치 보정 rate_x:X좌표의 위치 보정(%) plus_y:Y좌표의 위치 보정 # plus_width:폭의 보정 rate_width:폭의 보정(%) height:세로폭 # align1:묘화 타입1 0:왼쪽 막혀라 1:centering 2:right justify # align2:묘화 타입2 0:카미츠메째 1:centering 2:하막혀라 # align3:게이지 타입 0:왼쪽 막혀라 1:right justify @plus_x = 0 @rate_x = 0 @plus_y = 16 @plus_width = 0 @rate_width = 100 @width = @plus_width + width * @rate_width / 100 @height = 16 @align1 = 0 @align2 = 1 @align3 = 0 # 그라데이션 설정 grade1:하늘 게이지 grade2:열매 게이지 # (0:옆에 그라데이션 1:세로에 그라데이션 2:비스듬하게 그라데이션) grade1 = 1 grade2 = 0 # 색 설정. color1:최외측선 ,color2:중범위 # color3:공범위 다크 칼라 ,color4:공범위 라이트 칼라 color1 = Color.new(0, 0, 0) color2 = Color.new(255, 255, 192) color3 = Color.new(0, 0, 0, 192) color4 = Color.new(0, 0, 64, 192) # 게이지의 색 설정 # 통상시의 색 설정 color5 = Color.new(0, 64, 80) color6 = Color.new(0, 128, 160) # 게이지가MAX의 때의 색 설정 color7 = Color.new(80, 0, 0) color8 = Color.new(240, 0, 0) # 제휴 스킬 사용시의 색 설정 color9 = Color.new(80, 64, 32) color10 = Color.new(240, 192, 96) # 스킬 영창시의 색 설정 color11 = Color.new(80, 0, 64) color12 = Color.new(240, 0, 192) # 게이지의 묘화 gauge_rect_at(@width, @height, @align3, color1, color2, color3, color4, color5, color6, color7, color8, color9, color10, color11, color12, grade1, grade2) end # 변수at에 묘화 하는 게이지의 폭을 대입 if actor.rtp == 0 at = (width + @plus_width) * actor.atp * @rate_width / 10000 else at = (width + @plus_width) * actor.rt * @rate_width / actor.rtp / 100 end if at > width at = width end # 게이지의 좌힐·중앙 짓고 등 의 보정 case @align1 when 1 x += (@rect_width - width) / 2 when 2 x += @rect_width - width end case @align2 when 1 y -= @height / 2 when 2 y -= @height end self.contents.blt(x + @plus_x + width * @rate_x / 100, y + @plus_y, @at_gauge, Rect.new(0, 0, @width, @height)) if @align3 == 0 rect_x = 0 else x += @width - at - 1 rect_x = @width - at - 1 end # 게이지의 색 설정 if at == width # MAX시의 게이지 묘화 self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y, @at_gauge, Rect.new(rect_x, @height * 2, at, @height)) else if actor.rtp == 0 # 통상시의 게이지 묘화 self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y, @at_gauge, Rect.new(rect_x, @height, at, @height)) else if actor.spell == true # 제휴 스킬 사용시의 게이지 묘화 self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y, @at_gauge, Rect.new(rect_x, @height * 3, at, @height)) else # 스킬 영창시의 게이지 묘화 self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y, @at_gauge, Rect.new(rect_x, @height * 4, at, @height)) end end end end end #============================================================================== # ■ Scene_Battle (분할 정의 1) #------------------------------------------------------------------------------ #  배틀 화면의 처리를 실시하는 클래스입니다. #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # ● 메인 처리 #-------------------------------------------------------------------------- def main # 전투용의 각종 일시 데이터를 초기화 $game_temp.in_battle = true $game_temp.battle_turn = 0 $game_temp.battle_event_flags.clear $game_temp.battle_abort = false $game_temp.battle_main_phase = false $game_temp.battleback_name = $game_map.battleback_name $game_temp.forcing_battler = nil # 배틀 이벤트용 interpreter를 초기화 $game_system.battle_interpreter.setup(nil, 0) # 무리를 준비 @troop_id = $game_temp.battle_troop_id $game_troop.setup(@troop_id) atb_setup # 엑터 커멘드 윈도우를 작성 s1 = $data_system.words.attack s2 = $data_system.words.skill s3 = $data_system.words.guard s4 = $data_system.words.item @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4]) @actor_command_window.y = 160 @actor_command_window.back_opacity = 160 @actor_command_window.active = false @actor_command_window.visible = false # 그 외의 윈도우를 작성 @party_command_window = Window_PartyCommand.new @help_window = Window_Help.new @help_window.back_opacity = 160 @help_window.visible = false @status_window = Window_BattleStatus.new @message_window = Window_Message.new # 스프라이트 세트를 작성 @spriteset = Spriteset_Battle.new # 웨이트 카운트를 초기화 @wait_count = 0 # 트란지션 실행 if $data_system.battle_transition == "" Graphics.transition(20) else Graphics.transition(40, "Graphics/Transitions/" + $data_system.battle_transition) end # 프레바트르페즈 개시 start_phase1 # 메인 루프 loop do # 게임 화면을 갱신 Graphics.update # 입력 정보를 갱신 Input.update # 프레임 갱신 update # 화면이 바뀌면(자) 루프를 중단 if $scene != self break end end # 맵을 리프레쉬 $game_map.refresh # 트란지션 준비 Graphics.freeze # 윈도우를 해방 @actor_command_window.dispose @party_command_window.dispose @help_window.dispose @status_window.dispose @message_window.dispose if @skill_window != nil @skill_window.dispose end if @item_window != nil @item_window.dispose end if @result_window != nil @result_window.dispose end # 스프라이트 세트를 해방 @spriteset.dispose # 타이틀 화면으로 전환하고 안의 경우 if $scene.is_a?(Scene_Title) # 화면을 페이드아웃 Graphics.transition Graphics.freeze end # 전투 테스트로부터 게임 오버 화면 이외에 바꾸고 안의 경우 if $BTEST and not $scene.is_a?(Scene_Gameover) $scene = nil end end #-------------------------------------------------------------------------- # ● 승패 판정 #-------------------------------------------------------------------------- def judge # 전멸 판정이 진 , 또는 파티 인원수가 0 사람의 경우 if $game_party.all_dead? or $game_party.actors.size == 0 # 패배 가능의 경우 if $game_temp.battle_can_lose # 배틀 개시전의 것 BGM 에 되돌리는 $game_system.bgm_play($game_temp.map_bgm) # 배틀 종료 battle_end(2) # true 를 돌려주는 return true end # 게임 오버 플래그를 세트 $game_temp.gameover = true # true 를 돌려주는 return true end # 에너미가 1 몸에서도 존재하면 false 을 돌려주는 for enemy in $game_troop.enemies if enemy.exist? return false end end # 애프터 배틀 국면 개시 (승리) start_phase5 # true 를 돌려주는 return true end #-------------------------------------------------------------------------- # ● 프레임 갱신 #-------------------------------------------------------------------------- def update # 배틀 이벤트 실행중의 경우 if $game_system.battle_interpreter.running? if @command.size > 0 @command_a = false @command = [] command_delete end @status_window.at_refresh # interpreter를 갱신 $game_system.battle_interpreter.update # 액션을 강제당하고 있는 버틀러가 존재하지 않는 경우 if $game_temp.forcing_battler == nil # 배틀 이벤트의 실행이 끝났을 경우 unless $game_system.battle_interpreter.running? # 배틀 이벤트의 셋업을 재실행 @status_window.refresh setup_battle_event end end end # 시스템 (타이머), 화면을 갱신 $game_system.update $game_screen.update # 타이머가 0 (이)가 되었을 경우 if $game_system.timer_working and $game_system.timer == 0 # 배틀 중단 $game_temp.battle_abort = true end # 윈도우를 갱신 @help_window.update @party_command_window.update @actor_command_window.update @status_window.update @message_window.update # 스프라이트 세트를 갱신 @spriteset.update # 트란지션 처리중의 경우 if $game_temp.transition_processing # 트란지션 처리중 플래그를 클리어 $game_temp.transition_processing = false # 트란지션 실행 if $game_temp.transition_name == "" Graphics.transition(20) else Graphics.transition(40, "Graphics/Transitions/" + $game_temp.transition_name) end end # 메세지 윈도우 표시중의 경우 if $game_temp.message_window_showing return end # 게임 오버의 경우 if $game_temp.gameover # 게임 오버 화면으로 전환하고 $scene = Scene_Gameover.new return end # 타이틀 화면에 되돌리는 경우 if $game_temp.to_title # 타이틀 화면으로 전환하고 $scene = Scene_Title.new return end # 배틀 중단의 경우 if $game_temp.battle_abort # 배틀 개시전의 것 BGM 에 되돌리는 $game_system.bgm_play($game_temp.map_bgm) # 배틀 종료 battle_end(1) return end # 헬프 윈도우 표시중의 경우 if @help_wait > 0 @help_wait -= 1 if @help_wait == 0 # 헬프 윈도우를 숨기는 @help_window.visible = false end end # 국면에 의해 분기 case @phase when 0 # AT게이지 갱신 국면 if anime_wait_return update_phase0 end when 1 # 프레바트르페즈 update_phase1 return when 2 # 파티 커멘드 국면 update_phase2 return when 5 # 애프터 배틀 국면 update_phase5 return end if $scene != self return end if @phase == 0 if @command.size != 0 # 엑터 커멘드 국면 if @command_a == false start_phase3 end update_phase3 end # 웨이트중의 경우 if @wait_count > 0 # 웨이트 카운트를 줄이는 @wait_count -= 1 return end update_phase4 end end #============================================================================== # ■ Scene_Battle (분할 정의 2) #------------------------------------------------------------------------------ #  배틀 화면의 처리를 실시하는 클래스입니다. #============================================================================== #-------------------------------------------------------------------------- # ● 프레임 갱신 (AT게이지 갱신 국면) #-------------------------------------------------------------------------- def update_phase0 if $game_temp.battle_turn == 0 $game_temp.battle_turn = 1 end # B 버튼이 밀렸을 경우 if @command_a == false and @party == false if Input.trigger?(Input::B) # 캔슬 SE 을 연주 $game_system.se_play($data_system.cancel_se) @party = true end end if @party == true and ((@action > 0 and @action_battlers.empty?) or (@action == 0 and (@action_battlers.empty? or @action_battlers[0].phase == 1))) # 파티 커멘드 국면에 start_phase2 return end # AT게이지 증가 처리 cnt = 0 for battler in $game_party.actors + $game_troop.enemies active?(battler) if battler.rtp == 0 if battler.at >= @max if battler.is_a?(Game_Actor) if battler.inputable? unless @action_battlers.include?(battler) or @command.include?(battler) or @escape == true if battler.current_action.forcing fullat_se force_action(battler) action_start(battler) else fullat_se @command.push(battler) end end else unless @action_battlers.include?(battler) or battler == @command[0] battler.current_action.clear if @command.include?(battler) @command.delete(battler) else if battler.movable? fullat_se end end action_start(battler) end end else unless @action_battlers.include?(battler) if battler.current_action.forcing force_action(battler) action_start(battler) else if @enemy_speed != 0 if rand(@enemy_speed) == 0 number = cnt - $game_party.actors.size enemy_action(number) end else number = cnt - $game_party.actors.size enemy_action(number) end end end end else battler.at += battler.agi if battler.guarding? battler.at += battler.agi end if battler.movable? battler.atp = 100 * battler.at / @max end end else if battler.rt >= battler.rtp speller = synthe?(battler) if speller != nil battler = speller[0] end unless @action_battlers.include?(battler) if battler.is_a?(Game_Actor) fullat_se end battler.rt = battler.rtp action_start(battler) end else battler.rt += battler.agi speller = synthe?(battler) if speller != nil for spell in speller if spell != battler spell.rt += battler.agi end end end end end cnt += 1 end # AT게이지를 리프레쉬 @status_window.at_refresh # 도주 처리 if @escape == true and ((@action > 0 and @action_battlers.empty?) or (@action == 0 and (@action_battlers.empty? or @action_battlers[0].phase == 1))) temp = false for battler in $game_party.actors if battler.inputable? temp = true end end if temp == true for battler in $game_party.actors if battler.at < @max and battler.inputable? temp = false break end end if temp == true @escape = false for battler in $game_party.actors battler.at %= @max end $game_temp.battle_main_phase = false update_phase2_escape end end end end #-------------------------------------------------------------------------- # ● 파티 커멘드 국면 개시 #-------------------------------------------------------------------------- def start_phase2 # 국면 2 에 이행 @phase = 2 @party = false # 파티 커멘드 윈도우를 유효화 @party_command_window.active = true @party_command_window.visible = true # 엑터를 비선택 상태로 설정 @actor_index = -1 # 엑터 커멘드 윈도우를 무효화 @actor_command_window.active = false @actor_command_window.visible = false if @command.size != 0 # 엑터의 명 멸망 효과 OFF if @active_actor != nil @active_actor.blink = false end end # 카메라 세트 @camera == "party" @spriteset.screen_target(0, 0, 1) # 메인 국면 플래그를 클리어 $game_temp.battle_main_phase = false end #-------------------------------------------------------------------------- # ● 프레임 갱신 (파티 커멘드 국면) #-------------------------------------------------------------------------- def update_phase2 # C 버튼이 밀렸을 경우 if Input.trigger?(Input::C) # 파티 커멘드 윈도우의 커서 위치에서 분기 case @party_command_window.index when 0 # 싸우는 # 파티 커멘드 윈도우를 무효화 @party_command_window.active = false @party_command_window.visible = false # 결정 SE 을 연주 $game_system.se_play($data_system.decision_se) @escape = false @phase = 0 if $game_temp.battle_turn == 0 $game_temp.battle_turn = 1 end if @command_a == true # 엑터 커멘드 국면 개시 start_phase3 else $game_temp.battle_main_phase = true end when 1 # 도망치는 # 도주 가능하지 않는 경우 if $game_temp.battle_can_escape == false # 버저 SE 를 연주 $game_system.se_play($data_system.buzzer_se) return end # 결정 SE 을 연주 $game_system.se_play($data_system.decision_se) @phase = 0 # 파티 커멘드 윈도우를 무효화 @party_command_window.active = false @party_command_window.visible = false $game_temp.battle_main_phase = true if $game_temp.battle_turn == 0 update_phase2_escape $game_temp.battle_turn = 1 for battler in $game_party.actors battler.at -= @max / 2 end return end # 결정 SE 을 연주 $game_system.se_play($data_system.decision_se) @escape = true for battler in $game_party.actors @command_a = false @command.delete(battler) @action_battlers.delete(battler) skill_reset(battler) end end return end end #-------------------------------------------------------------------------- # ● 애프터 배틀 국면 개시 #-------------------------------------------------------------------------- def start_phase5 # 국면 5 에 이행 @phase = 5 # 배틀 종료 ME 를 연주 $game_system.me_play($game_system.battle_end_me) # 배틀 개시전의 것 BGM 에 되돌리는 $game_system.bgm_play($game_temp.map_bgm) # EXP, 골드 , 트레이닝 전기밥통을 초기화 exp = 0 gold = 0 treasures = [] if @active_actor != nil @active_actor.blink = false end # 메인 국면 플래그를 세트 $game_temp.battle_main_phase = true # 파티 커멘드 윈도우를 무효화 @party_command_window.active = false @party_command_window.visible = false # 엑터 커멘드 윈도우를 무효화 @actor_command_window.active = false @actor_command_window.visible = false if @skill_window != nil # 스킬 윈도우를 해방 @skill_window.dispose @skill_window = nil end if @item_window != nil # 아이템 윈도우를 해방 @item_window.dispose @item_window = nil end # 헬프 윈도우를 숨기는 @help_window.visible = false # 루프 for enemy in $game_troop.enemies # 에너미가 숨고 상태가 아닌 경우 unless enemy.hidden # 획득 EXP, 골드를 추가 exp += enemy.exp gold += enemy.gold # 트레이닝 전기밥통 출현 판정 if rand(100) < enemy.treasure_prob if enemy.item_id > 0 treasures.push($data_items[enemy.item_id]) end if enemy.weapon_id > 0 treasures.push($data_weapons[enemy.weapon_id]) end if enemy.armor_id > 0 treasures.push($data_armors[enemy.armor_id]) end end end end # 트레이닝 전기밥통의 수를 6 개까지 한정 treasures = treasures[0..5] # EXP 획득 for i in 0...$game_party.actors.size actor = $game_party.actors[i] if actor.cant_get_exp? == false last_level = actor.level actor.exp += exp if actor.level > last_level @status_window.level_up(i) actor.damage[[actor, -1]] = "Level up!" actor.up_level = actor.level - last_level end end end # 골드 획득 $game_party.gain_gold(gold) # 트레이닝 전기밥통 획득 for item in treasures case item when RPG::Item $game_party.gain_item(item.id, 1) when RPG::Weapon $game_party.gain_weapon(item.id, 1) when RPG::Armor $game_party.gain_armor(item.id, 1) end end # 배틀 결과 윈도우를 작성 @result_window = Window_BattleResult.new(exp, gold, treasures) # 웨이트 카운트를 설정 @phase5_wait_count = 100 end #-------------------------------------------------------------------------- # ● 프레임 갱신 (애프터 배틀 국면) #-------------------------------------------------------------------------- def update_phase5 # 웨이트 카운트가 0 보다 큰 경우 if @phase5_wait_count > 0 # 웨이트 카운트를 줄이는 @phase5_wait_count -= 1 # 웨이트 카운트가 0 가 되었을 경우 if @phase5_wait_count == 0 # 결과 윈도우를 표시 @result_window.visible = true # 메인 국면 플래그를 클리어 $game_temp.battle_main_phase = false # 스테이터스 윈도우를 리프레쉬 @status_window.refresh for actor in $game_party.actors if actor.damage.include?([actor, 0]) @phase5_wait_count = 20 actor.damage_pop[[actor, 0]] = true end if actor.damage.include?([actor, -1]) @phase5_wait_count = 20 actor.damage_pop[[actor, -1]] = true for level in actor.level - actor.up_level + 1..actor.level for skill in $data_classes[actor.class_id].learnings if level == skill.level and not actor.skill_learn?(skill.id) actor.damage[[actor, 0]] = "New Skill!" break end end end end end end return end # C 버튼이 밀렸을 경우 if Input.trigger?(Input::C) # 배틀 종료 battle_end(0) end end #============================================================================== # ■ Scene_Battle (분할 정의 3) #------------------------------------------------------------------------------ #  배틀 화면의 처리를 실시하는 클래스입니다. #============================================================================== #-------------------------------------------------------------------------- # ● 엑터 커멘드 국면 개시 #-------------------------------------------------------------------------- def start_phase3 # 메인 국면 플래그를 클리어 $game_temp.battle_main_phase = false @command_a = true @active_actor = @command[0] cnt = 0 for actor in $game_party.actors if actor == @active_actor @actor_index = cnt end cnt += 1 end @active_actor.blink = true unless @active_actor.inputable? @active_actor.current_action.clear phase3_next_actor return end phase3_setup_command_window # 카메라의 설정 @camera = "command" plus = ($game_party.actors.size - 1) / 2.0 - @actor_index y = [(plus.abs - 1.5) * 10 , 0].min @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002) end #-------------------------------------------------------------------------- # ● 엑터의 커멘드 입력 종료 #-------------------------------------------------------------------------- def phase3_next_actor @command.shift @command_a = false # 메인 국면 플래그를 세트 $game_temp.battle_main_phase = true # 엑터 커멘드 윈도우를 무효화 @actor_command_window.active = false @actor_command_window.visible = false # 엑터의 명 멸망 효과 OFF if @active_actor != nil @active_actor.blink = false end action_start(@active_actor) # 카메라를 바탕으로 되돌리는 if @camera == "command" @spriteset.screen_target(0, 0, 1) end return end #-------------------------------------------------------------------------- # ● 엑터 커멘드 윈도우의 셋업 #-------------------------------------------------------------------------- def phase3_setup_command_window # 파티 커멘드 윈도우를 무효화 @party_command_window.active = false @party_command_window.visible = false # 엑터 커멘드 윈도우를 유효화 @actor_command_window.active = true @actor_command_window.visible = true # 엑터 커멘드 윈도우의 위치를 설정 @actor_command_window.x = @actor_index * 160 + (4 - $game_party.actors.size) * 80 # 인덱스를 0 로 설정 @actor_command_window.index = 0 end #-------------------------------------------------------------------------- # ● 에너미 액션 작성 #-------------------------------------------------------------------------- def enemy_action(number) enemy = $game_troop.enemies[number] unless enemy.current_action.forcing enemy.make_action end action_start(enemy) end #-------------------------------------------------------------------------- # ● 프레임 갱신 (엑터 커멘드 국면 : 기본 커멘드) #-------------------------------------------------------------------------- def update_phase3_basic_command unless @active_actor.inputable? @active_actor.current_action.clear phase3_next_actor return end # B 버튼이 밀렸을 경우 if Input.trigger?(Input::B) and @party == false # 캔슬 SE 을 연주 $game_system.se_play($data_system.cancel_se) @party = true end if @party == true and ((@action > 0 and @action_battlers.empty?) or (@action == 0 and (@action_battlers.empty? or @action_battlers[0].phase == 1))) # 파티 커멘드 국면에 start_phase2 return end # C 버튼이 밀렸을 경우 if Input.trigger?(Input::C) @party = false # 엑터 커멘드 윈도우의 커서 위치에서 분기 case @actor_command_window.index when 0 # 공격 if victory? # 버저 SE 를 연주 $game_system.se_play($data_system.buzzer_se) return end # 결정 SE 을 연주 $game_system.se_play($data_system.decision_se) # 에너미의 선택을 개시 start_enemy_select when 1 # 스킬 # 결정 SE 을 연주 $game_system.se_play($data_system.decision_se) # 스킬의 선택을 개시 start_skill_select when 2 # 방어 # 결정 SE 을 연주 $game_system.se_play($data_system.decision_se) # 액션을 설정 @active_actor.current_action.kind = 0 @active_actor.current_action.basic = 1 # 다음의 엑터의 커멘드 입력에 phase3_next_actor when 3 # 아이템 # 결정 SE 을 연주 $game_system.se_play($data_system.decision_se) # 아이템의 선택을 개시 start_item_select end return end # R 버튼이 밀렸을 경우 if Input.trigger?(Input::R) $game_system.se_play($data_system.cursor_se) @party = false # 엑터의 명 멸망 효과 OFF if @active_actor != nil @active_actor.blink = false end @command.push(@command[0]) @command.shift @command_a = false # 메인 국면 플래그를 세트 $game_temp.battle_main_phase = true # 엑터 커멘드 윈도우를 무효화 @actor_command_window.active = false @actor_command_window.visible = false end # L 버튼이 밀렸을 경우 if Input.trigger?(Input::L) $game_system.se_play($data_system.cursor_se) @party = false # 엑터의 명 멸망 효과 OFF if @active_actor != nil @active_actor.blink = false end @command.unshift(@command[@command.size - 1]) @command.delete_at(@command.size - 1) @command_a = false # 메인 국면 플래그를 세트 $game_temp.battle_main_phase = true # 엑터 커멘드 윈도우를 무효화 @actor_command_window.active = false @actor_command_window.visible = false end # 오른쪽 버튼이 밀렸을 경우 if Input.trigger?(Input::RIGHT) $game_system.se_play($data_system.cursor_se) @party = false # 엑터의 명 멸망 효과 OFF if @active_actor != nil @active_actor.blink = false end actor = $game_party.actors[@actor_index] while actor == @command[0] or (not @command.include?(actor)) @actor_index += 1 @actor_index %= $game_party.actors.size actor = $game_party.actors[@actor_index] if actor == @command[0] break end end while actor != @command[0] @command.push(@command.shift) end @command_a = false # 메인 국면 플래그를 세트 $game_temp.battle_main_phase = true # 엑터 커멘드 윈도우를 무효화 @actor_command_window.active = false @actor_command_window.visible = false end # 왼쪽 버튼이 밀렸을 경우 if Input.trigger?(Input::LEFT) $game_system.se_play($data_system.cursor_se) @party = false # 엑터의 명 멸망 효과 OFF if @active_actor != nil @active_actor.blink = false end actor = $game_party.actors[@actor_index] while actor == @command[0] or (not @command.include?(actor)) @actor_index -= 1 @actor_index %= $game_party.actors.size actor = $game_party.actors[@actor_index] if actor == @command[0] break end end while actor != @command[0] @command.push(@command.shift) end @command_a = false # 메인 국면 플래그를 세트 $game_temp.battle_main_phase = true # 엑터 커멘드 윈도우를 무효화 @actor_command_window.active = false @actor_command_window.visible = false end end #-------------------------------------------------------------------------- # ● 프레임 갱신 (엑터 커멘드 국면 : 스킬 선택) #-------------------------------------------------------------------------- def update_phase3_skill_select # 커멘드 선택중에 행동 불능이 되었을 경우 unless @active_actor.inputable? @active_actor.current_action.clear command_delete # 다음의 엑터의 커멘드 입력에 phase3_next_actor return end # 스킬 윈도우를 가시 상태로 하는 @skill_window.visible = true # 스킬 윈도우를 갱신 @skill_window.update # B 버튼이 밀렸을 경우 if Input.trigger?(Input::B) # 캔슬 SE 을 연주 $game_system.se_play($data_system.cancel_se) # 스킬의 선택을 종료 end_skill_select return end # C 버튼이 밀렸을 경우 if Input.trigger?(Input::C) # 스킬 윈도우로 현재 선택되고 있는 데이터를 취득 @skill = @skill_window.skill # 사용할 수 없는 경우 if @skill == nil or not @active_actor.skill_can_use?(@skill.id) # 버저 SE 를 연주 $game_system.se_play($data_system.buzzer_se) return end if @skill.scope == 1 or @skill.scope == 2 if victory? # 버저 SE 를 연주 $game_system.se_play($data_system.buzzer_se) return end end # 결정 SE 을 연주 $game_system.se_play($data_system.decision_se) # 액션을 설정 @active_actor.current_action.skill_id = @skill.id # 스킬 윈도우를 불가시 상태로 하는 @skill_window.visible = false # 효과 범위가 적 단체의 경우 if @skill.scope == 1 # 에너미의 선택을 개시 start_enemy_select # 효과 범위가 아군 단체의 경우 elsif @skill.scope == 3 or @skill.scope == 5 # 엑터의 선택을 개시 start_actor_select # 효과 범위가 단체가 아닌 경우 else # 액션을 설정 @active_actor.current_action.kind = 1 # 스킬의 선택을 종료 end_skill_select # 다음의 엑터의 커멘드 입력에 phase3_next_actor end return end end #-------------------------------------------------------------------------- # ● 프레임 갱신 (엑터 커멘드 국면 : 아이템 선택) #-------------------------------------------------------------------------- def update_phase3_item_select # 커멘드 선택중에 행동 불능이 되었을 경우 unless @active_actor.inputable? @active_actor.current_action.clear command_delete # 다음의 엑터의 커멘드 입력에 phase3_next_actor return end # 아이템 윈도우를 가시 상태로 하는 @item_window.visible = true # 아이템 윈도우를 갱신 @item_window.update # B 버튼이 밀렸을 경우 if Input.trigger?(Input::B) # 캔슬 SE 을 연주 $game_system.se_play($data_system.cancel_se) # 아이템의 선택을 종료 end_item_select return end # C 버튼이 밀렸을 경우 if Input.trigger?(Input::C) # 아이템 윈도우로 현재 선택되고 있는 데이터를 취득 @item = @item_window.item # 사용할 수 없는 경우 unless $game_party.item_can_use?(@item.id) # 버저 SE 를 연주 $game_system.se_play($data_system.buzzer_se) return end if @item.scope == 1 or @item.scope == 2 if victory? # 버저 SE 를 연주 $game_system.se_play($data_system.buzzer_se) return end end # 결정 SE 을 연주 $game_system.se_play($data_system.decision_se) # 액션을 설정 @active_actor.current_action.item_id = @item.id # 아이템 윈도우를 불가시 상태로 하는 @item_window.visible = false # 효과 범위가 적 단체의 경우 if @item.scope == 1 # 에너미의 선택을 개시 start_enemy_select # 효과 범위가 아군 단체의 경우 elsif @item.scope == 3 or @item.scope == 5 # 엑터의 선택을 개시 start_actor_select # 효과 범위가 단체가 아닌 경우 else # 액션을 설정 @active_actor.current_action.kind = 2 # 아이템의 선택을 종료 end_item_select # 다음의 엑터의 커멘드 입력에 phase3_next_actor end return end end #-------------------------------------------------------------------------- # ● 프레임 갱신 (엑터 커멘드 국면 : 에너미 선택) #-------------------------------------------------------------------------- def update_phase3_enemy_select if victory? # 카메라를 바탕으로 되돌리는 if @camera == "select" @spriteset.screen_target(0, 0, 1) end # 에너미의 선택을 종료 end_enemy_select return end # 커멘드 선택중에 행동 불능이 되었을 경우 unless @active_actor.inputable? # 카메라를 바탕으로 되돌리는 if @camera == "select" @spriteset.screen_target(0, 0, 1) end @active_actor.current_action.clear command_delete # 다음의 엑터의 커멘드 입력에 phase3_next_actor return end # 에네미아로를 갱신 @enemy_arrow.update # B 버튼이 밀렸을 경우 if Input.trigger?(Input::B) # 캔슬 SE 을 연주 $game_system.se_play($data_system.cancel_se) # 카메라를 바탕으로 되돌리는 if @camera == "select" # 카메라의 설정 @camera = "command" plus = ($game_party.actors.size - 1) / 2.0 - @actor_index y = [(plus.abs - 1.5) * 10 , 0].min @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002) end # 에너미의 선택을 종료 end_enemy_select return end # C 버튼이 밀렸을 경우 if Input.trigger?(Input::C) # 결정 SE 을 연주 $game_system.se_play($data_system.decision_se) # 액션을 설정 @active_actor.current_action.kind = 0 @active_actor.current_action.basic = 0 @active_actor.current_action.target_index = @enemy_arrow.index # 스킬 윈도우 표시중의 경우 if @skill_window != nil # 액션을 재설정 @active_actor.current_action.kind = 1 # 스킬의 선택을 종료 end_skill_select end # 아이템 윈도우 표시중의 경우 if @item_window != nil # 액션을 재설정 @active_actor.current_action.kind = 2 # 아이템의 선택을 종료 end_item_select end # 에너미의 선택을 종료 end_enemy_select # 다음의 엑터의 커멘드 입력에 phase3_next_actor end end #-------------------------------------------------------------------------- # ● 프레임 갱신 (엑터 커멘드 국면 : 엑터 선택) #-------------------------------------------------------------------------- def update_phase3_actor_select # 커멘드 선택중에 행동 불능이 되었을 경우 unless @active_actor.inputable? @active_actor.current_action.clear command_delete # 다음의 엑터의 커멘드 입력에 phase3_next_actor return end # 아크타아로를 갱신 @actor_arrow.update # B 버튼이 밀렸을 경우 if Input.trigger?(Input::B) # 캔슬 SE 을 연주 $game_system.se_play($data_system.cancel_se) # 엑터의 선택을 종료 end_actor_select return end # C 버튼이 밀렸을 경우 if Input.trigger?(Input::C) # 결정 SE 을 연주 $game_system.se_play($data_system.decision_se) # 액션을 설정 @active_actor.current_action.kind = 0 @active_actor.current_action.basic = 0 @active_actor.current_action.target_index = @actor_arrow.index # 엑터의 선택을 종료 end_actor_select # 스킬 윈도우 표시중의 경우 if @skill_window != nil # 액션을 재설정 @active_actor.current_action.kind = 1 # 스킬의 선택을 종료 end_skill_select end # 아이템 윈도우 표시중의 경우 if @item_window != nil # 액션을 재설정 @active_actor.current_action.kind = 2 # 아이템의 선택을 종료 end_item_select end # 다음의 엑터의 커멘드 입력에 phase3_next_actor end end #-------------------------------------------------------------------------- # ● 에너미 선택 개시 #-------------------------------------------------------------------------- alias :start_enemy_select_rtab :start_enemy_select def start_enemy_select @camera = "select" for enemy in $game_troop.enemies if enemy.exist? zoom = 1 / enemy.zoom @spriteset.screen_target(enemy.attack_x(zoom) * 0.75, enemy.attack_y(zoom) * 0.75, zoom) break end end # 오리지날의 처리 start_enemy_select_rtab end #-------------------------------------------------------------------------- # ● 에너미 선택 종료 #-------------------------------------------------------------------------- alias :end_enemy_select_rtab :end_enemy_select def end_enemy_select # 오리지날의 처리 end_enemy_select_rtab if (@action == 0 and not @action_battlers.empty?) or (@camera == "select" and (@active_actor.current_action.kind != 0 or @active_actor.animation1_id != 0)) @spriteset.screen_target(0, 0, 1) end end #-------------------------------------------------------------------------- # ● 스킬 선택 개시 #-------------------------------------------------------------------------- def start_skill_select # 스킬 윈도우를 작성 @skill_window = Window_Skill.new(@active_actor) # 헬프 윈도우를 관련짓고 @skill_window.help_window = @help_window # 엑터 커멘드 윈도우를 무효화 @actor_command_window.active = false @actor_command_window.visible = false end #============================================================================== # ■ Scene_Battle (분할 정의 4) #------------------------------------------------------------------------------ #  배틀 화면의 처리를 실시하는 클래스입니다. #============================================================================== #-------------------------------------------------------------------------- # ● 메인 국면 개시 #-------------------------------------------------------------------------- def start_phase4 $game_temp.battle_main_phase = true end #-------------------------------------------------------------------------- # ● 프레임 갱신 (메인 국면) #-------------------------------------------------------------------------- def update_phase4 # 액션을 강제당하고 있는 버틀러가 존재하는 경우 if $game_temp.forcing_battler != nil battler = $game_temp.forcing_battler if battler.current_action.forcing == false if @action_battlers.include?(battler) if @action > 0 or @action_battlers[0].phase == 1 @action_battlers.delete(battler) @action_battlers.push(battler) end if battler.phase == 1 battler.current_action.forcing = true force_action(battler) end else battler.current_action.forcing = true force_action(battler) action_start(battler) @action_battlers.delete(battler) @action_battlers.push(battler) end battler.at = @max battler.atp = 100 * battler.at / @max end end # action 가1이상의 경우 , 일제히 행동을 일으키는 for battler in @action_battlers.reverse # 웨이트중의 경우 if battler.wait > 0 # 웨이트 카운트를 줄이는 battler.wait -= 1 break if @action == 0 next end unless fin? and battler.phase < 3 and not $game_system.battle_interpreter.running? action_phase(battler) end break if @action == 0 end # 액션을 강제당하고 있는 버틀러가 존재하지 않는 경우 if $game_temp.forcing_battler == nil # 배틀 이벤트를 셋업 setup_battle_event # 배틀 이벤트 실행중의 경우 if $game_system.battle_interpreter.running? return end end for battler in @action_battlers.reverse if fin? and battler.phase < 3 and not $game_system.battle_interpreter.running? # 전투가 종료해 , 한편 엑터가 행동 직전의 경우는 엑터의 행동을 소거 @action_battlers.delete(battler) end end if @action_battlers.empty? and not $game_system.battle_interpreter.running? # 승패 판정 judge end end #-------------------------------------------------------------------------- # ● 액션 갱신 (메인 국면) #-------------------------------------------------------------------------- def action_phase(battler) # action 이 1 의 경우 , 버틀러가 행동중인지 어떤지 확인 if @action == 1 and battler.phase < 3 for target in battler.target speller = synthe?(target) if speller == nil # 타겟이 통상 행동중의 경우 if @action_battlers.include?(target) if target.phase > 2 return end end else # 타겟이 제휴 스킬 발동중의 경우 for spell in speller if @action_battlers.include?(spell) if spell.phase > 2 return end end end end end end case battler.phase when 1 update_phase4_step1(battler) when 2 update_phase4_step2(battler) when 3 update_phase4_step3(battler) when 4 update_phase4_step4(battler) when 5 update_phase4_step5(battler) when 6 update_phase4_step6(battler) end end #-------------------------------------------------------------------------- # ● 프레임 갱신 (메인 국면 스텝 1 : 액션 준비) #-------------------------------------------------------------------------- def update_phase4_step1(battler) # 벌써 전투로부터 떼어져 있는 경우 if battler.index == nil @action_battlers.delete(battler) anime_wait_return return end speller = synthe?(battler) if speller == nil # 데미지식등 있고 안의 경우 unless battler.damage.empty? or @action > 2 return end # 행동 가능한지 어떤지 판정 unless battler.movable? battler.phase = 6 return end else # 데미지식등 있고 안의 경우 for spell in speller unless spell.damage.empty? or @action > 2 return end # 행동 가능한지 어떤지 판정 unless spell.movable? battler.phase = 6 return end end end # 스킬 사용시 , 영창 시간 설정 # 강제 액션 한편 @force 이 2 시에는 스킬을 즉시 발동 if battler.current_action.kind == 1 and (not battler.current_action.forcing or @force != 2) if battler.rtp == 0 # 스킬 영창중이라면 , 해제 skill_reset(battler) # 스킬 영창 시간 설정 recite_time(battler) # 제휴기술 설정 synthe_spell(battler) # 스킬을 영창 하는 경우 if battler.rtp > 0 # 강제 액션 한편 @force 이 1 시에는 제휴 스킬만 즉시 발동 speller = synthe?(battler) if battler.current_action.forcing and @force > 0 and speller != nil for spell in speller spell.rt = spell.rtp end else battler.blink = true if battler.current_action.forcing $game_temp.forcing_battler = nil battler.current_action.forcing = false end @action_battlers.delete(battler) return end end end end # 엑터의 명 멸망 효과 OFF if battler != nil battler.blink = false end speller = synthe?(battler) if speller == nil @spell_p.delete(battler) @spell_e.delete(battler) else for spell in speller spell.blink = false @spell_p.delete(spell) @spell_e.delete(spell) end end # 스텝 2 에 이행 battler.phase = 2 end #-------------------------------------------------------------------------- # ● 프레임 갱신 (메인 국면 스텝 2 : 액션 개시) #-------------------------------------------------------------------------- def update_phase4_step2(battler) # 강제 액션이 아니면 unless battler.current_action.forcing # 제약이 [적을 통상 공격하는] 인가 [아군을 통상 공격하는] 의 경우 if battler.restriction == 2 or battler.restriction == 3 # 액션에 공격을 설정 battler.current_action.kind = 0 battler.current_action.basic = 0 end end # 액션의 종별로 분기 case battler.current_action.kind when 0 # 기본 if fin? battler.phase = 6 return end make_basic_action_result(battler) when 1 # 스킬 if fin? and $data_skills[battler.current_action.skill_id].scope == 1..2 battler.phase = 6 return end make_skill_action_result(battler) when 2 # 아이템 if fin? and $data_items[battler.current_action.item_id].scope == 1..2 battler.phase = 6 return end make_item_action_result(battler) end if battler.phase == 2 # 스텝 3 에 이행 battler.phase = 3 end end #-------------------------------------------------------------------------- # ● 기본 액션 결과 작성 #-------------------------------------------------------------------------- def make_basic_action_result(battler) # 공격의 경우 if battler.current_action.basic == 0 # 애니메이션 ID 을 설정 battler.anime1 = battler.animation1_id battler.anime2 = battler.animation2_id # 행동측 버틀러가 에너미의 경우 if battler.is_a?(Game_Enemy) if battler.restriction == 3 target = $game_troop.random_target_enemy elsif battler.restriction == 2 target = $game_party.random_target_actor else index = battler.current_action.target_index target = $game_party.smooth_target_actor(index) end end # 행동측 버틀러가 엑터의 경우 if battler.is_a?(Game_Actor) if battler.restriction == 3 target = $game_party.random_target_actor elsif battler.restriction == 2 target = $game_troop.random_target_enemy else index = battler.current_action.target_index target = $game_troop.smooth_target_enemy(index) end end # 대상측 버틀러의 배열을 설정 battler.target = [target] # 통상 공격의 효과를 적용 for target in battler.target target.attack_effect(battler) end return end # 방어의 경우 if battler.current_action.basic == 1 return end # 도망치는 것 경우 if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2 # 도망치는 battler.escape return end # 굳이 하지 않는 것 경우 if battler.current_action.basic == 3 # 스텝 6 에 이행 battler.phase = 6 return end end #-------------------------------------------------------------------------- # ● 스킬 또는 아이템의 대상측 버틀러 설정 # scope : 스킬 또는 아이템의 효과 범위 #-------------------------------------------------------------------------- def set_target_battlers(scope, battler) # 행동측 버틀러가 에너미의 경우 if battler.is_a?(Game_Enemy) # 효과 범위에서 분기 case scope when 1 # 적 단체 index =battler.current_action.target_index battler.target.push($game_party.smooth_target_actor(index)) when 2 # 적 전체 for actor in $game_party.actors if actor.exist? battler.target.push(actor) end end when 3 # 아군 단체 index = battler.current_action.target_index battler.target.push($game_troop.smooth_target_enemy(index)) when 4 # 아군 전체 for enemy in $game_troop.enemies if enemy.exist? battler.target.push(enemy) end end when 5 # 아군 단체 (HP 0) index = battler.current_action.target_index enemy = $game_troop.enemies[index] if enemy != nil and enemy.hp0? battler.target.push(enemy) end when 6 # 아군 전체 (HP 0) for enemy in $game_troop.enemies if enemy != nil and enemy.hp0? battler.target.push(enemy) end end when 7 # 사용자 battler.target.push(battler) end end # 행동측 버틀러가 엑터의 경우 if battler.is_a?(Game_Actor) # 효과 범위에서 분기 case scope when 1 # 적 단체 index = battler.current_action.target_index battler.target.push($game_troop.smooth_target_enemy(index)) when 2 # 적 전체 for enemy in $game_troop.enemies if enemy.exist? battler.target.push(enemy) end end when 3 # 아군 단체 index = battler.current_action.target_index battler.target.push($game_party.smooth_target_actor(index)) when 4 # 아군 전체 for actor in $game_party.actors if actor.exist? battler.target.push(actor) end end when 5 # 아군 단체 (HP 0) index = battler.current_action.target_index actor = $game_party.actors[index] if actor != nil and actor.hp0? battler.target.push(actor) end when 6 # 아군 전체 (HP 0) for actor in $game_party.actors if actor != nil and actor.hp0? battler.target.push(actor) end end when 7 # 사용자 battler.target.push(battler) end end end #-------------------------------------------------------------------------- # ● 스킬 액션 결과 작성 #-------------------------------------------------------------------------- def make_skill_action_result(battler) # 스킬을 취득 @skill = $data_skills[battler.current_action.skill_id] # 제휴 스킬인지 어떤지 확인 speller = synthe?(battler) # 강제 액션이 아니면 unless battler.current_action.forcing # SP 끊어지고등으로 사용할 수 없게 되었을 경우 if speller == nil unless battler.skill_can_use?(@skill.id) # 스텝 6 에 이행 battler.phase = 6 return end end end # SP 소비 temp = false if speller != nil for spell in speller if spell.current_action.spell_id == 0 spell.sp -= @skill.sp_cost else spell.sp -= $data_skills[spell.current_action.spell_id].sp_cost end # 스테이터스 윈도우를 리프레쉬 status_refresh(spell) end else battler.sp -= @skill.sp_cost # 스테이터스 윈도우를 리프레쉬 status_refresh(battler) end # 애니메이션 ID 을 설정 battler.anime1 = @skill.animation1_id battler.anime2 = @skill.animation2_id # 코먼 이벤트 ID 를 설정 battler.event = @skill.common_event_id # 대상측 버틀러를 설정 set_target_battlers(@skill.scope, battler) # 스킬의 효과를 적용 for target in battler.target if speller != nil damage = 0 effective = false state_p = [] state_m = [] for spell in speller if spell.current_action.spell_id != 0 @skill = $data_skills[spell.current_action.spell_id] end effective |= target.skill_effect(spell, @skill) if target.damage[spell].class != String damage += target.damage[spell] elsif effective == true effect = target.damage[spell] end state_p += target.state_p[spell] state_m += target.state_m[spell] target.damage.delete(spell) target.state_p.delete(spell) target.state_m.delete(spell) end if damage != 0 target.damage[battler] = damage elsif effective = true target.damage[battler] = effect end target.state_p[battler] = state_p target.state_m[battler] = state_m else target.skill_effect(battler, @skill) end end end #-------------------------------------------------------------------------- # ● 아이템 액션 결과 작성 #-------------------------------------------------------------------------- def make_item_action_result(battler) # 아이템을 취득 @item = $data_items[battler.current_action.item_id] # 아이템 끊어지고등으로 사용할 수 없게 되었을 경우 unless $game_party.item_can_use?(@item.id) # 스텝 6 에 이행 battler.phase = 6 return end # 소모품의 경우 if @item.consumable # 사용한 아이템을 1 줄이는 $game_party.lose_item(@item.id, 1) end # 애니메이션 ID 을 설정 battler.anime1 = @item.animation1_id battler.anime2 = @item.animation2_id # 코먼 이벤트 ID 를 설정 battler.event = @item.common_event_id # 대상을 결정 index = battler.current_action.target_index target = $game_party.smooth_target_actor(index) # 대상측 버틀러를 설정 set_target_battlers(@item.scope, battler) # 아이템의 효과를 적용 for target in battler.target target.item_effect(@item, battler) end end #-------------------------------------------------------------------------- # ● 프레임 갱신 (메인 국면 스텝 3 : 행동측 애니메이션) #-------------------------------------------------------------------------- def update_phase4_step3(battler) # 헬프 윈도우의 갱신. 액션의 종별로 분기 case battler.current_action.kind when 0 # 기본 if battler.current_action.basic == 1 @help_window.set_text($data_system.words.guard, 1) @help_wait = @help_time end if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2 @help_window.set_text("도망치는", 1) @help_wait = @help_time end when 1 # 스킬 skill = $data_skills[battler.current_action.skill_id] @help_window.set_text(skill.name, 1) @help_wait = @help_time when 2 # 아이템 item = $data_items[battler.current_action.item_id] @help_window.set_text(item.name, 1) @help_wait = @help_time end # 행동측 애니메이션 (ID 이 0 의 경우는 흰색 플래시) if battler.anime1 == 0 battler.white_flash = true battler.wait = 5 # 카메라 설정 if battler.target[0].is_a?(Game_Enemy) camera_set(battler) end else battler.animation.push([battler.anime1, true]) speller = synthe?(battler) if speller != nil for spell in speller if spell != battler if spell.current_action.spell_id == 0 spell.animation.push([battler.anime1, true]) else skill = spell.current_action.spell_id spell.animation.push([$data_skills[skill].animation1_id, true]) spell.current_action.spell_id = 0 end end end end battler.wait = 2 * $data_animations[battler.anime1].frame_max - 10 end # 스텝 4 에 이행 battler.phase = 4 end #-------------------------------------------------------------------------- # ● 프레임 갱신 (메인 국면 스텝 4 : 대상측 애니메이션) #-------------------------------------------------------------------------- def update_phase4_step4(battler) # 카메라 설정 if battler.target[0].is_a?(Game_Enemy) and battler.anime1 != 0 camera_set(battler) end # 대상측 애니메이션 for target in battler.target target.animation.push([battler.anime2, (target.damage[battler] != "Miss")]) unless battler.anime2 == 0 battler.wait = 2 * $data_animations[battler.anime2].frame_max - 10 end end # 스텝 5 에 이행 battler.phase = 5 end #-------------------------------------------------------------------------- # ● 프레임 갱신 (메인 국면 스텝 5 : 데미지 표시) #-------------------------------------------------------------------------- def update_phase4_step5(battler) # 데미지 표시 for target in battler.target if target.damage[battler] != nil target.damage_pop[battler] = true target.damage_effect(battler, battler.current_action.kind) battler.wait = @damage_wait # 스테이터스 윈도우를 리프레쉬 status_refresh(target) end end # 스텝 6 에 이행 battler.phase = 6 end #-------------------------------------------------------------------------- # ● 프레임 갱신 (메인 국면 스텝 6 : 리프레쉬) #-------------------------------------------------------------------------- def update_phase4_step6(battler) # 카메라를 되돌리는 if battler.target[0].is_a?(Game_Enemy) and @camera == battler @spriteset.screen_target(0, 0, 1) end # 스킬 러닝 if battler.target[0].is_a?(Game_Actor) and battler.current_action.kind == 1 for target in battler.target skill_learning(target, target.class_id, battler.current_action.skill_id) end end # 액션 강제 대상의 버틀러를 클리어 if battler.current_action.forcing == true and battler.current_action.force_kind == 0 and battler.current_action.force_basic == 0 and battler.current_action.force_skill_id == 0 $game_temp.forcing_battler = nil battler.current_action.forcing = false end refresh_phase(battler) speller = synthe?(battler) if speller != nil for spell in speller if spell != battler refresh_phase(spell) end end synthe_delete(speller) end # 코먼 이벤트 ID 가 유효의 경우 if battler.event > 0 # 이벤트를 셋업 common_event = $data_common_events[battler.event] $game_system.battle_interpreter.setup(common_event.list, 0) end act = 0 for actor in $game_party.actors + $game_troop.enemies if actor.movable? act += 1 end end if @turn_cnt >= act and act > 0 @turn_cnt %= act $game_temp.battle_turn += 1 # 배틀 이벤트의 전 페이지를 검색 for index in 0...$data_troops[@troop_id].pages.size # 이벤트 페이지를 취득 page = $data_troops[@troop_id].pages[index] # 이 페이지의 스팬이 [턴] 의 경우 if page.span == 1 # 실행이 끝난 플래그를 클리어 $game_temp.battle_event_flags[index] = false end end end battler.phase = 1 @action_battlers.delete(battler) end #-------------------------------------------------------------------------- # ● 리프레쉬 #-------------------------------------------------------------------------- def refresh_phase(battler) battler.at %= @max if battler.movable? battler.atp = 100 * battler.at / @max end spell_reset(battler) # 슬립 데미지 if battler.hp > 0 and battler.slip_damage? battler.slip_damage_effect battler.damage_pop["slip"] = true end # 스테이트 자연 해제 battler.remove_states_auto # 스테이터스 윈도우를 리프레쉬 status_refresh(battler, true) unless battler.movable? return end # 턴수 카운트 @turn_cnt += 1 end #-------------------------------------------------------------------------- # ● 버틀러 액션 스타트 #-------------------------------------------------------------------------- def action_start(battler) battler.phase = 1 battler.anime1 = 0 battler.anime2 = 0 battler.target = [] battler.event = 0 @action_battlers.unshift(battler) end #-------------------------------------------------------------------------- # ● 스테이터스 윈도우를 리프레쉬 #-------------------------------------------------------------------------- def status_refresh(battler, at = false) if battler.is_a?(Game_Actor) for i in 0...$game_party.actors.size if battler == $game_party.actors[i] number = i + 1 end end @status_window.refresh(number) if at == true @status_window.at_refresh(number) end end end #-------------------------------------------------------------------------- # ● 애니메이션 웨이트 판단 처리 #-------------------------------------------------------------------------- def anime_wait_return if (@action_battlers.empty? or @anime_wait == false) and not $game_system.battle_interpreter.running? and not fin? # 에네미아로가 유효의 경우 if @enemy_arrow != nil return [@active - 2, 0].min == 0 # 아크타아로가 유효의 경우 elsif @actor_arrow != nil return [@active - 2, 0].min == 0 # 스킬 윈도우가 유효의 경우 elsif @skill_window != nil return [@active - 3, 0].min == 0 # 아이템 윈도우가 유효의 경우 elsif @item_window != nil return [@active - 3, 0].min == 0 # 엑터 커멘드 윈도우가 유효의 경우 elsif @actor_command_window.active return [@active - 1, 0].min == 0 else return true end else return false end end #-------------------------------------------------------------------------- # ● 엑터 커멘드 소거 판단 #-------------------------------------------------------------------------- def command_delete # 에네미아로가 유효의 경우 if @enemy_arrow != nil end_enemy_select # 아크타아로가 유효의 경우 elsif @actor_arrow != nil end_actor_select end # 스킬 윈도우가 유효의 경우 if @skill_window != nil end_skill_select # 아이템 윈도우가 유효의 경우 elsif @item_window != nil end_item_select end # 엑터 커멘드 윈도우가 유효의 경우 if @actor_command_window.active @command.shift @command_a = false # 메인 국면 플래그를 세트 $game_temp.battle_main_phase = true # 엑터 커멘드 윈도우를 무효화 @actor_command_window.active = false @actor_command_window.visible = false # 엑터의 명 멸망 효과 OFF if @active_actor != nil @active_actor.blink = false end end end #-------------------------------------------------------------------------- # ● 강제 액션 설정 #-------------------------------------------------------------------------- def force_action(battler) battler.current_action.kind = battler.current_action.force_kind battler.current_action.basic = battler.current_action.force_basic battler.current_action.skill_id = battler.current_action.force_skill_id battler.current_action.force_kind = 0 battler.current_action.force_basic = 0 battler.current_action.force_skill_id = 0 end #-------------------------------------------------------------------------- # ● 카메라 세트 #-------------------------------------------------------------------------- def camera_set(battler) @camera = battler if battler.target.size == 1 if battler.current_action.kind == 0 zoom = 1.2 / battler.target[0].zoom elsif synthe?(battler) == nil zoom = 1.5 / battler.target[0].zoom else zoom = 2.0 / battler.target[0].zoom end @spriteset.screen_target(battler.target[0].attack_x(zoom), battler.target[0].attack_y(zoom), zoom) else @spriteset.screen_target(0, 0, 0.75) end end #-------------------------------------------------------------------------- # ● 스킬 영창 타임 작성 #-------------------------------------------------------------------------- def recite_time(battler) end #-------------------------------------------------------------------------- # ● 제휴 스킬 판별 #-------------------------------------------------------------------------- def synthe_spell(battler) end #-------------------------------------------------------------------------- # ● 스킬 러닝 시스템 #-------------------------------------------------------------------------- def skill_learning(actor, class_id, skill_id) end #-------------------------------------------------------------------------- # ● 행동 가능 판정 #-------------------------------------------------------------------------- def active?(battler) speller = synthe?(battler) if speller != nil if synthe_delete?(speller) return false end else unless battler.inputable? spell_reset(battler) unless battler.movable? battler.atp = 0 return false end end if battler.current_action.forcing spell_reset(battler) end end return true end #-------------------------------------------------------------------------- # ● 합성 스킬 영창중인가? #-------------------------------------------------------------------------- def synthe?(battler) for speller in @synthe if speller.include?(battler) return speller end end return nil end #-------------------------------------------------------------------------- # ● 합성 스킬 소거 판단 #-------------------------------------------------------------------------- def synthe_delete?(speller) for battler in speller if not battler.inputable? and dead_ok?(battler) synthe_delete(speller) return true end end return false end #-------------------------------------------------------------------------- # ● 합성 스킬 소거 #-------------------------------------------------------------------------- def synthe_delete(speller) for battler in speller spell_reset(battler) if dead_ok?(battler) @action_battlers.delete(battler) end end @synthe.delete(speller) end #-------------------------------------------------------------------------- # ● 제휴 포함한 스킬 영창 해제 #-------------------------------------------------------------------------- def skill_reset(battler) speller = synthe?(battler) if speller != nil synthe_delete(speller) else spell_reset(battler) end end #-------------------------------------------------------------------------- # ● 스킬 영창 해제 #-------------------------------------------------------------------------- def spell_reset(battler) battler.rt = 0 battler.rtp = 0 battler.blink = false battler.spell = false battler.current_action.spell_id = 0 @spell_p.delete(battler) @spell_e.delete(battler) end #-------------------------------------------------------------------------- # ● 전투 종료 판정 #-------------------------------------------------------------------------- def fin? return (victory? or $game_party.all_dead? or $game_party.actors.size == 0) end #-------------------------------------------------------------------------- # ● 적 전멸 판정 #-------------------------------------------------------------------------- def victory? for battler in $game_troop.enemies if battler.exist? return false end end return true end #-------------------------------------------------------------------------- # ● 사망 허가 판정 #-------------------------------------------------------------------------- def dead_ok?(battler) speller = synthe?(battler) if speller == nil if @action_battlers.include?(battler) if battler.phase > 2 return false end end else for battler in speller if @action_battlers.include?(battler) if battler.phase > 2 return false end end end end return true end end #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ #  엑터를 취급하는 클래스입니다. 이 클래스는 Game_Actors 클래스 ($game_actors) # 의 내부에서 사용되어Game_Party 클래스 ($game_party) 로부터도 참조됩니다. #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● 배틀 화면 X 좌표의 취득 #-------------------------------------------------------------------------- def screen_x # 파티내의 줄순서로부터 X 좌표를 계산해 돌려준다 if self.index != nil return self.index * 160 + (4 - $game_party.actors.size) * 80 + 80 else return 0 end end end #============================================================================== # ■ Spriteset_Battle #------------------------------------------------------------------------------ #  배틀 화면의 스프라이트를 정리한 클래스입니다. 이 클래스는 Scene_Battle 곳간 # 스의 내부에서 사용됩니다. #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # ● 공개 인스턴스 변수 #-------------------------------------------------------------------------- attr_reader :real_x # x좌표 보정(현재가) attr_reader :real_y # y좌표 보정(현재가) attr_reader :real_zoom # 확대율(현재가) #-------------------------------------------------------------------------- # ● 오브젝트 초기화 #-------------------------------------------------------------------------- def initialize # 뷰포트를 작성 @viewport1 = Viewport.new(0, 0, 640, 480) @viewport2 = Viewport.new(0, 0, 640, 480) @viewport3 = Viewport.new(0, 0, 640, 480) @viewport4 = Viewport.new(0, 0, 640, 480) @viewport2.z = 101 @viewport3.z = 200 @viewport4.z = 5000 @wait = 0 @real_x = 0 @real_y = 0 @real_zoom = 1.0 @target_x = 0 @target_y = 0 @target_zoom = 1.0 @gap_x = 0 @gap_y = 0 @gap_zoom = 0.0 # 배틀 백 스프라이트를 작성 @battleback_sprite = Sprite.new(@viewport1) # 에너미 스프라이트를 작성 @enemy_sprites = [] for enemy in $game_troop.enemies.reverse @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy)) end # 엑터 스프라이트를 작성 @actor_sprites = [] @actor_sprites.push(Sprite_Battler.new(@viewport2)) @actor_sprites.push(Sprite_Battler.new(@viewport2)) @actor_sprites.push(Sprite_Battler.new(@viewport2)) @actor_sprites.push(Sprite_Battler.new(@viewport2)) # 기후를 작성 @weather = RPG::Weather.new(@viewport1) # 픽쳐 스프라이트를 작성 @picture_sprites = [] for i in 51..100 @picture_sprites.push(Sprite_Picture.new(@viewport3, $game_screen.pictures[i])) end # 타이머 스프라이트를 작성 @timer_sprite = Sprite_Timer.new # 프레임 갱신 update end #-------------------------------------------------------------------------- # ● 프레임 갱신 #-------------------------------------------------------------------------- def update # 엑터 스프라이트의 내용을 갱신 (엑터의 교체에 대응) @actor_sprites[0].battler = $game_party.actors[0] @actor_sprites[1].battler = $game_party.actors[1] @actor_sprites[2].battler = $game_party.actors[2] @actor_sprites[3].battler = $game_party.actors[3] # 배틀 백의 파일명이 현재의 것과 다른 경우 if @battleback_name != $game_temp.battleback_name make_battleback end # 화면의 스크롤 screen_scroll # 몬스터의 위치 보정 for enemy in $game_troop.enemies enemy.real_x = @real_x enemy.real_y = @real_y enemy.real_zoom = @real_zoom end # 버틀러 스프라이트를 갱신 for sprite in @enemy_sprites + @actor_sprites sprite.update end # 기후 그래픽을 갱신 @weather.type = $game_screen.weather_type @weather.max = $game_screen.weather_max @weather.update # 픽쳐 스프라이트를 갱신 for sprite in @picture_sprites sprite.update end # 타이머 스프라이트를 갱신 @timer_sprite.update # 화면의 색조와 시이크 위치를 설정 @viewport1.tone = $game_screen.tone @viewport1.ox = $game_screen.shake # 화면의 플래시색을 설정 @viewport4.color = $game_screen.flash_color # 뷰포트를 갱신 @viewport1.update @viewport2.update @viewport4.update end #-------------------------------------------------------------------------- # ● 배틀 배경의 설정 #-------------------------------------------------------------------------- def make_battleback @battleback_name = $game_temp.battleback_name if @battleback_sprite.bitmap != nil @battleback_sprite.bitmap.dispose end @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name) if @battleback_sprite.bitmap.width == 640 and @battleback_sprite.bitmap.height == 320 @battleback_sprite.src_rect.set(0, 0, 1280, 640) @base_zoom = 2.0 @battleback_sprite.zoom_x = @base_zoom @battleback_sprite.zoom_y = @base_zoom @real_y = 4 @battleback_sprite.x = 320 @battleback_sprite.y = @real_y @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2 @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4 elsif @battleback_sprite.bitmap.width == 640 and @battleback_sprite.bitmap.height == 480 @battleback_sprite.src_rect.set(0, 0, 960, 720) @base_zoom = 1.5 @battleback_sprite.zoom_x = @base_zoom @battleback_sprite.zoom
?

List of Articles
번호 제목 글쓴이 날짜 조회 수
5387 제발좀 알려주세요!!!ㅜ.ㅜ 살앙 2007.07.17 423
5386 도트로 인물을 찍을때 부분부분을 따로 작업한후 합치는지 아니면 통째로 하는지 나유타 2007.07.13 1855
5385 패치를하면 오류. 피겔 2007.07.13 231
5384 패치를하면 오류. file 카르고의날개 2007.07.13 421
5383 비스타에서 rpgxp 돌아 가는 방법 ★샤일☆ 2007.07.11 832
5382 비스타에서 rpgxp 돌아 가는 방법 없을까요? Archer 2007.07.11 640
5381 스크립트에 관한 질문...(2000크링 검) 한글화마스터 2007.07.08 736
5380 색조변경을통해 화면을 어둡게했을때 성관계 2007.07.08 540
5379 투명 이벤트에 대하여 질문 땅콩아줌마 2007.07.08 265
5378 투명 이벤트에 대하여 질문 살앙 2007.07.08 514
5377 제발좀 알려주세요!!!ㅜ.ㅜ 『덩키동크』 2007.07.08 199
» 스크립트 人生은 鸞誌라 2007.07.06 789
5375 뭔가 요녀석이 절 무시하네요? 【chaos】 2007.06.26 485
5374 키입력과 좌표에 관해서 아싸사랑 2007.06.26 274
5373 키입력과 좌표에 관해서 하얀마음 2007.06.26 539
5372 스트립트 오류인거 같은데...(스샷포함) file 2007.06.26 446
5371 스크립트에 관한 질문...(2000크링 검) 반데드 2007.06.26 430
5370 님들아 땡규 2007.06.22 1352
5369 맵을 좀 고치고 싶어요..ㅠ 『덩키동크』 2007.06.22 327
5368 맵을 좀 고치고 싶어요..ㅠ 로드 2007.06.22 538
Board Pagination Prev 1 ... 168 169 170 171 172 173 174 175 176 177 ... 442 Next
/ 442


[개인정보취급방침] | [이용약관] | [제휴문의] | [후원창구] | [인디사이드연혁]

Copyright © 1999 - 2016 INdiSide.com/(주)씨엘쓰리디 All Rights Reserved.
인디사이드 운영자 : 천무(이지선) | kernys(김원배) | 사신지(김병국)