#==============================================================================
# ■ Scene_Battle for ATB Ver1.1
#------------------------------------------------------------------------------
# 배틀 화면의 처리를 실시하는 클래스입니다.
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 개시 처리
#--------------------------------------------------------------------------
alias start_n02 start
def start
$gauge_stop = true
$game_party.atb_customize
start_n02
end
#--------------------------------------------------------------------------
# ● 전투 개시의 처리
#--------------------------------------------------------------------------
alias process_battle_start_n02 process_battle_start
def process_battle_start
@end_member = 0
preemptive if $game_troop.preemptive
surprise if $game_troop.surprise
@status_window.visible = true
process_battle_start_n02
@status_window.refresh
$gauge_stop = false
end
#--------------------------------------------------------------------------
# ● 선제 처리
#--------------------------------------------------------------------------
def preemptive
$game_troop.preemptive = false
for member in $game_party.members + $game_troop.members
member.at_count = 1000 if member.actor?
member.at_count = N02::ATB_BACKATTACK * -10 if !member.actor?
end
end
#--------------------------------------------------------------------------
# ● 기습 처리
#--------------------------------------------------------------------------
def surprise
$game_troop.surprise = false
for member in $game_party.members + $game_troop.members
member.at_count = N02::ATB_BACKATTACK * -10 if member.actor?
member.at_count = 1000 if !member.actor?
end
end
#--------------------------------------------------------------------------
# ● 정보 표시 뷰포트의 해방
#--------------------------------------------------------------------------
alias dispose_info_viewport_n02 dispose_info_viewport
def dispose_info_viewport
dispose_info_viewport_n02
@cursor.dispose if @cursor != nil && !@cursor.disposed?
@help_window.dispose if @help_window != nil && !@help_window.disposed?
@help_window = nil
@help_window2.dispose if @help_window2 != nil && !@help_window2.disposed?
@help_window2 = nil
@skill_window.dispose if @skill_window != nil && !@skill_window.disposed?
@skill_window = nil
@item_window.dispose if @item_window != nil && !@item_window.disposed?
@skill_window = nil
end
#--------------------------------------------------------------------------
# ● 프레임 갱신 ※재정의
#--------------------------------------------------------------------------
def update
super
update_basic(true)
unless $game_message.visible # 메세지 표시중 이외
return if judge_win_loss if @judge == nil # 승패 판정
update_scene_change
process_battle_event # 배틀 이벤트의 처리
end
end
#--------------------------------------------------------------------------
# ● 기본 갱신 처리 ※재정의
#--------------------------------------------------------------------------
def update_basic(main = false)
Graphics.update unless main # 게임 화면을 갱신
Input.update unless main # 입력 정보를 갱신
$game_system.update # 타이머를 갱신
$game_troop.update # 적그룹을 갱신
@spriteset.update # 스프라이트 세트를 갱신
@message_window.update # 메세지 윈도우를 갱신
update_info_viewport if !$gauge_stop # 정보 표시 뷰포트를 갱신
# 커서 갱신
@cursor.update if @cursor != nil && @cursor.visible
# 메세지 표시중은 이 이후 처리시키지 않는다
if $game_message.visible
@spriteset.gauge_off
@info_viewport.visible = false
return @message_window.visible = true
end
return if $gauge_stop
# 전투 중단, 씬 변환때 이 이후는 처리시키지 않는다
return if @judge
return if $game_temp.next_scene != nil
# ATB를 갱신
update_atb
# 타겟 갱신
update_target if @target_members != nil
# 커멘드 입력 페이즈
start_actor_command_selection if @command_members.size != 0 && !@command_phase
if @skill_window != nil
update_skill_selection # 스킬 선택
elsif @item_window != nil
update_item_selection # 아이템 선택
elsif @party_command_window.visible && @party_command_window.active
update_party_command_selection # 파티 커멘드 선택
elsif @actor_command_window.active
update_actor_command_selection # 액터 커멘드 선택
end
end
#--------------------------------------------------------------------------
# ● ATB 갱신
#--------------------------------------------------------------------------
def update_atb
for member in $game_party.members + $game_troop.members
# ACT 갱신
return start_main(member) if member.act_active && !@action_battlers.include?(member) && !member.union_battler
# ATB 액터 갱신
if member.actor? && member.at_active && !@command_members.include?(member) && member.movable?
return start_auto_action(member) if member.auto_action?
return @command_members.push(member)
# ATB 에너미 갱신
elsif !member.actor? && member.at_active && !@command_members.include?(member) && member.movable?
return start_auto_action(member)
end
end
end
#--------------------------------------------------------------------------
# ● 자동 행동 개시
#--------------------------------------------------------------------------
def start_auto_action(member)
return if @judge
# 전투 행동의 작성
member.make_action if member.union_skill_id == 0
# 요금 설정
act_type = charge_set(member)
# 여러 차례 행동의 작성
member.act_time = member.action_time[0] if !member.actor?
# 행동 게이지로 전환해
@spriteset.change_act(act_type, member.actor?, member.index)
# 요금 액션
make_charge_action(member)
end
#--------------------------------------------------------------------------
# ● 요금 설정
#--------------------------------------------------------------------------
def charge_set(member)
act_type = member.charge
# 통상 공격(2 칼의 요금 시간은 쌍방 무기의 평균)
if member.actor? && member.action.attack? && member.weapon_id != 0
act_type = member.weapons[0].charge if member.weapons[0] != nil
act_type2 = member.weapons[1].charge if member.weapons[1] != nil
act_type[1] = (act_type[1] + act_type2[1]) / 2 if act_type2 != nil
elsif member.action.attack?
act_type = $data_weapons[member.weapon_id].charge if member.actor? && member.weapon_id != 0
act_type = $data_weapons[member.weapon].charge if !member.actor? && member.weapon != 0
end
act_type = $data_skills[member.action.skill_id].charge if member.action.skill?
act_type = $data_items[member.action.item_id].charge if member.action.item?
# 요금 보너스 가산
if member.actor?
act_type[1] += $data_weapons[member.weapon_id].charge_bonus if member.weapon_id != 0
for i in 0...member.armors.size
# 2 칼은 캔슬
next if member.two_swords_style && member.armors[0] != nil && member.armors[0]
act_type[1] += member.armors[i].charge_bonus if member.armors[i] != nil
end
end
return act_type
end
#--------------------------------------------------------------------------
# ● 전투 행동자의 준비 ※재정의
#--------------------------------------------------------------------------
def start_main(member)
return if @judge
@message_window.clear
@action_battlers.push(member)
process_battle_event
@status_window.refresh
member.charge_start = false
# 액티브 버틀러가 없으면 다음의 행동자를 세트
set_next_active_battler if @active_battler == nil
end
#--------------------------------------------------------------------------
# ● 헬프 윈도우의 표시 ※재정의
#--------------------------------------------------------------------------
def pop_help(obj)
return if @help_window == nil && obj.extension.include?("HELPHIDE")
return @help_window.visible = false if obj.extension.include?("HELPHIDE")
return if @skill_window != nil && @skill_window.visible
return if @item_window != nil && @item_window.visible
@help_window = Window_Help.new if @help_window == nil
@help_window.set_text(obj.name, 1)
@help_window.visible = true
end
#--------------------------------------------------------------------------
# ● 요금 액션 작성
#--------------------------------------------------------------------------
def make_charge_action(member)
action = ""
case member.action.kind
when 0
if member.actor?
action = member.charge[3] if member.weapon_id == 0
action = $data_weapons[member.weapon_id].charge[3] if member.weapon_id != 0
else
action = member.charge[3] if member.weapon == 0
action = $data_weapons[member.weapon].charge[3] if member.weapon != 0
end
when 1;action = member.action.skill.charge[3]
when 2;action = member.action.item.charge[3]
end
member.charge_action = action
return if action == ""
member.charge_start = true
@spriteset.set_action(member.actor?, member.index, member.charge_action)
end
#--------------------------------------------------------------------------
# ● 액션 실행중 ※재정의
#--------------------------------------------------------------------------
def playing_action
loop do
break if @judge
update_basic
# 액티브 버틀러에 격납되고 있는 액션 정보를 본다
action = @active_battler.play
next if action == 0
@active_battler.play = 0
if action[0] == "개별 처리"
individual
elsif action == "Can Collapse"
unimmortaling
elsif action == "Cancel Action"
break action_end
elsif action == "End"
break action_end
elsif action[0] == "OBJ_ANIM"
damage_action(action[1])
end
end
end
#--------------------------------------------------------------------------
# ● 전투 액션 실행
#--------------------------------------------------------------------------
def process_action
# 슬립 데미지
hp_slip_damage(@active_battler) if N02::ATB_SLIP_DAMAGE == 0
# 합체 공격 처리
union_possibility?
process_union_skill if @active_battler.union_skill_id != 0
return set_next_active_battler if @active_battler.union_battler
# 폭주 혼란 처리
@active_battler.action.prepare unless @active_battler.action.forcing
# 전투 행동 개시
$in_action = true
@message_window.clear
@active_battler.white_flash = true
# 헬프 윈도우 표시
help_on
# 전투 액션 실행
execute_action if @active_battler.action.valid?
# 헬프 윈도우 은폐
help_off
# 강제 행동등에서 버틀러가 비우면 다음의 행동자에게
return set_next_active_battler if @active_battler == nil
# 슬립 데미지
mp_slip_damage(@active_battler) if N02::ATB_SLIP_DAMAGE == 0
# 전투 액션 종료
@message_window.clear
@active_battler.white_flash = false
$in_action = false
@spriteset.gauge_update
# 합체 공격 종료 처리
end_union_skill if @active_battler.union_skill_id != 0
# 스킬 파생이 있는 경우, 행동 속행
return set_next_active_battler if @active_battler.derivation != 0 && !@forcing_battler
# 에너미의 여러 차례 행동
return set_next_active_battler if enemy_order
# 전투 행동 종료
turn_end(@active_battler)
# 다음의 행동자에게
@action_battlers.delete(@active_battler)
set_next_active_battler
end
#--------------------------------------------------------------------------
# ● 헬프 윈도우 표시
#--------------------------------------------------------------------------
def help_on
@help_window = Window_Help.new if @help_window == nil
@help_window.visible = false
return @help_window.visible = true if @skill_window != nil && @skill_window.visible
return @help_window.visible = true if @item_window != nil && @item_window.visible
return @help_window.visible = true if @active_battler.action.guard?
return @help_window.visible = true if @active_battler.action.kind == 0 && @active_battler.action.basic == 2
end
#--------------------------------------------------------------------------
# ● 헬프 윈도우 은폐
#--------------------------------------------------------------------------
def help_off
return if @help_window == nil
return @help_window.visible = true if @skill_window != nil && @skill_window.visible
return @help_window.visible = true if @item_window != nil && @item_window.visible
@help_window.visible = false
end
#--------------------------------------------------------------------------
# ● 액션 종료 ※재정의
#--------------------------------------------------------------------------
def action_end
# 초기화
@individual_target = nil
@active_battler.active = false
@active_battler.clear_action_results
# 만약을 위해 불사신화 해제
unimmortaling
# 반사되고 있었을 경우
if @active_battler.reflex != nil
if @active_battler.action.skill?
obj = @active_battler.action.skill
@active_battler.perfect_skill_effect(@active_battler, obj)
elsif @active_battler.action.item?
obj = @active_battler.action.item
@active_battler.item_effect(@active_battler, obj)
else
@active_battler.perfect_attack_effect(@active_battler)
end
pop_damage(@active_battler, obj, @active_battler.reflex)
@active_battler.perform_collapse
@active_battler.reflex = nil
wait(N01::COLLAPSE_WAIT)
end
# 역흡수로 전투 불능이 되었을 경우
if @absorb_dead
@active_battler.perform_collapse
@absorb_dead = false
wait(N01::COLLAPSE_WAIT)
end
# 다음의 행동까지 웨이트를 사이에 둔다
wait(N01::ACTION_WAIT)
end
#--------------------------------------------------------------------------
# ● 합체 공격 판정
#--------------------------------------------------------------------------
def union_skill?(member)
# 스킬에 합체 공격 설정이 있을까 체크
for union_action in member.action.skill.union_action
union_skills = union_action if union_action.size != 0 && union_action.include?(member.action.skill_id)
end
return if union_skills == nil
@partners = []
@union_targets = union_target_decision(member, member.action.skill)
@union_target_index = member.action.target_index
# 합체 공격 멤버가 사용 가능한가 체크
for skill_id in union_skills
for actor in $game_party.members
if actor.skill_can_use?($data_skills[skill_id]) && actor.skill_id_learn?(skill_id)
@partners.push(actor)
actor.union_skill_id = skill_id
end
end
end
# 합체 공격 사용 불가
if @partners.size != union_skills.size
for actor in @partners do actor.union_skill_id = 0 end
@partners = nil
member.action.clear if !member.action.guard?
return
end
# 합체 공격 사용가능
for actor in @partners
# 파트너 액션 결정
actor.action.kind = 1
actor.action.skill_id = actor.union_skill_id
actor.action.target_index = member.action.target_index
# 커멘드 강제 캔슬
if @command_members.include?(actor)
force_action_command_cansel(actor)
start_auto_action(member)
end
end
$in_union_action = true
@union_size = 0
end
#--------------------------------------------------------------------------
# ● 합체 공격 가능한가
#--------------------------------------------------------------------------
def union_possibility?
return if @partners == nil
for member in @partners
union_cansel = true unless member.inputable?
end
return if !union_cansel
end_union_skill
@active_battler.action.clear if !@active_battler.action.guard?
end
#--------------------------------------------------------------------------
# ● 합체 공격 타겟 결정
#--------------------------------------------------------------------------
def union_target_decision(member, obj)
targets = member.action.make_targets
# 디폴트의 여러 차례 공격이 설정되어 있으면 단체 타겟으로 변환
targets = [targets[0]] if obj.for_two? or obj.for_three? or obj.dual?
# 랜덤 타겟의 경우, 도대체를 선택해 랜덤 범위를 보관 유지
if obj.extension.include?("RANDOMTARGET")
randum_targets = targets.dup
targets = [randum_targets[rand(randum_targets.size)]]
end
# 타겟 정보를 버틀러 스프라이트에 보낸다
@spriteset.set_target(member.actor?, member.index, targets)
return targets
end
#--------------------------------------------------------------------------
# ● 합체 공격 처리
#--------------------------------------------------------------------------
def process_union_skill
@union_size += 1
if @union_size != @partners.size
return @active_battler.union_battler = true
end
# 합체 공격 스타트
@action_battlers.delete(@active_battler)
@active_battler.active = false
@active_battler = @partners.shift
@active_battler.act_active = true
@active_battler.active = true
@active_battler.union_battler = false
@active_battler.action.kind = 1
@active_battler.action.skill_id = @active_battler.union_skill_id
@active_battler.action.target_index = @union_target_index
for member in @partners
member.action.kind = 1
member.action.skill_id = member.union_skill_id
member.action.target_index = @union_target_index
member.force_target = ["N01target_change", @union_targets]
@spriteset.update_target(true, member.index)
# 액션 실행
@spriteset.set_action(true, member.index, member.action.skill.base_action)
end
end
#--------------------------------------------------------------------------
# ● 합체 공격 종료 처리
#--------------------------------------------------------------------------
def end_union_skill
@active_battler.union_skill_id = 0
@active_battler.union_battler = false
for member in @partners
member.union_skill_id = 0
member.union_battler = false
member.action.clear
@action_battlers.delete(member)
turn_end(member)
end
@union_size = 0
@partners = nil
$in_union_action = false
end
#--------------------------------------------------------------------------
# ● 에너미의 행동 회수 작성
#--------------------------------------------------------------------------
def enemy_order
return false if @active_battler.actor?
return false if @active_battler.act_time == 0 or !@active_battler.action.valid?
return true if rand(100) < @active_battler.action_time[1]
end
#--------------------------------------------------------------------------
# ● 턴 종료(경과) ※재정의
#--------------------------------------------------------------------------
def turn_end(member)
$in_action = false
# 액션 종료시의 ATB 게이지 설정
recharge_action(member)
member.action.clear if !member.action.guard?
# 턴 경과 카운트
@end_member += 1
passage = true if N02::ATB_TURN_COUNT == 2
if @end_member >= $game_party.members.size + $game_troop.members.size
passage = true if N02::ATB_TURN_COUNT == 0
passage = true if N02::ATB_TURN_COUNT == 1 && @end_member == 2
elsif @end_member == ($game_party.members.size + $game_troop.members.size) / 2
passage = true if N02::ATB_TURN_COUNT == 1
end
# 슬립 데미지
if @slip_all_damage
for battlers in $game_party.members + $game_troop.members do mp_slip_damage(battlers) end
@slip_all_damage = false
@slip_all_damaged = true
end
return if !passage
# 슬립 데미지
if N02::ATB_SLIP_DAMAGE == 1 && !@slip_all_damaged
for battlers in $game_party.members + $game_troop.members do hp_slip_damage(battlers) end
@slip_all_damage = true
end
@slip_all_damaged = false
@end_member = 0
$game_troop.increase_turn
$game_troop.turn_ending = true
process_battle_event
$game_troop.turn_ending = false
@status_window.refresh
end
#--------------------------------------------------------------------------
# ● 액션 종료시의 ATB 게이지 설정
#--------------------------------------------------------------------------
def recharge_action(member)
member.act_count = 0
recharge = member.recharge
# 통상 공격(2 칼의 요금 시간은 쌍방 무기의 평균)
if member.actor? && member.action.attack?
recharge = member.weapons[0].recharge if member.weapons[0] != nil
recharge2 = member.weapons[1].recharge if member.weapons[1] != nil
recharge = (recharge + recharge2) / 2 if recharge2 != nil
elsif member.action.attack?
act_type = $data_weapons[member.weapon].charge if member.weapon != 0
end
recharge = $data_skills[member.action.skill_id].recharge if member.action.skill?
recharge = $data_items[member.action.item_id].recharge if member.action.item?
recharge = N02::ATB_GUARD_RESET if member.action.guard?
# ATB 게이지로 전환해
@spriteset.change_atb(10 * recharge, member.actor?, member.index)
@spriteset.gauge_refresh(member.actor?, member.index)
end
#--------------------------------------------------------------------------
# ● 다음의 행동자에게
#--------------------------------------------------------------------------
def set_next_active_battler
return if $game_party.all_dead? or $game_troop.all_dead?
# 에너미 여러 차례 행동시
@action_battlers.shift if @active_battler != nil && !@active_battler.actor? && @active_battler.act_time != 0
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
@active_battler = @action_battlers.shift
end
@active_battler.action.clear if @active_battler != nil && @active_battler.dead?
return if @active_battler == nil
# 전투 행동 개시
return process_action if @active_battler.index != nil
end
end
#--------------------------------------------------------------------------
# ● 배틀 이벤트의 처리 ※재정의
#--------------------------------------------------------------------------
def process_battle_event
members_size = $game_party.members.size
loop do
return if judge_win_loss
return if $game_temp.next_scene != nil
$game_troop.interpreter.update
$game_troop.setup_battle_event
@message_window.update
if $game_message.visible
@message_window.visible = true
@status_window.visible = false
end
wait_for_message
@message_window.visible = false
@status_window.visible = true
reset_atb_actor if members_size != $game_party.members.size
if $game_troop.forcing_battler != nil
set_next_active_battler
end
return unless $game_troop.interpreter.running?
update_basic
end
end
#--------------------------------------------------------------------------
# ● HP슬립 데미지
#--------------------------------------------------------------------------
def hp_slip_damage(member)
member.clear_action_results
return if !member.exist? or member.states.size == 0
member.slip_damage = false
damage = 0
# 0 턴 해제의 스테이트가 있을까 체크
for state in member.states
member.remove_state(state.id) if state.extension.include?("ZEROTURNLIFT")
# 슬립 데미지 실행 state = [ 대상, 정수, 비율, POP, 전투 불능 허가]
next unless state.extension.include?("SLIPDAMAGE")
for ext in state.slip_extension
if ext[0] == "hp"
base_damage = ext[1] + member.maxhp * ext[2] / 100
damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
slip_pop = ext[3]
slip_dead = ext[4]
slip_damage_flug = true
member.slip_damage = true
end
end
end
# 디폴트의 슬립 데미지
if member.slip_damage? && member.exist? && !slip_damage_flug
damage += member.apply_variance(member.maxhp / 10, 10)
slip_dead = false
slip_pop = true
slip_damage_flug = true
member.slip_damage = true
end
# 방어구의 자동 회복이 있을까
damage -= member.maxhp / 20 if member.actor? && member.auto_hp_recover && member.exist?
# 전투 불능 불허가
damage = member.hp - 1 if damage >= member.hp && slip_dead = false
member.hp -= damage
@spriteset.set_damage_pop(member.actor?, member.index, damage) if slip_pop
member.perform_collapse if member.dead? && member.slip_damage
member.clear_action_results
@status_window.refresh
end
#--------------------------------------------------------------------------
# ● MP슬립 데미지
#--------------------------------------------------------------------------
def mp_slip_damage(member)
member.clear_action_results
return if !member.exist? or member.states.size == 0
member.slip_damage = false
mp_damage = 0
for state in member.states
next unless state.extension.include?("SLIPDAMAGE")
for ext in state.slip_extension
if ext[0] == "mp"
base_damage = ext[1] + member.maxmp * ext[2] / 100
mp_damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
slip_pop = ext[2]
slip_damage_flug = true
end
end
end
member.mp_damage = mp_damage
member.mp -= mp_damage
@spriteset.set_damage_pop(member.actor?, member.index, mp_damage) if slip_pop
member.clear_action_results
@status_window.refresh
end
#--------------------------------------------------------------------------
# ● 전투 행동의 실행 : 방어 ※재정의
#--------------------------------------------------------------------------
def execute_action_guard
@help_window.set_text("Guards", 1)
@help_window.visible = true
# 버틀러의 액티브화를 해제
@active_battler.active = false
wait(45)
@help_window.visible = false if @help_window != nil
end
#--------------------------------------------------------------------------
# ● 전투 행동의 실행 : 도주 ※재정의
#--------------------------------------------------------------------------
def execute_action_escape
@spriteset.set_action(false, @active_battler.index, @active_battler.run_success)
@help_window.set_text("Escaped", 1)
@help_window.visible = true
# 버틀러의 액티브화를 해제
@active_battler.active = false
@active_battler.escape
Sound.play_escape
wait(45)
@help_window.visible = false if @help_window != nil
end
#--------------------------------------------------------------------------
# ● 파티 커멘드 선택의 개시 ※재정의
#--------------------------------------------------------------------------
def start_party_command_selection
@info_viewport.visible = true
@status_window.index = @actor_index = -1
end
#--------------------------------------------------------------------------
# ● 다음의 액터의 커멘드 입력에 ※재정의
#--------------------------------------------------------------------------
def next_actor
end
#--------------------------------------------------------------------------
# ● 전의 액터의 커멘드 입력에 ※재정의
#--------------------------------------------------------------------------
def prior_actor
end
#--------------------------------------------------------------------------
# ● 액터 커멘드 선택의 개시 ※재정의
#--------------------------------------------------------------------------
def start_actor_command_selection
$in_command = true
@command_phase = true
@command_member_index = 0
@commander = @command_members[@command_member_index]
@status_window.active = true
@status_window.index = @commander.index
# 커서 세트
@cursor = Sprite_Cursor.new if @cursor == nil
@cursor.set(@commander)
# 움직일 수 있는 캐릭터만 커멘드 액션을
@spriteset.set_action(true, @commander.index,@commander.command_b) if @commander.inputable?
@party_command_window.active = false
@actor_command_window.setup(@commander)
@actor_command_window.active = true
@actor_command_window.index = 0
@actor_command_window_on = true
@status_window.refresh
end
#--------------------------------------------------------------------------
# ● 커멘드 갱신 ※재정의
#--------------------------------------------------------------------------
def update_actor_command_selection
# 커멘드 입력할 수 있는 상태가 아니게 되면 캔슬
return reset_command unless commanding?
if Input.trigger?(Input::B)
Input.update
Sound.play_decision
start_party_command
elsif Input.trigger?(Input::C)
Input.update
case @actor_command_window.index
when 0 # 공격
Sound.play_decision
@commander.action.set_attack
start_target_enemy_selection
when 1 # 스킬
Sound.play_decision
$in_select = true
start_skill_selection
when 2 # 방어
Sound.play_decision
@commander.action.set_guard
end_command
when 3 # 아이템
Sound.play_decision
$in_select = true
start_item_selection
end
# →키로 커멘드 캐릭터 보내
elsif Input.trigger?(Input::RIGHT)
next_commander
# ←키로 커멘드 캐릭터 반환
elsif Input.trigger?(Input::LEFT)
back_commander
end
end
#--------------------------------------------------------------------------
# ● 커멘드 입력할 수 있는 상태인가
#--------------------------------------------------------------------------
def commanding?
return false if @judge or $gauge_stop
return false if @commander != nil && !@commander.inputable?
return false if @commander != nil && @commander.union_skill_id != 0
return false if @commander != nil && @commander.at_count < 1000
return true
end
#--------------------------------------------------------------------------
# ● 커멘드 캐릭터 보내
#--------------------------------------------------------------------------
def next_commander
return if @command_members.size == 1 or @commander == nil
Audio.se_play("Audio/SE/" + N02::NEXT_SOUND01[2], N02::NEXT_SOUND01[1], N02::NEXT_SOUND01[0])
# 움직일 수 있는 캐릭터만 커멘드 귀가 액션을
@spriteset.set_action(true, @commander.index,@commander.command_a) if @commander.inputable?
# 커멘드 대기 멤버의 인덱스가 최후라면
if @command_member_index == @command_members.size - 1
@command_member_index = 0
# 다음의 캐릭터에게 커멘드를 보낸다
else
@command_member_index += 1
end
@commander = @command_members[@command_member_index]
@status_window.index = @commander.index
@actor_command_window.setup(@commander)
# 커서 세트
@cursor.set(@commander)
# 움직일 수 있는 캐릭터만 커멘드 액션을
@spriteset.set_action(true, @commander.index,@commander.command_b) if @commander.inputable?
end
#--------------------------------------------------------------------------
# ● 커멘드 캐릭터 반환
#--------------------------------------------------------------------------
def back_commander
return if @command_members.size == 1 or @commander == nil
Audio.se_play("Audio/SE/" + N02::NEXT_SOUND01[2], N02::NEXT_SOUND01[1], N02::NEXT_SOUND01[0])
# 움직일 수 있는 캐릭터만 커멘드 귀가 액션을
@spriteset.set_action(true, @commander.index,@commander.command_a) if @commander.inputable?
# 커멘드 대기 멤버의 인덱스가 최초라면
if @command_member_index == 0
@command_member_index = @command_members.size - 1
# 전의 캐릭터에게 커멘드를 보낸다
else
@command_member_index -= 1
end
@commander = @command_members[@command_member_index]
@status_window.index = @commander.index
# 커서 세트
@cursor.set(@commander)
# 움직일 수 있는 캐릭터만 커멘드 액션을
@spriteset.set_action(true, @commander.index,@commander.command_b) if @commander.inputable?
end
#--------------------------------------------------------------------------
# ● 파티 커멘드 선택의 개시
#--------------------------------------------------------------------------
def start_party_command
$in_party_command = true
$in_command = false
@status_window.refresh
@status_window.index = @actor_index = -1
@info_viewport.visible = true
@message_window.visible = false
@pre_a_index = @actor_command_window.index
@actor_command_window.active = false
@actor_command_window.index = -1
@party_command_window.active = true
@party_command_window.index = 0
@party_command_window.visible = true
end
#--------------------------------------------------------------------------
# ● 파티 커멘드 선택의 갱신
#--------------------------------------------------------------------------
def update_party_command_selection
# 커멘드 입력할 수 있는 상태가 아니게 되면 캔슬
return reset_command unless commanding?
if Input.trigger?(Input::C)
case @party_command_window.index
when 0 # 싸운다
Sound.play_decision
@status_window.index = @actor_index = -1
end_party_command
when 1 # 도망친다
return Sound.play_buzzer if $game_troop.can_escape == false
Sound.play_decision
end_party_command
process_escape if !@escape
end
elsif Input.trigger?(Input::B)
Sound.play_cancel
end_party_command
end
end
#--------------------------------------------------------------------------
# ● 파티 커멘드 선택의 종료
#--------------------------------------------------------------------------
def end_party_command
$in_party_command = false
$in_command = true
@status_window.refresh
@message_window.visible = false
@party_command_window.active = false
@actor_command_window.active = true
@party_command_window.visible = false
@actor_command_window.index = @pre_a_index
@status_window.index = @commander.index
@status_window.active = true
end
#--------------------------------------------------------------------------
# ● 도주의 처리 ※재정의
#--------------------------------------------------------------------------
def process_escape
@escape = true
closed_window
@info_viewport.visible = false
@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
for actor in $game_party.members
unless actor.restriction >= 4
@spriteset.set_action(true, actor.index,actor.run_success)
end
end
wait_for_message
@judge = true
$game_troop.clear_actions
$game_party.clear_actions
battle_end(1)
# 움직일 수 없는 액터를 제외하고 도주 실패 액션
else
for actor in $game_party.members
unless actor.restriction >= 4
@spriteset.set_action(true, actor.index,actor.run_ng)
end
end
@escape_ratio += 10
$game_message.texts.push('.' + Vocab::EscapeFailure)
wait_for_message
$game_party.clear_actions
end
reset_atb_actor
@info_viewport.visible = true
@escape = false
end
#--------------------------------------------------------------------------
# ● 액터의 ATB를 초기화
#--------------------------------------------------------------------------
def reset_atb_actor
@command_members = []
@commander = nil
$in_action = @command_phase = false
$in_command = $in_target = $in_select = false
@message_window.clear
for member in $game_party.members
@action_battlers.delete(member)
member.white_flash = false
member.action.clear
# ATB 게이지로 전환해
@spriteset.change_atb(N02::ATB_RUN_NG * -10, member.actor?, member.index)
end
end
#--------------------------------------------------------------------------
# ● 열려 있는 윈도우를 닫는다
#--------------------------------------------------------------------------
def closed_window
@cursor.dispose if @cursor != nil
@cursor = nil
@help_window.dispose if @help_window != nil
@help_window = nil
@help_window2.dispose if @help_window2 != nil
@help_window2 = nil
@skill_window.dispose if @skill_window != nil
@skill_window = nil
@item_window.dispose if @item_window != nil
@item_window = nil
@actor_command_window_on = false if @actor_command_window != nil
@actor_command_window.active = false if @actor_command_window != nil
@party_command_window.visible = false if @party_command_window != nil
@party_command_window.active = false if @party_command_window != nil
@status_window.index = @actor_index = @actor_command_window.index = -1
end
#--------------------------------------------------------------------------
# ● 타겟 선택의 개시 ※재정의
#--------------------------------------------------------------------------
def start_target_selection(actor = false)
$in_target = true
$in_command = $in_select = false
@target_actors = actor
@target_members = $game_party.members if @target_actors
@target_members = $game_troop.members unless @target_actors
# 불필요한 윈도우를 지운다
@actor_command_window.active = false
@skill_window.visible = false if @skill_window != nil
@item_window.visible = false if @item_window != nil
# 존재하고 있는 타겟으로 가장 번호의 낮은 대상을 최초로 가리키도록(듯이)
@index = 0
@max_index = @target_members.size - 1
# 액터는 전투 불능자라도 타겟 할 수 있도록(듯이) 에너미와 구별
unless @target_actors
@target_members.size.times do
break if @target_members[@index].exist?
@index += 1
end
end
# 커서 세트
@cursor.set(@target_members[@index])
@help_window.visible = false if @help_window != nil
@help_window2 = Window_Help.new if @help_window2 == nil
@help_window2.set_text_n02add(@target_members[@index])
end
#--------------------------------------------------------------------------
# ● 타겟 선택 갱신 ※재정의
#--------------------------------------------------------------------------
def update_target
# 커멘드 입력할 수 있는 상태가 아니게 되면 캔슬
return reset_command unless commanding?
return end_target_selection(cansel = true) if $game_troop.all_dead?
cursor_down if !@target_members[@index].actor? && !@target_members[@index].exist?
if Input.trigger?(Input::B)
Input.update
Sound.play_cancel
end_target_selection(cansel = true)
elsif Input.trigger?(Input::C)
Input.update
Sound.play_decision
@commander.action.target_index = @index
end_target_selection
end_skill_selection
end_item_selection
@actor_command_window.active = false
next_actor
end
if Input.repeat?(Input::LEFT)
if @target_actors
cursor_down if $back_attack
cursor_up unless $back_attack
else
cursor_up if $back_attack
cursor_down unless $back_attack
end
end
if Input.repeat?(Input::RIGHT)
if @target_actors
cursor_up if $back_attack
cursor_down unless $back_attack
else
cursor_down if $back_attack
cursor_up unless $back_attack
end
end
cursor_up if Input.repeat?(Input::UP)
cursor_down if Input.repeat?(Input::DOWN)
end
#--------------------------------------------------------------------------
# ● 커서를 앞에 두고 이동 ※재정의
#--------------------------------------------------------------------------
def cursor_up
Sound.play_cursor
@target_members.size.times do
@index += @target_members.size - 1
@index %= @target_members.size
break if @target_actors
break if @target_members[@index].exist?
end
# 커서 세트
@cursor.set(@target_members[@index])
@help_window2.set_text_n02add(@target_members[@index]) if @help_window2 != nil
end
#--------------------------------------------------------------------------
# ● 커서를 다음에 이동 ※재정의
#--------------------------------------------------------------------------
def cursor_down
Sound.play_cursor
@target_members.size.times do
@index += 1
@index %= @target_members.size
break if @target_actors
break if @target_members[@index].exist?
end
# 커서 세트
@cursor.set(@target_members[@index])
@help_window2.set_text_n02add(@target_members[@index]) if @help_window2 != nil
end
#--------------------------------------------------------------------------
# ● 타겟 선택의 종료재정의
#--------------------------------------------------------------------------
def end_target_selection(cansel = false)
$in_target = false
@help_window2.dispose if @help_window2 != nil
@help_window2 = nil
@help_window.visible = false if @help_window != nil
if @skill_window != nil
@skill_window.visible = @skill_window.active = true
@help_window.visible = true if @help_window != nil
@actor_command_window.active = false if cansel
$in_select = true if cansel
elsif @item_window != nil
@item_window.visible = @item_window.active = true
@help_window.visible = true if @help_window != nil
@actor_command_window.active = false if cansel
$in_select = true if cansel
end
@target_members = nil
end_command if !cansel
# 커서 세트
@cursor.set(@commander) if cansel
$in_command = true if cansel && @actor_command_window.index == 0
@actor_command_window.active = true if cansel && @actor_command_window.index == 0
end
#--------------------------------------------------------------------------
# ● 커멘드 초기화
#--------------------------------------------------------------------------
def reset_command
@message_window.visible = false
@party_command_window.active = false
@commander.action.clear
@party_command_window.visible = false
$in_command = $in_select = $in_target = false
@target_members = nil
@actor_command_window.active = false
@cursor.visible = false
@command_phase = false
end_skill_selection
end_item_selection
@party_command_window.active = @actor_command_window.active = false
@actor_command_window_on = false
@status_window.index = @actor_index = @actor_command_window.index = -1
@command_members.delete(@commander)
@commander = nil
end
#--------------------------------------------------------------------------
# ● 강제 행동에 의한 커멘드 캔슬
#--------------------------------------------------------------------------
def force_action_command_cansel(member)
return if !member.inputable?
# 요금 설정
act_type = charge_set(member)
# 행동 게이지로 전환해
@spriteset.change_act(act_type, member.actor?, member.index)
# 움직일 수 있는 캐릭터만 커멘드 귀가 액션을
@spriteset.set_action(true, member.index,member.command_a) if member.actor? && member.inputable?
# 요금 액션
make_charge_action(member)
# 이하의 처리는 커멘드 입력중의 액터 한정
return if !member.actor? or @commander != member
# 커서 소거
@cursor.visible = false
@command_phase = false
# 윈도우 초기화
end_skill_selection
end_item_selection
$in_target = false
@help_window2.dispose if @help_window2 != nil
@help_window2 = nil
@help_window.visible = false if @help_window != nil
@party_command_window.active = @actor_command_window.active = false
@actor_command_window_on = false
@status_window.index = @actor_index = @actor_command_window.index = -1
@command_members.delete(member)
@commander = nil
@message_window.visible = false
@party_command_window.active = false
@party_command_window.visible = false
$in_command = $in_select = $in_target = false
@target_members = nil
end
#--------------------------------------------------------------------------
# ● 커멘드 입력 종료
#--------------------------------------------------------------------------
def end_command
return if !@commander.inputable?
$in_command = false
$in_select = false
# 커서 소거
@cursor.visible = false
@command_phase = false
# 액션 실행 시간 체크
act_type = charge_set(@commander)
# 행동 게이지로 전환해
@spriteset.change_act(act_type, true, @commander.index)
# 움직일 수 있는 캐릭터만 커멘드 귀가 액션을
@spriteset.set_action(true, @commander.index,@commander.command_a) if @commander.inputable?
# 요금 액션
make_charge_action(@commander)
# 합체 공격 체크
union_skill?(@commander) if @commander.action.skill? && @partners == nil
# 윈도우 초기화
@party_command_window.active = @actor_command_window.active = false
@actor_command_window_on = false
@status_window.index = @actor_index = @actor_command_window.index = -1
@command_members.delete(@commander)
@commander = nil
end
#--------------------------------------------------------------------------
# ● 정보 표시 뷰포트의 작성 ※재정의
#--------------------------------------------------------------------------
def create_info_viewport
@command_members = []
@action_battlers = []
@info_viewport = Viewport.new(0, 288, 544, 128)
@info_viewport.z = 100
@status_window = Window_BattleStatus.new
@party_command_window = Window_PartyCommand2.new
@actor_command_window = Window_ActorCommand.new
@status_window.viewport = @info_viewport
@actor_command_window.viewport = @info_viewport
@status_window.x = 128
@actor_command_window.x = 672
@info_viewport.visible = false
@party_command_window.visible = false
@info_viewport.ox = 128
end
#--------------------------------------------------------------------------
# ● 정보 표시 뷰포트의 갱신 ※재정의
#--------------------------------------------------------------------------
def update_info_viewport
@party_command_window.update if @party_command_window.active
@actor_command_window.update if @actor_command_window.active
@status_window.update if @status_window.active
@message_window.visible = false if !$game_message.visible
@info_viewport.visible = true if !@message_window.visible
@actor_command_window.x += 32 if @actor_command_window.x < 672 && !@actor_command_window_on
@actor_command_window.x -= 32 if @actor_command_window.x > 544 && @actor_command_window_on
end
#--------------------------------------------------------------------------
# ● 스킬 선택의 개시 ※재정의
#--------------------------------------------------------------------------
def start_skill_selection
@help_window = Window_Help.new if @help_window == nil
@help_window.visible = true
@skill_window = Window_Skill.new(0, 56, 544, 232, @commander)
@skill_window.z = 1000
@skill_window.help_window = @help_window
@actor_command_window.active = false
end
#--------------------------------------------------------------------------
# ● 스킬 선택의 갱신 ※재정의
#--------------------------------------------------------------------------
def update_skill_selection
# 커멘드 입력할 수 있는 상태가 아니게 되면 캔슬
return reset_command unless commanding?
@skill_window.active = true
@skill_window.update
@help_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
end_skill_selection
$in_command = true
elsif Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill != nil
@commander.last_skill_id = @skill.id
end
if @commander.skill_can_use?(@skill)
return Sound.play_buzzer if @commander.union_skill?(@skill.id) && !@commander.union_skill_can_use?(@skill.id)
Sound.play_decision
determine_skill
else
Sound.play_buzzer
end
end
end
#--------------------------------------------------------------------------
# ● 스킬의 결정 ※재정의
#--------------------------------------------------------------------------
def determine_skill
@commander.action.set_skill(@skill.id)
@skill_window.active = false
if @skill.need_selection?
if @skill.for_opponent?
start_target_enemy_selection
else
start_target_actor_selection
end
else
end_skill_selection
end_target_selection
end
end
#--------------------------------------------------------------------------
# ● 스킬 선택의 종료
#--------------------------------------------------------------------------
alias end_skill_selection_n01 end_skill_selection
def end_skill_selection
end_skill_selection_n01
$in_select = false
end
#--------------------------------------------------------------------------
# ● 아이템 선택의 개시 ※재정의
#--------------------------------------------------------------------------
def start_item_selection
@help_window = Window_Help.new if @help_window == nil
@help_window.visible = true
@item_window = Window_Item.new(0, 56, 544, 232)
@item_window.z = 1000
@item_window.help_window = @help_window
@actor_command_window.active = false
end
#--------------------------------------------------------------------------
# ● 아이템 선택의 갱신 ※재정의
#--------------------------------------------------------------------------
def update_item_selection
# 커멘드 입력할 수 있는 상태가 아니게 되면 캔슬
return reset_command unless commanding?
@item_window.active = true
@item_window.update
@help_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
end_item_selection
$in_select = true
elsif Input.trigger?(Input::C)
@item = @item_window.item
if @item != nil
$game_party.last_item_id = @item.id
end
if $game_party.item_can_use?(@item)
Sound.play_decision
determine_item
else
Sound.play_buzzer
end
end
end
#--------------------------------------------------------------------------
# ● 아이템의 결정 ※재정의
#--------------------------------------------------------------------------
def determine_item
@commander.action.set_item(@item.id)
@item_window.active = false
if @item.need_selection?
if @item.for_opponent?
start_target_enemy_selection
else
start_target_actor_selection
end
else
end_item_selection
end_target_selection
end
end
#--------------------------------------------------------------------------
# ● 아이템 선택의 종료
#--------------------------------------------------------------------------
alias end_item_selection_n01 end_item_selection
def end_item_selection
end_item_selection_n01
$in_select = false
end
#--------------------------------------------------------------------------
# ● 승패 판정 ※재정의
#--------------------------------------------------------------------------
def judge_win_loss
return true unless $game_temp.in_battle
if $game_party.all_dead?
@judge = true
$gauge_stop = true
closed_window
@spriteset.atb_dispose
$game_troop.clear_actions
$game_party.clear_actions
process_defeat
return true
elsif $game_troop.all_dead?
@judge = true
$gauge_stop = true
closed_window
@spriteset.atb_dispose
$game_troop.clear_actions
$game_party.clear_actions
process_victory
return true
else
return false
end
end
end
#==============================================================================
# ■ Game_Battler (분할 정의 1)
#------------------------------------------------------------------------------
# 버틀러를 취급하는 클래스입니다.
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 공개 인스턴스 변수
#--------------------------------------------------------------------------
attr_accessor :at_count # 커멘드 대기 게이지(1000이 MAX)
attr_accessor :at_active # 커멘드 입력 가능
attr_accessor :atb_count_up # ATB 카운트업중
attr_accessor :act_count # 행동 대기 게이지(1000이 MAX)
attr_accessor :act_active # 행동 가능
attr_accessor :at_speed # 게이지 업 스피드 기준치
attr_accessor :charge_action # 요금 액션
attr_accessor :charge_start # 요금중인가
attr_accessor :union_skill_id # 합체 공격 스킬 ID
attr_accessor :union_battler # 합체 공격 참가자인가
attr_accessor :speed_level # 전투 참가자의 최고 속도 스피드 기준
attr_accessor :low_speed_level # 전투 참가자의 최지스피드 기준
attr_accessor :graphics_width # 버틀러 화상 1 셀 근처의 가로폭
attr_accessor :graphics_height # 버틀러 화상 1 셀 근처의 세로폭
#--------------------------------------------------------------------------
# ● 스테이트의 부가 ATB 데미지 처리를 추가
#--------------------------------------------------------------------------
alias add_state_n02 add_state
def add_state(state_id)
add_state_n02(state_id)
if $data_states[state_id].atb_damage != 0
@at_count = @at_count + $data_states[state_id].atb_damage * 10
@at_count = 0 if @at_count < 0 && !$data_states[state_id].atb_minus_damage
@at_count = 1000 if @at_count > 1000
# ATB 데미지로 요금 캔슬
if $data_states[state_id].atb_damage < 0
@act_count = 0
@act_active = false
@at_active = false
@atb_count_up = true
end
end
end
#--------------------------------------------------------------------------
# ● 전투 개시시의 AT설정
#--------------------------------------------------------------------------
def atb_setting
# 초기화
@at_count = @act_count = @speed_level = @low_speed_level = @union_skill_id = 0
@at_active = @act_active = @atb_count_up = @charge_start = @union_battler = false
$in_party_command = $in_command = $in_target = $in_select = $in_action = false
@charge_action = normal
$in_union_action = false
# 게이지 업 스피드(전투 속도)
@at_speed = $game_party.atb_control[1]
# 유저 설정을 사용하지 않는 경우
return if N02::ATB_CUSTOMIZE
@at_speed = N02::ATB_SPEED
end
#--------------------------------------------------------------------------
# ● ATB 스피드 기준치 리프레쉬
#--------------------------------------------------------------------------
def atb_base_speed_refresh
battle_members = $game_party.members + $game_troop.members
battle_members.sort! do |a,b|
b.agi - a.agi
end
self.speed_level = battle_members[0].agi
self.low_speed_level = battle_members[battle_members.size - 1].agi
end
#--------------------------------------------------------------------------
# ● 자동 행동 판정
#--------------------------------------------------------------------------
def auto_action?
return true if berserker? or confusion? or auto_battle or @union_skill_id != 0
return false
end
#--------------------------------------------------------------------------
# ● 합체 공격 스킬 판정
#--------------------------------------------------------------------------
def union_skill?(skill_id)
# 스킬에 합체 공격 설정이 있을까 체크
for union_action in $data_skills[skill_id].union_action
union_skills = union_action if union_action.size != 0 && union_action.include?(skill_id)
end
return false if union_skills == nil
return true
end
#--------------------------------------------------------------------------
# ● 합체 공격 사용 가능 판정
#--------------------------------------------------------------------------
def union_skill_can_use?(skill_id)
return false if $in_union_action
for union_action in $data_skills[skill_id].union_action
union_skills = union_action if union_action.size != 0 && union_action.include?(skill_id)
end
return false if union_skills == nil
partners = []
# 합체 공격 멤버가 사용 가능한가 체크
for skill_id in union_skills
for actor in $game_party.members
if actor.skill_can_use?($data_skills[skill_id]) && actor.skill_id_learn?(skill_id)
partners.push(actor)
end
end
end
return false if partners.size != union_skills.size
return true
end
end
#==============================================================================
# ■ Game_Party
#------------------------------------------------------------------------------
# 파티를 취급하는 클래스입니다.
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● 공개 인스턴스 변수
#--------------------------------------------------------------------------
attr_accessor :atb_custom # ATB 유저 설정
attr_accessor :atb_control # ATB 설정
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
alias initialize_n02 initialize
def initialize
initialize_n02
@atb_control = []
@atb_custom = [N02::ATB_NEWGAME_MODE, N02::ATB_NEWGAME_SPEED - 1]
end
#--------------------------------------------------------------------------
# ● 유저 설정을 ATB 설정에 반영
#--------------------------------------------------------------------------
def atb_customize
# 웨이트·액티브 설정을 격납
case @atb_custom[0]
when 0;@atb_control[0] = N02::ATB_MODE1
when 1;@atb_control[0] = N02::ATB_MODE2
when 2;@atb_control[0] = N02::ATB_MODE3
end
# 전투 속도를 격납
@atb_control[1] = N02::ATB_SPEED_MODE[@atb_custom[1]]
# 유저 설정을 사용하지 않는 경우
return if N02::ATB_CUSTOMIZE
@atb_control[0] = ["",N02::ATB_PARTY_COMMAND_WAIT, N02::ATB_COMMAND_WAIT, N02::ATB_TARGET_WAIT, N02::ATB_SELECT_WAIT, N02::ATB_ACTION_WAIT]
@atb_control[1] = N02::ATB_SPEED
end
end
#==============================================================================
# ■ Sprite_MoveAnime
#------------------------------------------------------------------------------
# ATB 게이지용의 스프라이트입니다.
#==============================================================================
class Sprite_ATB < Sprite_Base
#--------------------------------------------------------------------------
# ● 공개 인스턴스 변수
#--------------------------------------------------------------------------
attr_accessor :battler
attr_accessor :count # 갱신 카운트
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
def initialize(viewport,battler = nil)
super(viewport)
@battler = battler
@count = 0
@base_atb_count = 1
@restriction_count = 0
@state_freeze = false
@update = 0
@pre_width = 0
make_gauge
start_atb
@party_command_wait = $game_party.atb_control[0][1]
@command_wait = $game_party.atb_control[0][2]
@target_wait = $game_party.atb_control[0][3]
@select_wait = $game_party.atb_control[0][4]
@action_wait = $game_party.atb_control[0][5]
end
#--------------------------------------------------------------------------
# ● ATB 초기치 세팅
#--------------------------------------------------------------------------
def start_atb
atb = battler.atb_base * 10 + rand(N02::ATB_BASE_ADD) * 10
if battler.actor?
atb1 = battler.weapons[0].atb_base * 10 if battler.weapons[0] != nil
atb2 = battler.weapons[1].atb_base * 10 if battler.weapons[1] != nil
atb1 = atb if atb1 == nil
atb2 = atb1 if atb2 == nil
atb += (atb1 + atb2) / 2
for i in 0...battler.armors.size
# 2 칼은 캔슬
next if battler.two_swords_style && battler.armors[0] != nil && battler.armors[0]
atb += battler.armors[i].atb_base * 10 if battler.armors[i] != nil
end
end
change_atb(atb)
end
#--------------------------------------------------------------------------
# ● 게이지 작성
#--------------------------------------------------------------------------
def make_gauge
self.bitmap = Cache.system("atb_bar_skin")
@gauge = Sprite.new(viewport)
@gauge.bitmap = Cache.system("atb_bar")
@gauge_max = Sprite.new(viewport)
@gauge_max.bitmap = Cache.system("atb_bar_active")
@gauge_max.visible = false
@gauge_division = 1000 / N02::ATB_WIDTH
@gauge_space = N02::ATB_SPACE
end
#--------------------------------------------------------------------------
# ● 좌표 세트
#--------------------------------------------------------------------------
def set(x, y)
self.ox = @gauge.ox = @gauge_max.ox = self.bitmap.width / 2
self.oy = @gauge.oy = @gauge_max.oy = self.bitmap.height / 2
self.visible = @gauge.visible = @gauge_max.visible = false
if @battler.actor? && N02::ATB_POSITION_HPWINDOW
self.z = @gauge.z = @gauge_max.z = 1000
self.x = @gauge.x = @gauge_max.x = N02::ATB_PARTY_POSITION[@battler.index][0]
self.y = @gauge.y = @gauge_max.y = N02::ATB_PARTY_POSITION[@battler.index][1]
return
end
adjust = N02::ATB_POSITION_ENEMY
adjust = N02::ATB_POSITION_ACTOR if battler.actor?
self.x = @gauge.x = @gauge_max.x = x + adjust[0]
self.x = @gauge.x = @gauge_max.x = x - adjust[0] if $back_attack
self.y = @gauge.y = @gauge_max.y = y + adjust[1]
self.z = @gauge.z = @gauge_max.z = battler.position_z + 10
@gauge_max.z += 1
end
#--------------------------------------------------------------------------
# ● ATB 게이지 변환
#--------------------------------------------------------------------------
def change_atb(restart_gauge = 0)
@battler.atb_base_speed_refresh
case N02::ATB_BASE_SPEED
when 0
return @base_atb_count = @battler.at_speed * battler.agi if N02::ATB_ABSOLUTE_SPEED == 0
@base_atb_count = @battler.at_speed * battler.agi / N02::ATB_ABSOLUTE_SPEED
when 1
return @base_atb_count = @battler.at_speed * battler.agi if @battler.speed_level == 0
@base_atb_count = @battler.at_speed * battler.agi / @battler.speed_level
when 2
return @base_atb_count = @battler.at_speed * @battler.agi if @battler.low_speed_level == 0
@base_atb_count = @battler.at_speed * @battler.agi / @battler.low_speed_level
when 3
return @base_atb_count = @battler.at_speed * @battler.agi if @battler.speed_level / 2 + @battler.low_speed_level / 2 == 0
@base_atb_count = @battler.at_speed * @battler.agi / (@battler.speed_level / 2 + @battler.low_speed_level / 2)
end
@base_atb_count = 1 if @base_atb_count == 0
@battler.at_count = restart_gauge
@battler.act_count = 0
@gauge.bitmap = Cache.system("atb_bar")
@battler.act_active = false
@battler.at_active = false
@battler.atb_count_up = true
end
#--------------------------------------------------------------------------
# ● ACT 게이지 변환
#--------------------------------------------------------------------------
def change_act(act_type)
change_atb
case act_type[0]
when 0
base = @battler.at_speed * @battler.agi
base = @battler.at_speed * @battler.agi / act_type[2] if act_type[2] != 0
when 1
base = @battler.at_speed * @battler.agi / @battler.speed_level
when 2
base = @battler.at_speed * @battler.agi if @battler.low_speed_level == 0
base = @battler.at_speed * @battler.agi / @battler.low_speed_level
when 3
base = @battler.at_speed * @battler.agi if @battler.speed_level / 2 + @battler.low_speed_level / 2 == 0
base = @battler.at_speed * @battler.agi / (@battler.speed_level / 2 + @battler.low_speed_level / 2)
when 4
base = @battler.at_speed
end
if act_type[1] <= 0
@base_act_count = 1000
else
@base_act_count = base * 100 / act_type[1]
end
@base_act_count = 1 if @base_act_count == 0
@battler.act_count = 0
@gauge.bitmap = Cache.system("act_bar")
@battler.atb_count_up = false
@battler.at_active = false
end
#--------------------------------------------------------------------------
# ● 프레임 갱신
#--------------------------------------------------------------------------
def update
# 스테이트 관리
states_control
# 강제 게이지 스톱
return if $gauge_stop or !@battler.exist? or $game_message.visible
# 액션 웨이트
wait = true if $in_action && !@action_wait
wait = false if $in_action && @action_wait
# 파티 커멘드 선택중 웨이트
wait = true if $in_party_command && !@party_command_wait
wait = false if $in_party_command && @party_command_wait
# 전투 커멘드 선택중 웨이트
wait = true if $in_command && !@command_wait
wait = false if $in_command && @command_wait
# 타겟 선택중 웨이트
wait = true if $in_target && !@target_wait
wait = false if $in_target && @target_wait
# 스킬/아이템 선택중 웨이트
wait = true if $in_select && !@select_wait
wait = false if $in_select && @select_wait
# 액션중은 게이지를 지울까
self.visible = @gauge.visible = true
self.visible = @gauge_max.visible = @gauge.visible = false if @battler.act_active && N02::ATB_ACTION_ENEMY_OFF && !@battler.actor? && @battler.union_skill_id == 0
self.visible = @gauge_max.visible = @gauge.visible = false if @battler.act_active && N02::ATB_ACTION_ACTOR_OFF && @battler.actor? && @battler.union_skill_id == 0
# 게이지 표시 설정
self.visible = @gauge.visible = @gauge_max.visible = false if !@battler.atb_on
self.visible = @gauge.visible = @gauge_max.visible = false if @battler.actor? && $game_message.visible && N02::ATB_POSITION_HPWINDOW
# 안보이는 에너미는 게이지 은폐
self.visible = @gauge.visible = @gauge_max.visible = false if !@battler.actor? && !@battler.exist?
# 버튼 입력에 의한 게이지 제어
wait = true if Input.press?(Input::ALT) && N02::ATB_ALT_WAIT
wait = false if Input.press?(Input::CTRL) && N02::ATB_CTRL_ACTIVE
# 자신만 액션 웨이트
wait = true if @battler.act_active
# 게이지 웨이트
return if wait
# 스테이트에 의한 게이지 스톱 처리
return recover_states_freeze if @state_freeze
# 게이지 카운트업
gauge_update
# 게이지 묘화
return if @pre_width == @gauge_space + @battler.act_count / @gauge_division && !@battler.atb_count_up
return if @pre_width == @gauge_space + @battler.at_count / @gauge_division && @battler.atb_count_up
gauge_refresh
end
#--------------------------------------------------------------------------
# ● 게이지 카운트업
#--------------------------------------------------------------------------
def gauge_update
# ACT 카운트업
act if !@battler.atb_count_up && !@battler.at_active && !@battler.act_active
# ATB 카운트업
atb if @battler.atb_count_up
end
#--------------------------------------------------------------------------
# ● 게이지 리프레쉬
#--------------------------------------------------------------------------
def gauge_refresh
@gauge_max.visible = false if !@battler.act_active && !@battler.at_active
@gauge.src_rect.width = @pre_width = @gauge_space + @battler.act_count / @gauge_division if !@battler.atb_count_up && !@battler.at_active && !@battler.act_active
@gauge.src_rect.width = @pre_width = @gauge_space + @battler.at_count / @gauge_division if @battler.atb_count_up
end
#--------------------------------------------------------------------------
# ● 게이지 은폐
#--------------------------------------------------------------------------
def off
self.visible = @gauge.visible = @gauge_max.visible = false
end
#--------------------------------------------------------------------------
# ● 게이지 표시
#--------------------------------------------------------------------------
def on
self.visible = @gauge.visible = @gauge_max.visible = true
gauge_refresh
end
#--------------------------------------------------------------------------
# ● 스테이트 관리
#--------------------------------------------------------------------------
def states_control
if !@state_freeze && !@battler.movable?
# 행동 불능은 게이지를 0에
@restriction_count = @battler.at_count
@state_freeze = true
@atb_dead = true if @battler.dead? && !@atb_dead
change_atb(0)
gauge_refresh
self.visible = @gauge_max.visible = @gauge.visible = false if !@battler.actor? && !@battler.exist?
# 스테이트 복귀시
elsif @battler.movable? && @state_freeze
@state_freeze = false
# 전투 불능 복귀시의 게이지 처리
return if !@atb_dead
change_atb(N02::ATB_DEAD_COUNT * 10)
@atb_dead = false
gauge_refresh
end
end
#--------------------------------------------------------------------------
# ● 스테이트에 의한 게이지 스톱 회복
#--------------------------------------------------------------------------
def recover_states_freeze
@restriction_count += @base_atb_count
@restriction_count += @base_atb_count * 2 if Input.press?(Input::SHIFT) && N02::ATB_SHIFT_BOOST
if @restriction_count >= 1000
# 스테이트 자연 회복 허가
@battler.remove_states_auto
@restriction_count = 0
end
end
#--------------------------------------------------------------------------
# ● ATB 카운트
#--------------------------------------------------------------------------
def atb
if @battler.at_count <= 1000
@gauge_max.visible = false
@battler.at_count += @base_atb_count
@battler.at_count += @base_atb_count * 2 if Input.press?(Input::SHIFT) && N02::ATB_SHIFT_BOOST
end
# ATB 게이지 MAX
if @battler.at_count >= 1000
# 스테이트 자연 회복
@battler.remove_states_auto
@battler.atb_count_up = false
@battler.at_active = true
@gauge.src_rect.width = 52
return if !@battler.atb_on
Audio.se_play("Audio/SE/" + N02::ATB_MAX_SOUND01[2], N02::ATB_MAX_SOUND01[1], N02::ATB_MAX_SOUND01[0])
@gauge_max.visible = true
end
@battler.act_active = false
end
#--------------------------------------------------------------------------
# ● ACT 카운트
#--------------------------------------------------------------------------
def act
if @battler.act_count <= 1000
@gauge_max.visible = false
@battler.act_count += @base_act_count
@battler.at_count += @base_atb_count * 3 if Input.press?(Input::SHIFT) && N02::ATB_SHIFT_BOOST
end
# ACT 게이지 MAX
if @battler.act_count >= 1000 && !@battler.act_active
@battler.act_active = true
@gauge.src_rect.width = 52
return if !@battler.atb_on
Audio.se_play("Audio/SE/" + N02::ACT_MAX_SOUND01[2], N02::ACT_MAX_SOUND01[1], N02::ACT_MAX_SOUND01[0])
@gauge_max.visible = true
end
end
#--------------------------------------------------------------------------
# ● 해방
#--------------------------------------------------------------------------
def dispose
super
@gauge.dispose
@gauge_max.dispose
end
end
#==============================================================================
# ■ Sprite_Cursor
#------------------------------------------------------------------------------
# 커서의 스프라이트입니다.
#==============================================================================
class Sprite_Cursor < Sprite_Base
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
def initialize
super
create_target_cursor
end
#--------------------------------------------------------------------------
# ● 타겟 커서 스프라이트의 작성
#--------------------------------------------------------------------------
def create_target_cursor
self.bitmap = Cache.system("cursor")
@width = self.bitmap.width
@height = self.bitmap.height / 3
self.src_rect.set(0, 0, @width, @height)
@cursor_flame = 0
self.x = @pre_x = 272
self.y = @pre_y = 208
self.z = 300
self.ox = @width
self.oy = @height
self.visible = false
@time = 0
@flash_time = 0
end
#--------------------------------------------------------------------------
# ● 프레임 갱신
#--------------------------------------------------------------------------
def update
# 커서 화상 갱신
@cursor_flame = 0 if @cursor_flame == 40
self.src_rect.set(0, 0, @width, @height) if @cursor_flame == 0
self.src_rect.set(0, @height, @width, @height) if @cursor_flame == 10
self.src_rect.set(0, 2 * @height, @width, @height) if @cursor_flame == 20
self.src_rect.set(0, @height, @width, @height) if @cursor_flame == 30
@cursor_flame += 1
# 커서 좌표 갱신
return if @battler == nil
# 타겟을 빛낸다
@flash_time -= 1
if @flash_time == 0 && @battler.exist? && !@battler.collapse
@battler.white_flash = true
@flash_time = 20
end
if @time == 0
self.x = @battler.position_x
return self.y = @battler.position_y - @battler.graphics_width / 5
end
@time -= 1
self.x = @pre_x + (@battler.position_x - @pre_x) * (9 - @time) / 9
self.y = @pre_y + (@battler.position_y - @battler.graphics_width / 5 - @pre_y) * (9 - @time) / 9
end
#--------------------------------------------------------------------------
# ● 커서 이동 정보 세트
#--------------------------------------------------------------------------
def set(battler)
self.visible = true
@battler = battler
return if @battler == nil
@battler.white_flash = true if @battler.exist? && !@battler.collapse
@time = 9
@flash_time = 20
@pre_x = self.x
@pre_y = self.y
end
end
#==============================================================================
# ■ Sprite_Battler
#------------------------------------------------------------------------------
# 버틀러 표시용의 스프라이트입니다.
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# ● 버틀러 작성
#--------------------------------------------------------------------------
alias make_battler_n01 make_battler
def make_battler
make_battler_n01
@battler.graphics_width = @width
@battler.graphics_height = @height
make_atb
end
#--------------------------------------------------------------------------
# ● 해방
#--------------------------------------------------------------------------
alias dispose_n01 dispose
def dispose
dispose_n01
@atb_gauge.dispose if @atb_gauge != nil
end
#--------------------------------------------------------------------------
# ● 대기 액션 ※재정의
#--------------------------------------------------------------------------
def stand_by
# 요금 액션을 우선
@battler.charge_start = false if @battler.charge_start && !@battler.exist?
return @repeat_action = @battler.charge_action if @battler.charge_start
# 통상 대기에
@repeat_action = @battler.normal
# HP가1/4로 핀치모션에
@repeat_action = @battler.pinch if @battler.hp <= @battler.maxhp / 4
# 방어중
@repeat_action = @battler.defence if @battler.guarding?
# 아무것도 스테이트가 없으면 종료
return if @battler.state_id == nil
for state in @battler.states.reverse
# 액션 금지의 스테이트라면 스킵
next if state.extension.include?("NOSTATEANIME")
# 에너미로 금지되고 있는 스테이트 액션이라면 스킵
next if @battler.is_a?(Game_Enemy) && state.extension.include?("EXCEPTENEMY")
# 스테이트의 모션에
@repeat_action = state.base_action
end
end
#--------------------------------------------------------------------------
# ● ATB 게이지 작성
#--------------------------------------------------------------------------
def make_atb
return if battler == nil
battler.atb_setting
if battler.actor? && N02::ATB_POSITION_HPWINDOW
@atb_gauge = Sprite_ATB.new(@viewport2,battler)
else
@atb_gauge = Sprite_ATB.new(viewport,battler)
end
@atb_gauge.set(self.x, self.y)
end
#--------------------------------------------------------------------------
# ● ATB 게이지뷰포트 작성
#--------------------------------------------------------------------------
def make_atb_viewport(new_viewport)
@viewport2 = new_viewport
end
#--------------------------------------------------------------------------
# ● 프레임 갱신
#--------------------------------------------------------------------------
alias update_n01 update
def update
update_n01
# ATB 갱신
@atb_gauge.update if @atb_gauge != nil
end
#--------------------------------------------------------------------------
# ● 게이지 갱신
#--------------------------------------------------------------------------
def gauge_update
@atb_gauge.gauge_update if @atb_gauge != nil
end
#--------------------------------------------------------------------------
# ● 게이지 리프레쉬
#--------------------------------------------------------------------------
def gauge_refresh
@atb_gauge.gauge_refresh if @atb_gauge != nil
end
#--------------------------------------------------------------------------
# ● 게이지 표시
#--------------------------------------------------------------------------
def gauge_on
@atb_gauge.on if @atb_gauge != nil
end
#--------------------------------------------------------------------------
# ● 게이지 은폐
#--------------------------------------------------------------------------
def gauge_off
@atb_gauge.off if @atb_gauge != nil
end
#--------------------------------------------------------------------------
# ● ATB 게이지 변환
#--------------------------------------------------------------------------
def change_atb(restart_gauge)
@atb_gauge.change_atb(restart_gauge) if @atb_gauge != nil
end
#--------------------------------------------------------------------------
# ● ACT 게이지 변환
#--------------------------------------------------------------------------
def change_act(act_type)
@atb_gauge.change_act(act_type) if @atb_gauge != nil
end
#--------------------------------------------------------------------------
# ● ATB 게이지 개방
#--------------------------------------------------------------------------
def atb_dispose
@atb_gauge.dispose if @atb_gauge != nil
@atb_gauge = nil
end
end
#==============================================================================
# ■ Spriteset_Battle
#------------------------------------------------------------------------------
# 배틀 화면의 스프라이트를 정리한 클래스입니다.
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● 액터 스프라이트의 작성
#--------------------------------------------------------------------------
alias create_actors_n01 create_actors
def create_actors
create_actors_n01
if N02::ATB_POSITION_HPWINDOW
for sprites in @actor_sprites + @enemy_sprites
sprites.make_atb_viewport(@viewport4)
end
end
end
#--------------------------------------------------------------------------
# ● 타겟 정보 리프레쉬
#--------------------------------------------------------------------------
def update_target(actor, index)
@actor_sprites[index].update_target if actor
@enemy_sprites[index].update_target unless actor
end
#--------------------------------------------------------------------------
# ● 게이지 갱신
#--------------------------------------------------------------------------
def gauge_update
for sprites in @actor_sprites + @enemy_sprites
sprites.gauge_update if sprites != nil
end
end
#--------------------------------------------------------------------------
# ● 게이지 리프레쉬
#--------------------------------------------------------------------------
def gauge_refresh(actor, index)
@actor_sprites[index].gauge_refresh if actor
@enemy_sprites[index].gauge_refresh unless actor
end
#--------------------------------------------------------------------------
# ● 게이지 표시
#--------------------------------------------------------------------------
def gauge_on
for sprites in @actor_sprites + @enemy_sprites
sprites.gauge_on if sprites != nil
end
end
#--------------------------------------------------------------------------
# ● 게이지 은폐
#--------------------------------------------------------------------------
def gauge_off
for sprites in @actor_sprites + @enemy_sprites
sprites.gauge_off if sprites != nil
end
end
#--------------------------------------------------------------------------
# ● ATB 게이지 변환
#--------------------------------------------------------------------------
def change_atb(restart_gauge, actor, index)
@actor_sprites[index].change_atb(restart_gauge) if actor
@enemy_sprites[index].change_atb(restart_gauge) unless actor
end
#--------------------------------------------------------------------------
# ● ACT 게이지 변환
#--------------------------------------------------------------------------
def change_act(act_type, actor, index)
@actor_sprites[index].change_act(act_type) if actor
@enemy_sprites[index].change_act(act_type) unless actor
end
#--------------------------------------------------------------------------
# ● ATB 게이지 일제 개방
#--------------------------------------------------------------------------
def atb_dispose
for sprites in @actor_sprites + @enemy_sprites
sprites.atb_dispose if sprites != nil
end
end
end
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# 스킬이나 아이템의 설명, 액터의 스테이터스등을 표시하는 윈도우입니다.
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# ● 텍스트 설정
#--------------------------------------------------------------------------
def set_text_n02add(member)
return if member == nil
self.contents.clear
self.contents.font.color = normal_color
if !member.actor? && N02::ENEMY_NON_DISPLAY.include?(member.enemy_id)
return self.contents.draw_text(4, 0, self.width - 40, WLH, member.name, 1)
elsif member.actor? && !N02::ACTOR_DISPLAY
return self.contents.draw_text(4, 0, self.width - 40, WLH, member.name, 1)
end
if N02::WORD_STATE_DISPLAY && N02::HP_DISPLAY
self.contents.draw_text(0, 0, 180, WLH, member.name, 1)
draw_actor_hp(member, 182, 0, 120)
text = "["
for state in member.states
next if N02::STATE_NON_DISPLAY.include?(state.id)
text += " " if text != "["
text += state.name
end
text += N02::WORD_NORMAL_STATE if text == "["
text += "]"
text = "" if text == "[]"
self.contents.draw_text(315, 0, 195, WLH, text, 0)
elsif N02::WORD_STATE_DISPLAY
text = member.name + " ["
for state in member.states
next if N02::STATE_NON_DISPLAY.include?(state.id)
text += " " if text != member.name + " ["
text += state.name
end
text += N02::WORD_NORMAL_STATE if text == member.name + " ["
text += "]"
text = "" if text == "[]"
self.contents.draw_text(4, 0, self.width - 40, WLH, text, 1)
elsif N02::HP_DISPLAY
self.contents.draw_text(4, 0, 240, WLH, member.name, 1)
draw_actor_hp(member, 262, 0, 120)
end
end
end
#==============================================================================
# ■ Window_Skill
#------------------------------------------------------------------------------
# 스킬 화면등에서, 사용할 수 있는 스킬의 일람을 표시하는 윈도우입니다.
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ● 항목의 묘화 ※재정의
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
enabled = @actor.skill_can_use?(skill)
enabled = @actor.union_skill_can_use?(skill.id) if @actor.union_skill?(skill.id)
draw_item_name(skill, rect.x, rect.y, enabled)
self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
end
end
end
#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
# 배틀 화면에서 파티 멤버의 스테이터스를 표시하는 윈도우입니다.
#==============================================================================
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● 커서를 아래에 이동 ※재정의
#--------------------------------------------------------------------------
def cursor_down(wrap = false)
end
#--------------------------------------------------------------------------
# ● 커서를 위에 이동 ※재정의
#--------------------------------------------------------------------------
def cursor_up(wrap = false)
end
#--------------------------------------------------------------------------
# ● 프레임 갱신 ※재정의
#--------------------------------------------------------------------------
def update
super
update_cursor
call_update_help
end
end
#==============================================================================
# ■ Window_PartyCommand2
#------------------------------------------------------------------------------
# 배틀 화면에서, 싸울까 도망치는지를 선택하는 윈도우입니다.
#==============================================================================
class Window_PartyCommand2 < Window_Selectable
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
def initialize
super(0, 234, 544, 56)
@item_max = 2
@column_max = 2
self.contents.draw_text(32, 0, 96, WLH, "싸운다", 2)
self.contents.draw_text(310, 0, 96, WLH, "도망", 2) if $game_troop.can_escape
self.contents.font.color.alpha = 128
self.contents.draw_text(310, 0, 96, WLH, "도망", 2) if !$game_troop.can_escape
self.active = false
end
end
#==============================================================================
# ■ Window_MenuATB
#------------------------------------------------------------------------------
# 메뉴 화면에서 ATB 설정을 표시하는 윈도우입니다.
#==============================================================================
class Window_ATB_active < Window_Selectable
# 액티브 타임 배틀의 커스터마이즈 항목으로부터의 텍스트
ATB_MODE_NAME = N02::ATB_MODE_NAME
ATB_MODE1 = N02::ATB_MODE1[0]
ATB_MODE2 = N02::ATB_MODE2[0]
ATB_MODE3 = N02::ATB_MODE3[0]
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
def initialize
super(0, 174, 544, 56)
@item_max = 3
@column_max = 3
set_active
self.active = true
self.index = $game_party.atb_custom[0]
end
#--------------------------------------------------------------------------
# ● 액티브화
#--------------------------------------------------------------------------
def set_active
self.contents.clear
self.contents.font.size = 15
self.contents.font.color = crisis_color
self.contents.draw_text( 0, 0, 100, WLH, ATB_MODE_NAME, 0)
self.contents.draw_text( 0, 0, 100, WLH, ATB_MODE_NAME, 0)
self.contents.font.size = 20
self.contents.font.color = normal_color
refresh
end
#--------------------------------------------------------------------------
# ● 액티브 해제
#--------------------------------------------------------------------------
def non_active
self.contents.clear
self.contents.font.size = 15
self.contents.font.color = system_color
self.contents.draw_text( 0, 0, 100, WLH, ATB_MODE_NAME, 0)
self.contents.font.size = 20
self.contents.font.color = normal_color
refresh
end
#--------------------------------------------------------------------------
# ● 항목을 묘화 하는 구형의 취득
#--------------------------------------------------------------------------
def refresh
case $game_party.atb_custom[0]
when 0
self.contents.draw_text(100, 0, 140, WLH, ATB_MODE1, 1)
self.contents.font.color.alpha = 100
self.contents.draw_text(240, 0, 140, WLH, ATB_MODE2, 1)
self.contents.draw_text(380, 0, 140, WLH, ATB_MODE3, 1)
when 1
self.contents.font.color.alpha = 100
self.contents.draw_text(100, 0, 140, WLH, ATB_MODE1, 1)
self.contents.font.color = normal_color
self.contents.draw_text(240, 0, 140, WLH, ATB_MODE2, 1)
self.contents.font.color.alpha = 100
self.contents.draw_text(380, 0, 140, WLH, ATB_MODE3, 1)
when 2
self.contents.font.color.alpha = 100
self.contents.draw_text(100, 0, 140, WLH, ATB_MODE1, 1)
self.contents.draw_text(240, 0, 140, WLH, ATB_MODE2, 1)
self.contents.font.color = normal_color
self.contents.draw_text(380, 0, 140, WLH, ATB_MODE3, 1)
end
end
#--------------------------------------------------------------------------
# ● 항목을 묘화 하는 구형의 취득
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = 140
rect.height = 24
rect.x = index % @column_max * rect.width + 100
rect.y = index / @column_max * WLH
return rect
end
end
#==============================================================================
# ■ Window_MenuATB
#------------------------------------------------------------------------------
# 메뉴 화면에서 ATB 설정을 표시하는 윈도우입니다.
#==============================================================================
class Window_ATB_speed < Window_Selectable
# 액티브 타임 배틀의 커스터마이즈 항목으로부터의 텍스트
ATB_MODE_NAME = N02::ATB_SPEED_NAME
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
def initialize
super(0, 230, 544, 56)
@item_max = 9
@column_max = 9
non_active
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● 액티브화
#--------------------------------------------------------------------------
def set_active
self.contents.clear
self.contents.font.size = 15
self.contents.font.color = crisis_color
self.contents.draw_text( 0, 0, 140, WLH, ATB_MODE_NAME, 0)
self.contents.draw_text( 0, 0, 140, WLH, ATB_MODE_NAME, 0)
self.contents.font.size = 22
self.contents.font.color = normal_color
refresh
end
#--------------------------------------------------------------------------
# ● 액티브 해제
#--------------------------------------------------------------------------
def non_active
self.contents.clear
self.contents.font.size = 15
self.contents.font.color = system_color
self.contents.draw_text( 0, 0, 140, WLH, ATB_MODE_NAME, 0)
self.contents.font.size = 22
self.contents.font.color = normal_color
refresh
end
#--------------------------------------------------------------------------
# ● 항목을 묘화 하는 구형의 취득
#--------------------------------------------------------------------------
def refresh
self.contents.font.color.alpha = 96
self.contents.draw_text(94 + 38 * 0, 0, 140, WLH, "1", 1)
self.contents.draw_text(94 + 38 * 1, 0, 140, WLH, "2", 1)
self.contents.draw_text(94 + 38 * 2, 0, 140, WLH, "3", 1)
self.contents.draw_text(94 + 38 * 3, 0, 140, WLH, "4", 1)
self.contents.draw_text(94 + 38 * 4, 0, 140, WLH, "5", 1)
self.contents.draw_text(94 + 38 * 5, 0, 140, WLH, "6", 1)
self.contents.draw_text(94 + 38 * 6, 0, 140, WLH, "7", 1)
self.contents.draw_text(94 + 38 * 7, 0, 140, WLH, "8", 1)
self.contents.draw_text(94 + 38 * 8, 0, 140, WLH, "9", 1)
self.contents.font.color.alpha = 256
case $game_party.atb_custom[1]
when 0;self.contents.draw_text(94 + 38 * 0, 0, 140, WLH, "1", 1)
when 1;self.contents.draw_text(94 + 38 * 1, 0, 140, WLH, "2", 1)
when 2;self.contents.draw_text(94 + 38 * 2, 0, 140, WLH, "3", 1)
when 3;self.contents.draw_text(94 + 38 * 3, 0, 140, WLH, "4", 1)
when 4;self.contents.draw_text(94 + 38 * 4, 0, 140, WLH, "5", 1)
when 5;self.contents.draw_text(94 + 38 * 5, 0, 140, WLH, "6", 1)
when 6;self.contents.draw_text(94 + 38 * 6, 0, 140, WLH, "7", 1)
when 7;self.contents.draw_text(94 + 38 * 7, 0, 140, WLH, "8", 1)
when 8;self.contents.draw_text(94 + 38 * 8, 0, 140, WLH, "9", 1)
end
end
#--------------------------------------------------------------------------
# ● 항목을 묘화 하는 구형의 취득
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = 38
rect.height = 24
rect.x = index % @column_max * rect.width + 145
rect.y = index / @column_max * WLH
return rect
end
end
#==============================================================================
# ■ Window_ATB_Help
#------------------------------------------------------------------------------
# ATB 설정의 설명을 표시하는 윈도우입니다.
#==============================================================================
class Window_ATB_Help < Window_Base
# 액티브 타임 배틀의 커스터마이즈 항목으로부터의 텍스트
ATB_MODE_NAME = N02::ATB_MODE_NAME
ATB_MODE1 = N02::ATB_MODE1[0]
ATB_MODE2 = N02::ATB_MODE2[0]
ATB_MODE3 = N02::ATB_MODE3[0]
ATB_MODE1_HELP = N02::ATB_MODE1_HELP
ATB_MODE2_HELP = N02::ATB_MODE2_HELP
ATB_MODE3_HELP = N02::ATB_MODE3_HELP
ATB_SPEED_NAME = N02::ATB_SPEED_NAME
ATB_SPEED_HELP = N02::ATB_SPEED_HELP
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
def initialize
super(0, 56, 544, 96)
end
#--------------------------------------------------------------------------
# ● 텍스트 설정
#--------------------------------------------------------------------------
def set_text_active(index)
text1 = ATB_MODE_NAME + " ["
case index
when 0
text1 += ATB_MODE1 + "]"
text2 = ATB_MODE1_HELP
when 1
text1 += ATB_MODE2 + "]"
text2 = ATB_MODE2_HELP
when 2
text1 += ATB_MODE3 + "]"
text2 = ATB_MODE3_HELP
end
self.contents.clear
self.contents.font.color = crisis_color
self.contents.draw_text(4, 4, self.width - 40, WLH, text1, 0)
self.contents.font.color = normal_color
self.contents.draw_text(4, 34, self.width - 40, WLH, text2, 0)
end
#--------------------------------------------------------------------------
# ● 텍스트 설정
#--------------------------------------------------------------------------
def set_text_speed
text1 = ATB_SPEED_NAME
text2 = ATB_SPEED_HELP
self.contents.clear
self.contents.font.color = crisis_color
self.contents.draw_text(4, 4, self.width - 40, WLH, text1, 0)
self.contents.font.color = normal_color
self.contents.draw_text(4, 34, self.width - 40, WLH, text2, 0)
end
end
#==============================================================================
# ■ Window_ATB_Help
#------------------------------------------------------------------------------
# ATB 설정 타이틀·조작을 표시하는 윈도우입니다.
#==============================================================================
class Window_ATB_Title < Window_Base
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
def initialize
super(0, 0, 544, 56)
refresh
end
#--------------------------------------------------------------------------
# ● 텍스트 설정
#--------------------------------------------------------------------------
def refresh
text1 = N02::ATB_CUSTOMIZE_NAME
text2 = "Use the directional keys to select options."
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 96, WLH, text1, 0)
self.contents.font.color = normal_color
self.contents.draw_text(110, 0, 420, WLH, text2, 0)
end
end
#==============================================================================
# ■ Scene_ATB
#------------------------------------------------------------------------------
# ATB 설정을 실시하는 클래스입니다.
#==============================================================================
class Scene_ATB < Scene_Base
#--------------------------------------------------------------------------
# ● 개시 처리
#--------------------------------------------------------------------------
def start
super
create_menu_background
@title_window = Window_ATB_Title.new
@help_window = Window_ATB_Help.new
@active_window = Window_ATB_active.new
@speed_window = Window_ATB_speed.new
@help_window.set_text_active(@active_window.index)
@active_window_index = @active_window.index
@speed_window_index = $game_party.atb_custom[1]
end
#--------------------------------------------------------------------------
# ● 종료 처리
#--------------------------------------------------------------------------
def terminate
super
$game_party.atb_customize
dispose_menu_background
@title_window.dispose
@help_window.dispose
@active_window.dispose
@speed_window.dispose
end
#--------------------------------------------------------------------------
# ● 원래의 화면에 돌아온다
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(4)
end
#--------------------------------------------------------------------------
# ● 프레임 갱신
#--------------------------------------------------------------------------
def update
super
update_menu_background
@help_window.update
@active_window.update
@speed_window.update
if @active_window.active
update_active_selection
elsif @speed_window.active
update_speed_selection
end
end
#--------------------------------------------------------------------------
# ● 아이템 선택의 갱신
#--------------------------------------------------------------------------
def update_active_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
Sound.play_decision
$game_party.atb_custom[0] = @active_window.index
@active_window.set_active
elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
Sound.play_cursor
@speed_window.active = true
@speed_window.set_active
@speed_window.index = @speed_window_index
@active_window.active = false
@active_window.non_active
@active_window_index = @active_window.index
@active_window.index = -1
@help_window.set_text_speed
elsif Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
@help_window.set_text_active(@active_window.index)
end
end
#--------------------------------------------------------------------------
# ● 타겟 선택의 갱신
#--------------------------------------------------------------------------
def update_speed_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
Sound.play_decision
$game_party.atb_custom[1] = @speed_window.index
@speed_window.set_active
elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
Sound.play_cursor
@active_window.active = true
@active_window.set_active
@active_window.index = @active_window_index
@speed_window.active = false
@speed_window.non_active
@speed_window_index = @speed_window.index
@speed_window.index = -1
@help_window.set_text_active(@active_window.index)
end
end
end
#==============================================================================
# ■ Scene_File
#------------------------------------------------------------------------------
# 파일 화면의 처리를 실시하는 클래스입니다.
#==============================================================================
class Scene_File < Scene_Base
#--------------------------------------------------------------------------
# ● 원래의 화면에 돌아오는 ※재정의
#--------------------------------------------------------------------------
def return_scene
if @from_title
$scene = Scene_Title.new
elsif @from_event
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(5)
end
end
end
#==============================================================================
# ■ Scene_End
#------------------------------------------------------------------------------
# 게임 종료 화면의 처리를 실시하는 클래스입니다.
#==============================================================================
class Scene_End < Scene_Base
#--------------------------------------------------------------------------
# ● 원래의 화면에 돌아오는 ※재정의
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(6)
end
end
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
# 메뉴 화면의 처리를 실시하는 클래스입니다.
#==============================================================================
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# ● 커멘드 윈도우의 작성
#--------------------------------------------------------------------------
alias create_command_window_n02 create_command_window
def create_command_window
return create_command_window_n02 if !N02::ATB_CUSTOMIZE
s1 = Vocab::item
s2 = Vocab::skill
s3 = Vocab::equip
s4 = Vocab::status
s5 = N02::ATB_CUSTOMIZE_NAME
s6 = Vocab::save
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
if $game_party.members.size == 0 # 파티 인원수가 0 명의 경우
@command_window.draw_item(0, false) # 아이템을 무효화
@command_window.draw_item(1, false) # 스킬을 무효화
@command_window.draw_item(2, false) # 장비를 무효화
@command_window.draw_item(3, false) # 스테이터스를 무효화
end
if $game_system.save_disabled # 세이브 금지의 경우
@command_window.draw_item(5, false) # 세이브를 무효화
end
end
#--------------------------------------------------------------------------
# ● 커멘드 선택의 갱신
#--------------------------------------------------------------------------
alias update_command_selection_n02 update_command_selection
def update_command_selection
return update_command_selection_n02 if !N02::ATB_CUSTOMIZE
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.members.size == 0 and @command_window.index < 4
Sound.play_buzzer
return
elsif $game_system.save_disabled and @command_window.index == 5
Sound.play_buzzer
return
end
Sound.play_decision
case @command_window.index
when 0 # 아이템
$scene = Scene_Item.new
when 1,2,3 # 스킬, 장비, 스테이터스
start_actor_selection
when 4 # ATB 설정
$scene = Scene_ATB.new
when 5 # 세이브
$scene = Scene_File.new(true, false, false)
end
end
end
end
# ■ Scene_Battle for ATB Ver1.1
#------------------------------------------------------------------------------
# 배틀 화면의 처리를 실시하는 클래스입니다.
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 개시 처리
#--------------------------------------------------------------------------
alias start_n02 start
def start
$gauge_stop = true
$game_party.atb_customize
start_n02
end
#--------------------------------------------------------------------------
# ● 전투 개시의 처리
#--------------------------------------------------------------------------
alias process_battle_start_n02 process_battle_start
def process_battle_start
@end_member = 0
preemptive if $game_troop.preemptive
surprise if $game_troop.surprise
@status_window.visible = true
process_battle_start_n02
@status_window.refresh
$gauge_stop = false
end
#--------------------------------------------------------------------------
# ● 선제 처리
#--------------------------------------------------------------------------
def preemptive
$game_troop.preemptive = false
for member in $game_party.members + $game_troop.members
member.at_count = 1000 if member.actor?
member.at_count = N02::ATB_BACKATTACK * -10 if !member.actor?
end
end
#--------------------------------------------------------------------------
# ● 기습 처리
#--------------------------------------------------------------------------
def surprise
$game_troop.surprise = false
for member in $game_party.members + $game_troop.members
member.at_count = N02::ATB_BACKATTACK * -10 if member.actor?
member.at_count = 1000 if !member.actor?
end
end
#--------------------------------------------------------------------------
# ● 정보 표시 뷰포트의 해방
#--------------------------------------------------------------------------
alias dispose_info_viewport_n02 dispose_info_viewport
def dispose_info_viewport
dispose_info_viewport_n02
@cursor.dispose if @cursor != nil && !@cursor.disposed?
@help_window.dispose if @help_window != nil && !@help_window.disposed?
@help_window = nil
@help_window2.dispose if @help_window2 != nil && !@help_window2.disposed?
@help_window2 = nil
@skill_window.dispose if @skill_window != nil && !@skill_window.disposed?
@skill_window = nil
@item_window.dispose if @item_window != nil && !@item_window.disposed?
@skill_window = nil
end
#--------------------------------------------------------------------------
# ● 프레임 갱신 ※재정의
#--------------------------------------------------------------------------
def update
super
update_basic(true)
unless $game_message.visible # 메세지 표시중 이외
return if judge_win_loss if @judge == nil # 승패 판정
update_scene_change
process_battle_event # 배틀 이벤트의 처리
end
end
#--------------------------------------------------------------------------
# ● 기본 갱신 처리 ※재정의
#--------------------------------------------------------------------------
def update_basic(main = false)
Graphics.update unless main # 게임 화면을 갱신
Input.update unless main # 입력 정보를 갱신
$game_system.update # 타이머를 갱신
$game_troop.update # 적그룹을 갱신
@spriteset.update # 스프라이트 세트를 갱신
@message_window.update # 메세지 윈도우를 갱신
update_info_viewport if !$gauge_stop # 정보 표시 뷰포트를 갱신
# 커서 갱신
@cursor.update if @cursor != nil && @cursor.visible
# 메세지 표시중은 이 이후 처리시키지 않는다
if $game_message.visible
@spriteset.gauge_off
@info_viewport.visible = false
return @message_window.visible = true
end
return if $gauge_stop
# 전투 중단, 씬 변환때 이 이후는 처리시키지 않는다
return if @judge
return if $game_temp.next_scene != nil
# ATB를 갱신
update_atb
# 타겟 갱신
update_target if @target_members != nil
# 커멘드 입력 페이즈
start_actor_command_selection if @command_members.size != 0 && !@command_phase
if @skill_window != nil
update_skill_selection # 스킬 선택
elsif @item_window != nil
update_item_selection # 아이템 선택
elsif @party_command_window.visible && @party_command_window.active
update_party_command_selection # 파티 커멘드 선택
elsif @actor_command_window.active
update_actor_command_selection # 액터 커멘드 선택
end
end
#--------------------------------------------------------------------------
# ● ATB 갱신
#--------------------------------------------------------------------------
def update_atb
for member in $game_party.members + $game_troop.members
# ACT 갱신
return start_main(member) if member.act_active && !@action_battlers.include?(member) && !member.union_battler
# ATB 액터 갱신
if member.actor? && member.at_active && !@command_members.include?(member) && member.movable?
return start_auto_action(member) if member.auto_action?
return @command_members.push(member)
# ATB 에너미 갱신
elsif !member.actor? && member.at_active && !@command_members.include?(member) && member.movable?
return start_auto_action(member)
end
end
end
#--------------------------------------------------------------------------
# ● 자동 행동 개시
#--------------------------------------------------------------------------
def start_auto_action(member)
return if @judge
# 전투 행동의 작성
member.make_action if member.union_skill_id == 0
# 요금 설정
act_type = charge_set(member)
# 여러 차례 행동의 작성
member.act_time = member.action_time[0] if !member.actor?
# 행동 게이지로 전환해
@spriteset.change_act(act_type, member.actor?, member.index)
# 요금 액션
make_charge_action(member)
end
#--------------------------------------------------------------------------
# ● 요금 설정
#--------------------------------------------------------------------------
def charge_set(member)
act_type = member.charge
# 통상 공격(2 칼의 요금 시간은 쌍방 무기의 평균)
if member.actor? && member.action.attack? && member.weapon_id != 0
act_type = member.weapons[0].charge if member.weapons[0] != nil
act_type2 = member.weapons[1].charge if member.weapons[1] != nil
act_type[1] = (act_type[1] + act_type2[1]) / 2 if act_type2 != nil
elsif member.action.attack?
act_type = $data_weapons[member.weapon_id].charge if member.actor? && member.weapon_id != 0
act_type = $data_weapons[member.weapon].charge if !member.actor? && member.weapon != 0
end
act_type = $data_skills[member.action.skill_id].charge if member.action.skill?
act_type = $data_items[member.action.item_id].charge if member.action.item?
# 요금 보너스 가산
if member.actor?
act_type[1] += $data_weapons[member.weapon_id].charge_bonus if member.weapon_id != 0
for i in 0...member.armors.size
# 2 칼은 캔슬
next if member.two_swords_style && member.armors[0] != nil && member.armors[0]
act_type[1] += member.armors[i].charge_bonus if member.armors[i] != nil
end
end
return act_type
end
#--------------------------------------------------------------------------
# ● 전투 행동자의 준비 ※재정의
#--------------------------------------------------------------------------
def start_main(member)
return if @judge
@message_window.clear
@action_battlers.push(member)
process_battle_event
@status_window.refresh
member.charge_start = false
# 액티브 버틀러가 없으면 다음의 행동자를 세트
set_next_active_battler if @active_battler == nil
end
#--------------------------------------------------------------------------
# ● 헬프 윈도우의 표시 ※재정의
#--------------------------------------------------------------------------
def pop_help(obj)
return if @help_window == nil && obj.extension.include?("HELPHIDE")
return @help_window.visible = false if obj.extension.include?("HELPHIDE")
return if @skill_window != nil && @skill_window.visible
return if @item_window != nil && @item_window.visible
@help_window = Window_Help.new if @help_window == nil
@help_window.set_text(obj.name, 1)
@help_window.visible = true
end
#--------------------------------------------------------------------------
# ● 요금 액션 작성
#--------------------------------------------------------------------------
def make_charge_action(member)
action = ""
case member.action.kind
when 0
if member.actor?
action = member.charge[3] if member.weapon_id == 0
action = $data_weapons[member.weapon_id].charge[3] if member.weapon_id != 0
else
action = member.charge[3] if member.weapon == 0
action = $data_weapons[member.weapon].charge[3] if member.weapon != 0
end
when 1;action = member.action.skill.charge[3]
when 2;action = member.action.item.charge[3]
end
member.charge_action = action
return if action == ""
member.charge_start = true
@spriteset.set_action(member.actor?, member.index, member.charge_action)
end
#--------------------------------------------------------------------------
# ● 액션 실행중 ※재정의
#--------------------------------------------------------------------------
def playing_action
loop do
break if @judge
update_basic
# 액티브 버틀러에 격납되고 있는 액션 정보를 본다
action = @active_battler.play
next if action == 0
@active_battler.play = 0
if action[0] == "개별 처리"
individual
elsif action == "Can Collapse"
unimmortaling
elsif action == "Cancel Action"
break action_end
elsif action == "End"
break action_end
elsif action[0] == "OBJ_ANIM"
damage_action(action[1])
end
end
end
#--------------------------------------------------------------------------
# ● 전투 액션 실행
#--------------------------------------------------------------------------
def process_action
# 슬립 데미지
hp_slip_damage(@active_battler) if N02::ATB_SLIP_DAMAGE == 0
# 합체 공격 처리
union_possibility?
process_union_skill if @active_battler.union_skill_id != 0
return set_next_active_battler if @active_battler.union_battler
# 폭주 혼란 처리
@active_battler.action.prepare unless @active_battler.action.forcing
# 전투 행동 개시
$in_action = true
@message_window.clear
@active_battler.white_flash = true
# 헬프 윈도우 표시
help_on
# 전투 액션 실행
execute_action if @active_battler.action.valid?
# 헬프 윈도우 은폐
help_off
# 강제 행동등에서 버틀러가 비우면 다음의 행동자에게
return set_next_active_battler if @active_battler == nil
# 슬립 데미지
mp_slip_damage(@active_battler) if N02::ATB_SLIP_DAMAGE == 0
# 전투 액션 종료
@message_window.clear
@active_battler.white_flash = false
$in_action = false
@spriteset.gauge_update
# 합체 공격 종료 처리
end_union_skill if @active_battler.union_skill_id != 0
# 스킬 파생이 있는 경우, 행동 속행
return set_next_active_battler if @active_battler.derivation != 0 && !@forcing_battler
# 에너미의 여러 차례 행동
return set_next_active_battler if enemy_order
# 전투 행동 종료
turn_end(@active_battler)
# 다음의 행동자에게
@action_battlers.delete(@active_battler)
set_next_active_battler
end
#--------------------------------------------------------------------------
# ● 헬프 윈도우 표시
#--------------------------------------------------------------------------
def help_on
@help_window = Window_Help.new if @help_window == nil
@help_window.visible = false
return @help_window.visible = true if @skill_window != nil && @skill_window.visible
return @help_window.visible = true if @item_window != nil && @item_window.visible
return @help_window.visible = true if @active_battler.action.guard?
return @help_window.visible = true if @active_battler.action.kind == 0 && @active_battler.action.basic == 2
end
#--------------------------------------------------------------------------
# ● 헬프 윈도우 은폐
#--------------------------------------------------------------------------
def help_off
return if @help_window == nil
return @help_window.visible = true if @skill_window != nil && @skill_window.visible
return @help_window.visible = true if @item_window != nil && @item_window.visible
@help_window.visible = false
end
#--------------------------------------------------------------------------
# ● 액션 종료 ※재정의
#--------------------------------------------------------------------------
def action_end
# 초기화
@individual_target = nil
@active_battler.active = false
@active_battler.clear_action_results
# 만약을 위해 불사신화 해제
unimmortaling
# 반사되고 있었을 경우
if @active_battler.reflex != nil
if @active_battler.action.skill?
obj = @active_battler.action.skill
@active_battler.perfect_skill_effect(@active_battler, obj)
elsif @active_battler.action.item?
obj = @active_battler.action.item
@active_battler.item_effect(@active_battler, obj)
else
@active_battler.perfect_attack_effect(@active_battler)
end
pop_damage(@active_battler, obj, @active_battler.reflex)
@active_battler.perform_collapse
@active_battler.reflex = nil
wait(N01::COLLAPSE_WAIT)
end
# 역흡수로 전투 불능이 되었을 경우
if @absorb_dead
@active_battler.perform_collapse
@absorb_dead = false
wait(N01::COLLAPSE_WAIT)
end
# 다음의 행동까지 웨이트를 사이에 둔다
wait(N01::ACTION_WAIT)
end
#--------------------------------------------------------------------------
# ● 합체 공격 판정
#--------------------------------------------------------------------------
def union_skill?(member)
# 스킬에 합체 공격 설정이 있을까 체크
for union_action in member.action.skill.union_action
union_skills = union_action if union_action.size != 0 && union_action.include?(member.action.skill_id)
end
return if union_skills == nil
@partners = []
@union_targets = union_target_decision(member, member.action.skill)
@union_target_index = member.action.target_index
# 합체 공격 멤버가 사용 가능한가 체크
for skill_id in union_skills
for actor in $game_party.members
if actor.skill_can_use?($data_skills[skill_id]) && actor.skill_id_learn?(skill_id)
@partners.push(actor)
actor.union_skill_id = skill_id
end
end
end
# 합체 공격 사용 불가
if @partners.size != union_skills.size
for actor in @partners do actor.union_skill_id = 0 end
@partners = nil
member.action.clear if !member.action.guard?
return
end
# 합체 공격 사용가능
for actor in @partners
# 파트너 액션 결정
actor.action.kind = 1
actor.action.skill_id = actor.union_skill_id
actor.action.target_index = member.action.target_index
# 커멘드 강제 캔슬
if @command_members.include?(actor)
force_action_command_cansel(actor)
start_auto_action(member)
end
end
$in_union_action = true
@union_size = 0
end
#--------------------------------------------------------------------------
# ● 합체 공격 가능한가
#--------------------------------------------------------------------------
def union_possibility?
return if @partners == nil
for member in @partners
union_cansel = true unless member.inputable?
end
return if !union_cansel
end_union_skill
@active_battler.action.clear if !@active_battler.action.guard?
end
#--------------------------------------------------------------------------
# ● 합체 공격 타겟 결정
#--------------------------------------------------------------------------
def union_target_decision(member, obj)
targets = member.action.make_targets
# 디폴트의 여러 차례 공격이 설정되어 있으면 단체 타겟으로 변환
targets = [targets[0]] if obj.for_two? or obj.for_three? or obj.dual?
# 랜덤 타겟의 경우, 도대체를 선택해 랜덤 범위를 보관 유지
if obj.extension.include?("RANDOMTARGET")
randum_targets = targets.dup
targets = [randum_targets[rand(randum_targets.size)]]
end
# 타겟 정보를 버틀러 스프라이트에 보낸다
@spriteset.set_target(member.actor?, member.index, targets)
return targets
end
#--------------------------------------------------------------------------
# ● 합체 공격 처리
#--------------------------------------------------------------------------
def process_union_skill
@union_size += 1
if @union_size != @partners.size
return @active_battler.union_battler = true
end
# 합체 공격 스타트
@action_battlers.delete(@active_battler)
@active_battler.active = false
@active_battler = @partners.shift
@active_battler.act_active = true
@active_battler.active = true
@active_battler.union_battler = false
@active_battler.action.kind = 1
@active_battler.action.skill_id = @active_battler.union_skill_id
@active_battler.action.target_index = @union_target_index
for member in @partners
member.action.kind = 1
member.action.skill_id = member.union_skill_id
member.action.target_index = @union_target_index
member.force_target = ["N01target_change", @union_targets]
@spriteset.update_target(true, member.index)
# 액션 실행
@spriteset.set_action(true, member.index, member.action.skill.base_action)
end
end
#--------------------------------------------------------------------------
# ● 합체 공격 종료 처리
#--------------------------------------------------------------------------
def end_union_skill
@active_battler.union_skill_id = 0
@active_battler.union_battler = false
for member in @partners
member.union_skill_id = 0
member.union_battler = false
member.action.clear
@action_battlers.delete(member)
turn_end(member)
end
@union_size = 0
@partners = nil
$in_union_action = false
end
#--------------------------------------------------------------------------
# ● 에너미의 행동 회수 작성
#--------------------------------------------------------------------------
def enemy_order
return false if @active_battler.actor?
return false if @active_battler.act_time == 0 or !@active_battler.action.valid?
return true if rand(100) < @active_battler.action_time[1]
end
#--------------------------------------------------------------------------
# ● 턴 종료(경과) ※재정의
#--------------------------------------------------------------------------
def turn_end(member)
$in_action = false
# 액션 종료시의 ATB 게이지 설정
recharge_action(member)
member.action.clear if !member.action.guard?
# 턴 경과 카운트
@end_member += 1
passage = true if N02::ATB_TURN_COUNT == 2
if @end_member >= $game_party.members.size + $game_troop.members.size
passage = true if N02::ATB_TURN_COUNT == 0
passage = true if N02::ATB_TURN_COUNT == 1 && @end_member == 2
elsif @end_member == ($game_party.members.size + $game_troop.members.size) / 2
passage = true if N02::ATB_TURN_COUNT == 1
end
# 슬립 데미지
if @slip_all_damage
for battlers in $game_party.members + $game_troop.members do mp_slip_damage(battlers) end
@slip_all_damage = false
@slip_all_damaged = true
end
return if !passage
# 슬립 데미지
if N02::ATB_SLIP_DAMAGE == 1 && !@slip_all_damaged
for battlers in $game_party.members + $game_troop.members do hp_slip_damage(battlers) end
@slip_all_damage = true
end
@slip_all_damaged = false
@end_member = 0
$game_troop.increase_turn
$game_troop.turn_ending = true
process_battle_event
$game_troop.turn_ending = false
@status_window.refresh
end
#--------------------------------------------------------------------------
# ● 액션 종료시의 ATB 게이지 설정
#--------------------------------------------------------------------------
def recharge_action(member)
member.act_count = 0
recharge = member.recharge
# 통상 공격(2 칼의 요금 시간은 쌍방 무기의 평균)
if member.actor? && member.action.attack?
recharge = member.weapons[0].recharge if member.weapons[0] != nil
recharge2 = member.weapons[1].recharge if member.weapons[1] != nil
recharge = (recharge + recharge2) / 2 if recharge2 != nil
elsif member.action.attack?
act_type = $data_weapons[member.weapon].charge if member.weapon != 0
end
recharge = $data_skills[member.action.skill_id].recharge if member.action.skill?
recharge = $data_items[member.action.item_id].recharge if member.action.item?
recharge = N02::ATB_GUARD_RESET if member.action.guard?
# ATB 게이지로 전환해
@spriteset.change_atb(10 * recharge, member.actor?, member.index)
@spriteset.gauge_refresh(member.actor?, member.index)
end
#--------------------------------------------------------------------------
# ● 다음의 행동자에게
#--------------------------------------------------------------------------
def set_next_active_battler
return if $game_party.all_dead? or $game_troop.all_dead?
# 에너미 여러 차례 행동시
@action_battlers.shift if @active_battler != nil && !@active_battler.actor? && @active_battler.act_time != 0
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
@active_battler = @action_battlers.shift
end
@active_battler.action.clear if @active_battler != nil && @active_battler.dead?
return if @active_battler == nil
# 전투 행동 개시
return process_action if @active_battler.index != nil
end
end
#--------------------------------------------------------------------------
# ● 배틀 이벤트의 처리 ※재정의
#--------------------------------------------------------------------------
def process_battle_event
members_size = $game_party.members.size
loop do
return if judge_win_loss
return if $game_temp.next_scene != nil
$game_troop.interpreter.update
$game_troop.setup_battle_event
@message_window.update
if $game_message.visible
@message_window.visible = true
@status_window.visible = false
end
wait_for_message
@message_window.visible = false
@status_window.visible = true
reset_atb_actor if members_size != $game_party.members.size
if $game_troop.forcing_battler != nil
set_next_active_battler
end
return unless $game_troop.interpreter.running?
update_basic
end
end
#--------------------------------------------------------------------------
# ● HP슬립 데미지
#--------------------------------------------------------------------------
def hp_slip_damage(member)
member.clear_action_results
return if !member.exist? or member.states.size == 0
member.slip_damage = false
damage = 0
# 0 턴 해제의 스테이트가 있을까 체크
for state in member.states
member.remove_state(state.id) if state.extension.include?("ZEROTURNLIFT")
# 슬립 데미지 실행 state = [ 대상, 정수, 비율, POP, 전투 불능 허가]
next unless state.extension.include?("SLIPDAMAGE")
for ext in state.slip_extension
if ext[0] == "hp"
base_damage = ext[1] + member.maxhp * ext[2] / 100
damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
slip_pop = ext[3]
slip_dead = ext[4]
slip_damage_flug = true
member.slip_damage = true
end
end
end
# 디폴트의 슬립 데미지
if member.slip_damage? && member.exist? && !slip_damage_flug
damage += member.apply_variance(member.maxhp / 10, 10)
slip_dead = false
slip_pop = true
slip_damage_flug = true
member.slip_damage = true
end
# 방어구의 자동 회복이 있을까
damage -= member.maxhp / 20 if member.actor? && member.auto_hp_recover && member.exist?
# 전투 불능 불허가
damage = member.hp - 1 if damage >= member.hp && slip_dead = false
member.hp -= damage
@spriteset.set_damage_pop(member.actor?, member.index, damage) if slip_pop
member.perform_collapse if member.dead? && member.slip_damage
member.clear_action_results
@status_window.refresh
end
#--------------------------------------------------------------------------
# ● MP슬립 데미지
#--------------------------------------------------------------------------
def mp_slip_damage(member)
member.clear_action_results
return if !member.exist? or member.states.size == 0
member.slip_damage = false
mp_damage = 0
for state in member.states
next unless state.extension.include?("SLIPDAMAGE")
for ext in state.slip_extension
if ext[0] == "mp"
base_damage = ext[1] + member.maxmp * ext[2] / 100
mp_damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
slip_pop = ext[2]
slip_damage_flug = true
end
end
end
member.mp_damage = mp_damage
member.mp -= mp_damage
@spriteset.set_damage_pop(member.actor?, member.index, mp_damage) if slip_pop
member.clear_action_results
@status_window.refresh
end
#--------------------------------------------------------------------------
# ● 전투 행동의 실행 : 방어 ※재정의
#--------------------------------------------------------------------------
def execute_action_guard
@help_window.set_text("Guards", 1)
@help_window.visible = true
# 버틀러의 액티브화를 해제
@active_battler.active = false
wait(45)
@help_window.visible = false if @help_window != nil
end
#--------------------------------------------------------------------------
# ● 전투 행동의 실행 : 도주 ※재정의
#--------------------------------------------------------------------------
def execute_action_escape
@spriteset.set_action(false, @active_battler.index, @active_battler.run_success)
@help_window.set_text("Escaped", 1)
@help_window.visible = true
# 버틀러의 액티브화를 해제
@active_battler.active = false
@active_battler.escape
Sound.play_escape
wait(45)
@help_window.visible = false if @help_window != nil
end
#--------------------------------------------------------------------------
# ● 파티 커멘드 선택의 개시 ※재정의
#--------------------------------------------------------------------------
def start_party_command_selection
@info_viewport.visible = true
@status_window.index = @actor_index = -1
end
#--------------------------------------------------------------------------
# ● 다음의 액터의 커멘드 입력에 ※재정의
#--------------------------------------------------------------------------
def next_actor
end
#--------------------------------------------------------------------------
# ● 전의 액터의 커멘드 입력에 ※재정의
#--------------------------------------------------------------------------
def prior_actor
end
#--------------------------------------------------------------------------
# ● 액터 커멘드 선택의 개시 ※재정의
#--------------------------------------------------------------------------
def start_actor_command_selection
$in_command = true
@command_phase = true
@command_member_index = 0
@commander = @command_members[@command_member_index]
@status_window.active = true
@status_window.index = @commander.index
# 커서 세트
@cursor = Sprite_Cursor.new if @cursor == nil
@cursor.set(@commander)
# 움직일 수 있는 캐릭터만 커멘드 액션을
@spriteset.set_action(true, @commander.index,@commander.command_b) if @commander.inputable?
@party_command_window.active = false
@actor_command_window.setup(@commander)
@actor_command_window.active = true
@actor_command_window.index = 0
@actor_command_window_on = true
@status_window.refresh
end
#--------------------------------------------------------------------------
# ● 커멘드 갱신 ※재정의
#--------------------------------------------------------------------------
def update_actor_command_selection
# 커멘드 입력할 수 있는 상태가 아니게 되면 캔슬
return reset_command unless commanding?
if Input.trigger?(Input::B)
Input.update
Sound.play_decision
start_party_command
elsif Input.trigger?(Input::C)
Input.update
case @actor_command_window.index
when 0 # 공격
Sound.play_decision
@commander.action.set_attack
start_target_enemy_selection
when 1 # 스킬
Sound.play_decision
$in_select = true
start_skill_selection
when 2 # 방어
Sound.play_decision
@commander.action.set_guard
end_command
when 3 # 아이템
Sound.play_decision
$in_select = true
start_item_selection
end
# →키로 커멘드 캐릭터 보내
elsif Input.trigger?(Input::RIGHT)
next_commander
# ←키로 커멘드 캐릭터 반환
elsif Input.trigger?(Input::LEFT)
back_commander
end
end
#--------------------------------------------------------------------------
# ● 커멘드 입력할 수 있는 상태인가
#--------------------------------------------------------------------------
def commanding?
return false if @judge or $gauge_stop
return false if @commander != nil && !@commander.inputable?
return false if @commander != nil && @commander.union_skill_id != 0
return false if @commander != nil && @commander.at_count < 1000
return true
end
#--------------------------------------------------------------------------
# ● 커멘드 캐릭터 보내
#--------------------------------------------------------------------------
def next_commander
return if @command_members.size == 1 or @commander == nil
Audio.se_play("Audio/SE/" + N02::NEXT_SOUND01[2], N02::NEXT_SOUND01[1], N02::NEXT_SOUND01[0])
# 움직일 수 있는 캐릭터만 커멘드 귀가 액션을
@spriteset.set_action(true, @commander.index,@commander.command_a) if @commander.inputable?
# 커멘드 대기 멤버의 인덱스가 최후라면
if @command_member_index == @command_members.size - 1
@command_member_index = 0
# 다음의 캐릭터에게 커멘드를 보낸다
else
@command_member_index += 1
end
@commander = @command_members[@command_member_index]
@status_window.index = @commander.index
@actor_command_window.setup(@commander)
# 커서 세트
@cursor.set(@commander)
# 움직일 수 있는 캐릭터만 커멘드 액션을
@spriteset.set_action(true, @commander.index,@commander.command_b) if @commander.inputable?
end
#--------------------------------------------------------------------------
# ● 커멘드 캐릭터 반환
#--------------------------------------------------------------------------
def back_commander
return if @command_members.size == 1 or @commander == nil
Audio.se_play("Audio/SE/" + N02::NEXT_SOUND01[2], N02::NEXT_SOUND01[1], N02::NEXT_SOUND01[0])
# 움직일 수 있는 캐릭터만 커멘드 귀가 액션을
@spriteset.set_action(true, @commander.index,@commander.command_a) if @commander.inputable?
# 커멘드 대기 멤버의 인덱스가 최초라면
if @command_member_index == 0
@command_member_index = @command_members.size - 1
# 전의 캐릭터에게 커멘드를 보낸다
else
@command_member_index -= 1
end
@commander = @command_members[@command_member_index]
@status_window.index = @commander.index
# 커서 세트
@cursor.set(@commander)
# 움직일 수 있는 캐릭터만 커멘드 액션을
@spriteset.set_action(true, @commander.index,@commander.command_b) if @commander.inputable?
end
#--------------------------------------------------------------------------
# ● 파티 커멘드 선택의 개시
#--------------------------------------------------------------------------
def start_party_command
$in_party_command = true
$in_command = false
@status_window.refresh
@status_window.index = @actor_index = -1
@info_viewport.visible = true
@message_window.visible = false
@pre_a_index = @actor_command_window.index
@actor_command_window.active = false
@actor_command_window.index = -1
@party_command_window.active = true
@party_command_window.index = 0
@party_command_window.visible = true
end
#--------------------------------------------------------------------------
# ● 파티 커멘드 선택의 갱신
#--------------------------------------------------------------------------
def update_party_command_selection
# 커멘드 입력할 수 있는 상태가 아니게 되면 캔슬
return reset_command unless commanding?
if Input.trigger?(Input::C)
case @party_command_window.index
when 0 # 싸운다
Sound.play_decision
@status_window.index = @actor_index = -1
end_party_command
when 1 # 도망친다
return Sound.play_buzzer if $game_troop.can_escape == false
Sound.play_decision
end_party_command
process_escape if !@escape
end
elsif Input.trigger?(Input::B)
Sound.play_cancel
end_party_command
end
end
#--------------------------------------------------------------------------
# ● 파티 커멘드 선택의 종료
#--------------------------------------------------------------------------
def end_party_command
$in_party_command = false
$in_command = true
@status_window.refresh
@message_window.visible = false
@party_command_window.active = false
@actor_command_window.active = true
@party_command_window.visible = false
@actor_command_window.index = @pre_a_index
@status_window.index = @commander.index
@status_window.active = true
end
#--------------------------------------------------------------------------
# ● 도주의 처리 ※재정의
#--------------------------------------------------------------------------
def process_escape
@escape = true
closed_window
@info_viewport.visible = false
@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
for actor in $game_party.members
unless actor.restriction >= 4
@spriteset.set_action(true, actor.index,actor.run_success)
end
end
wait_for_message
@judge = true
$game_troop.clear_actions
$game_party.clear_actions
battle_end(1)
# 움직일 수 없는 액터를 제외하고 도주 실패 액션
else
for actor in $game_party.members
unless actor.restriction >= 4
@spriteset.set_action(true, actor.index,actor.run_ng)
end
end
@escape_ratio += 10
$game_message.texts.push('.' + Vocab::EscapeFailure)
wait_for_message
$game_party.clear_actions
end
reset_atb_actor
@info_viewport.visible = true
@escape = false
end
#--------------------------------------------------------------------------
# ● 액터의 ATB를 초기화
#--------------------------------------------------------------------------
def reset_atb_actor
@command_members = []
@commander = nil
$in_action = @command_phase = false
$in_command = $in_target = $in_select = false
@message_window.clear
for member in $game_party.members
@action_battlers.delete(member)
member.white_flash = false
member.action.clear
# ATB 게이지로 전환해
@spriteset.change_atb(N02::ATB_RUN_NG * -10, member.actor?, member.index)
end
end
#--------------------------------------------------------------------------
# ● 열려 있는 윈도우를 닫는다
#--------------------------------------------------------------------------
def closed_window
@cursor.dispose if @cursor != nil
@cursor = nil
@help_window.dispose if @help_window != nil
@help_window = nil
@help_window2.dispose if @help_window2 != nil
@help_window2 = nil
@skill_window.dispose if @skill_window != nil
@skill_window = nil
@item_window.dispose if @item_window != nil
@item_window = nil
@actor_command_window_on = false if @actor_command_window != nil
@actor_command_window.active = false if @actor_command_window != nil
@party_command_window.visible = false if @party_command_window != nil
@party_command_window.active = false if @party_command_window != nil
@status_window.index = @actor_index = @actor_command_window.index = -1
end
#--------------------------------------------------------------------------
# ● 타겟 선택의 개시 ※재정의
#--------------------------------------------------------------------------
def start_target_selection(actor = false)
$in_target = true
$in_command = $in_select = false
@target_actors = actor
@target_members = $game_party.members if @target_actors
@target_members = $game_troop.members unless @target_actors
# 불필요한 윈도우를 지운다
@actor_command_window.active = false
@skill_window.visible = false if @skill_window != nil
@item_window.visible = false if @item_window != nil
# 존재하고 있는 타겟으로 가장 번호의 낮은 대상을 최초로 가리키도록(듯이)
@index = 0
@max_index = @target_members.size - 1
# 액터는 전투 불능자라도 타겟 할 수 있도록(듯이) 에너미와 구별
unless @target_actors
@target_members.size.times do
break if @target_members[@index].exist?
@index += 1
end
end
# 커서 세트
@cursor.set(@target_members[@index])
@help_window.visible = false if @help_window != nil
@help_window2 = Window_Help.new if @help_window2 == nil
@help_window2.set_text_n02add(@target_members[@index])
end
#--------------------------------------------------------------------------
# ● 타겟 선택 갱신 ※재정의
#--------------------------------------------------------------------------
def update_target
# 커멘드 입력할 수 있는 상태가 아니게 되면 캔슬
return reset_command unless commanding?
return end_target_selection(cansel = true) if $game_troop.all_dead?
cursor_down if !@target_members[@index].actor? && !@target_members[@index].exist?
if Input.trigger?(Input::B)
Input.update
Sound.play_cancel
end_target_selection(cansel = true)
elsif Input.trigger?(Input::C)
Input.update
Sound.play_decision
@commander.action.target_index = @index
end_target_selection
end_skill_selection
end_item_selection
@actor_command_window.active = false
next_actor
end
if Input.repeat?(Input::LEFT)
if @target_actors
cursor_down if $back_attack
cursor_up unless $back_attack
else
cursor_up if $back_attack
cursor_down unless $back_attack
end
end
if Input.repeat?(Input::RIGHT)
if @target_actors
cursor_up if $back_attack
cursor_down unless $back_attack
else
cursor_down if $back_attack
cursor_up unless $back_attack
end
end
cursor_up if Input.repeat?(Input::UP)
cursor_down if Input.repeat?(Input::DOWN)
end
#--------------------------------------------------------------------------
# ● 커서를 앞에 두고 이동 ※재정의
#--------------------------------------------------------------------------
def cursor_up
Sound.play_cursor
@target_members.size.times do
@index += @target_members.size - 1
@index %= @target_members.size
break if @target_actors
break if @target_members[@index].exist?
end
# 커서 세트
@cursor.set(@target_members[@index])
@help_window2.set_text_n02add(@target_members[@index]) if @help_window2 != nil
end
#--------------------------------------------------------------------------
# ● 커서를 다음에 이동 ※재정의
#--------------------------------------------------------------------------
def cursor_down
Sound.play_cursor
@target_members.size.times do
@index += 1
@index %= @target_members.size
break if @target_actors
break if @target_members[@index].exist?
end
# 커서 세트
@cursor.set(@target_members[@index])
@help_window2.set_text_n02add(@target_members[@index]) if @help_window2 != nil
end
#--------------------------------------------------------------------------
# ● 타겟 선택의 종료재정의
#--------------------------------------------------------------------------
def end_target_selection(cansel = false)
$in_target = false
@help_window2.dispose if @help_window2 != nil
@help_window2 = nil
@help_window.visible = false if @help_window != nil
if @skill_window != nil
@skill_window.visible = @skill_window.active = true
@help_window.visible = true if @help_window != nil
@actor_command_window.active = false if cansel
$in_select = true if cansel
elsif @item_window != nil
@item_window.visible = @item_window.active = true
@help_window.visible = true if @help_window != nil
@actor_command_window.active = false if cansel
$in_select = true if cansel
end
@target_members = nil
end_command if !cansel
# 커서 세트
@cursor.set(@commander) if cansel
$in_command = true if cansel && @actor_command_window.index == 0
@actor_command_window.active = true if cansel && @actor_command_window.index == 0
end
#--------------------------------------------------------------------------
# ● 커멘드 초기화
#--------------------------------------------------------------------------
def reset_command
@message_window.visible = false
@party_command_window.active = false
@commander.action.clear
@party_command_window.visible = false
$in_command = $in_select = $in_target = false
@target_members = nil
@actor_command_window.active = false
@cursor.visible = false
@command_phase = false
end_skill_selection
end_item_selection
@party_command_window.active = @actor_command_window.active = false
@actor_command_window_on = false
@status_window.index = @actor_index = @actor_command_window.index = -1
@command_members.delete(@commander)
@commander = nil
end
#--------------------------------------------------------------------------
# ● 강제 행동에 의한 커멘드 캔슬
#--------------------------------------------------------------------------
def force_action_command_cansel(member)
return if !member.inputable?
# 요금 설정
act_type = charge_set(member)
# 행동 게이지로 전환해
@spriteset.change_act(act_type, member.actor?, member.index)
# 움직일 수 있는 캐릭터만 커멘드 귀가 액션을
@spriteset.set_action(true, member.index,member.command_a) if member.actor? && member.inputable?
# 요금 액션
make_charge_action(member)
# 이하의 처리는 커멘드 입력중의 액터 한정
return if !member.actor? or @commander != member
# 커서 소거
@cursor.visible = false
@command_phase = false
# 윈도우 초기화
end_skill_selection
end_item_selection
$in_target = false
@help_window2.dispose if @help_window2 != nil
@help_window2 = nil
@help_window.visible = false if @help_window != nil
@party_command_window.active = @actor_command_window.active = false
@actor_command_window_on = false
@status_window.index = @actor_index = @actor_command_window.index = -1
@command_members.delete(member)
@commander = nil
@message_window.visible = false
@party_command_window.active = false
@party_command_window.visible = false
$in_command = $in_select = $in_target = false
@target_members = nil
end
#--------------------------------------------------------------------------
# ● 커멘드 입력 종료
#--------------------------------------------------------------------------
def end_command
return if !@commander.inputable?
$in_command = false
$in_select = false
# 커서 소거
@cursor.visible = false
@command_phase = false
# 액션 실행 시간 체크
act_type = charge_set(@commander)
# 행동 게이지로 전환해
@spriteset.change_act(act_type, true, @commander.index)
# 움직일 수 있는 캐릭터만 커멘드 귀가 액션을
@spriteset.set_action(true, @commander.index,@commander.command_a) if @commander.inputable?
# 요금 액션
make_charge_action(@commander)
# 합체 공격 체크
union_skill?(@commander) if @commander.action.skill? && @partners == nil
# 윈도우 초기화
@party_command_window.active = @actor_command_window.active = false
@actor_command_window_on = false
@status_window.index = @actor_index = @actor_command_window.index = -1
@command_members.delete(@commander)
@commander = nil
end
#--------------------------------------------------------------------------
# ● 정보 표시 뷰포트의 작성 ※재정의
#--------------------------------------------------------------------------
def create_info_viewport
@command_members = []
@action_battlers = []
@info_viewport = Viewport.new(0, 288, 544, 128)
@info_viewport.z = 100
@status_window = Window_BattleStatus.new
@party_command_window = Window_PartyCommand2.new
@actor_command_window = Window_ActorCommand.new
@status_window.viewport = @info_viewport
@actor_command_window.viewport = @info_viewport
@status_window.x = 128
@actor_command_window.x = 672
@info_viewport.visible = false
@party_command_window.visible = false
@info_viewport.ox = 128
end
#--------------------------------------------------------------------------
# ● 정보 표시 뷰포트의 갱신 ※재정의
#--------------------------------------------------------------------------
def update_info_viewport
@party_command_window.update if @party_command_window.active
@actor_command_window.update if @actor_command_window.active
@status_window.update if @status_window.active
@message_window.visible = false if !$game_message.visible
@info_viewport.visible = true if !@message_window.visible
@actor_command_window.x += 32 if @actor_command_window.x < 672 && !@actor_command_window_on
@actor_command_window.x -= 32 if @actor_command_window.x > 544 && @actor_command_window_on
end
#--------------------------------------------------------------------------
# ● 스킬 선택의 개시 ※재정의
#--------------------------------------------------------------------------
def start_skill_selection
@help_window = Window_Help.new if @help_window == nil
@help_window.visible = true
@skill_window = Window_Skill.new(0, 56, 544, 232, @commander)
@skill_window.z = 1000
@skill_window.help_window = @help_window
@actor_command_window.active = false
end
#--------------------------------------------------------------------------
# ● 스킬 선택의 갱신 ※재정의
#--------------------------------------------------------------------------
def update_skill_selection
# 커멘드 입력할 수 있는 상태가 아니게 되면 캔슬
return reset_command unless commanding?
@skill_window.active = true
@skill_window.update
@help_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
end_skill_selection
$in_command = true
elsif Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill != nil
@commander.last_skill_id = @skill.id
end
if @commander.skill_can_use?(@skill)
return Sound.play_buzzer if @commander.union_skill?(@skill.id) && !@commander.union_skill_can_use?(@skill.id)
Sound.play_decision
determine_skill
else
Sound.play_buzzer
end
end
end
#--------------------------------------------------------------------------
# ● 스킬의 결정 ※재정의
#--------------------------------------------------------------------------
def determine_skill
@commander.action.set_skill(@skill.id)
@skill_window.active = false
if @skill.need_selection?
if @skill.for_opponent?
start_target_enemy_selection
else
start_target_actor_selection
end
else
end_skill_selection
end_target_selection
end
end
#--------------------------------------------------------------------------
# ● 스킬 선택의 종료
#--------------------------------------------------------------------------
alias end_skill_selection_n01 end_skill_selection
def end_skill_selection
end_skill_selection_n01
$in_select = false
end
#--------------------------------------------------------------------------
# ● 아이템 선택의 개시 ※재정의
#--------------------------------------------------------------------------
def start_item_selection
@help_window = Window_Help.new if @help_window == nil
@help_window.visible = true
@item_window = Window_Item.new(0, 56, 544, 232)
@item_window.z = 1000
@item_window.help_window = @help_window
@actor_command_window.active = false
end
#--------------------------------------------------------------------------
# ● 아이템 선택의 갱신 ※재정의
#--------------------------------------------------------------------------
def update_item_selection
# 커멘드 입력할 수 있는 상태가 아니게 되면 캔슬
return reset_command unless commanding?
@item_window.active = true
@item_window.update
@help_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
end_item_selection
$in_select = true
elsif Input.trigger?(Input::C)
@item = @item_window.item
if @item != nil
$game_party.last_item_id = @item.id
end
if $game_party.item_can_use?(@item)
Sound.play_decision
determine_item
else
Sound.play_buzzer
end
end
end
#--------------------------------------------------------------------------
# ● 아이템의 결정 ※재정의
#--------------------------------------------------------------------------
def determine_item
@commander.action.set_item(@item.id)
@item_window.active = false
if @item.need_selection?
if @item.for_opponent?
start_target_enemy_selection
else
start_target_actor_selection
end
else
end_item_selection
end_target_selection
end
end
#--------------------------------------------------------------------------
# ● 아이템 선택의 종료
#--------------------------------------------------------------------------
alias end_item_selection_n01 end_item_selection
def end_item_selection
end_item_selection_n01
$in_select = false
end
#--------------------------------------------------------------------------
# ● 승패 판정 ※재정의
#--------------------------------------------------------------------------
def judge_win_loss
return true unless $game_temp.in_battle
if $game_party.all_dead?
@judge = true
$gauge_stop = true
closed_window
@spriteset.atb_dispose
$game_troop.clear_actions
$game_party.clear_actions
process_defeat
return true
elsif $game_troop.all_dead?
@judge = true
$gauge_stop = true
closed_window
@spriteset.atb_dispose
$game_troop.clear_actions
$game_party.clear_actions
process_victory
return true
else
return false
end
end
end
#==============================================================================
# ■ Game_Battler (분할 정의 1)
#------------------------------------------------------------------------------
# 버틀러를 취급하는 클래스입니다.
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 공개 인스턴스 변수
#--------------------------------------------------------------------------
attr_accessor :at_count # 커멘드 대기 게이지(1000이 MAX)
attr_accessor :at_active # 커멘드 입력 가능
attr_accessor :atb_count_up # ATB 카운트업중
attr_accessor :act_count # 행동 대기 게이지(1000이 MAX)
attr_accessor :act_active # 행동 가능
attr_accessor :at_speed # 게이지 업 스피드 기준치
attr_accessor :charge_action # 요금 액션
attr_accessor :charge_start # 요금중인가
attr_accessor :union_skill_id # 합체 공격 스킬 ID
attr_accessor :union_battler # 합체 공격 참가자인가
attr_accessor :speed_level # 전투 참가자의 최고 속도 스피드 기준
attr_accessor :low_speed_level # 전투 참가자의 최지스피드 기준
attr_accessor :graphics_width # 버틀러 화상 1 셀 근처의 가로폭
attr_accessor :graphics_height # 버틀러 화상 1 셀 근처의 세로폭
#--------------------------------------------------------------------------
# ● 스테이트의 부가 ATB 데미지 처리를 추가
#--------------------------------------------------------------------------
alias add_state_n02 add_state
def add_state(state_id)
add_state_n02(state_id)
if $data_states[state_id].atb_damage != 0
@at_count = @at_count + $data_states[state_id].atb_damage * 10
@at_count = 0 if @at_count < 0 && !$data_states[state_id].atb_minus_damage
@at_count = 1000 if @at_count > 1000
# ATB 데미지로 요금 캔슬
if $data_states[state_id].atb_damage < 0
@act_count = 0
@act_active = false
@at_active = false
@atb_count_up = true
end
end
end
#--------------------------------------------------------------------------
# ● 전투 개시시의 AT설정
#--------------------------------------------------------------------------
def atb_setting
# 초기화
@at_count = @act_count = @speed_level = @low_speed_level = @union_skill_id = 0
@at_active = @act_active = @atb_count_up = @charge_start = @union_battler = false
$in_party_command = $in_command = $in_target = $in_select = $in_action = false
@charge_action = normal
$in_union_action = false
# 게이지 업 스피드(전투 속도)
@at_speed = $game_party.atb_control[1]
# 유저 설정을 사용하지 않는 경우
return if N02::ATB_CUSTOMIZE
@at_speed = N02::ATB_SPEED
end
#--------------------------------------------------------------------------
# ● ATB 스피드 기준치 리프레쉬
#--------------------------------------------------------------------------
def atb_base_speed_refresh
battle_members = $game_party.members + $game_troop.members
battle_members.sort! do |a,b|
b.agi - a.agi
end
self.speed_level = battle_members[0].agi
self.low_speed_level = battle_members[battle_members.size - 1].agi
end
#--------------------------------------------------------------------------
# ● 자동 행동 판정
#--------------------------------------------------------------------------
def auto_action?
return true if berserker? or confusion? or auto_battle or @union_skill_id != 0
return false
end
#--------------------------------------------------------------------------
# ● 합체 공격 스킬 판정
#--------------------------------------------------------------------------
def union_skill?(skill_id)
# 스킬에 합체 공격 설정이 있을까 체크
for union_action in $data_skills[skill_id].union_action
union_skills = union_action if union_action.size != 0 && union_action.include?(skill_id)
end
return false if union_skills == nil
return true
end
#--------------------------------------------------------------------------
# ● 합체 공격 사용 가능 판정
#--------------------------------------------------------------------------
def union_skill_can_use?(skill_id)
return false if $in_union_action
for union_action in $data_skills[skill_id].union_action
union_skills = union_action if union_action.size != 0 && union_action.include?(skill_id)
end
return false if union_skills == nil
partners = []
# 합체 공격 멤버가 사용 가능한가 체크
for skill_id in union_skills
for actor in $game_party.members
if actor.skill_can_use?($data_skills[skill_id]) && actor.skill_id_learn?(skill_id)
partners.push(actor)
end
end
end
return false if partners.size != union_skills.size
return true
end
end
#==============================================================================
# ■ Game_Party
#------------------------------------------------------------------------------
# 파티를 취급하는 클래스입니다.
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● 공개 인스턴스 변수
#--------------------------------------------------------------------------
attr_accessor :atb_custom # ATB 유저 설정
attr_accessor :atb_control # ATB 설정
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
alias initialize_n02 initialize
def initialize
initialize_n02
@atb_control = []
@atb_custom = [N02::ATB_NEWGAME_MODE, N02::ATB_NEWGAME_SPEED - 1]
end
#--------------------------------------------------------------------------
# ● 유저 설정을 ATB 설정에 반영
#--------------------------------------------------------------------------
def atb_customize
# 웨이트·액티브 설정을 격납
case @atb_custom[0]
when 0;@atb_control[0] = N02::ATB_MODE1
when 1;@atb_control[0] = N02::ATB_MODE2
when 2;@atb_control[0] = N02::ATB_MODE3
end
# 전투 속도를 격납
@atb_control[1] = N02::ATB_SPEED_MODE[@atb_custom[1]]
# 유저 설정을 사용하지 않는 경우
return if N02::ATB_CUSTOMIZE
@atb_control[0] = ["",N02::ATB_PARTY_COMMAND_WAIT, N02::ATB_COMMAND_WAIT, N02::ATB_TARGET_WAIT, N02::ATB_SELECT_WAIT, N02::ATB_ACTION_WAIT]
@atb_control[1] = N02::ATB_SPEED
end
end
#==============================================================================
# ■ Sprite_MoveAnime
#------------------------------------------------------------------------------
# ATB 게이지용의 스프라이트입니다.
#==============================================================================
class Sprite_ATB < Sprite_Base
#--------------------------------------------------------------------------
# ● 공개 인스턴스 변수
#--------------------------------------------------------------------------
attr_accessor :battler
attr_accessor :count # 갱신 카운트
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
def initialize(viewport,battler = nil)
super(viewport)
@battler = battler
@count = 0
@base_atb_count = 1
@restriction_count = 0
@state_freeze = false
@update = 0
@pre_width = 0
make_gauge
start_atb
@party_command_wait = $game_party.atb_control[0][1]
@command_wait = $game_party.atb_control[0][2]
@target_wait = $game_party.atb_control[0][3]
@select_wait = $game_party.atb_control[0][4]
@action_wait = $game_party.atb_control[0][5]
end
#--------------------------------------------------------------------------
# ● ATB 초기치 세팅
#--------------------------------------------------------------------------
def start_atb
atb = battler.atb_base * 10 + rand(N02::ATB_BASE_ADD) * 10
if battler.actor?
atb1 = battler.weapons[0].atb_base * 10 if battler.weapons[0] != nil
atb2 = battler.weapons[1].atb_base * 10 if battler.weapons[1] != nil
atb1 = atb if atb1 == nil
atb2 = atb1 if atb2 == nil
atb += (atb1 + atb2) / 2
for i in 0...battler.armors.size
# 2 칼은 캔슬
next if battler.two_swords_style && battler.armors[0] != nil && battler.armors[0]
atb += battler.armors[i].atb_base * 10 if battler.armors[i] != nil
end
end
change_atb(atb)
end
#--------------------------------------------------------------------------
# ● 게이지 작성
#--------------------------------------------------------------------------
def make_gauge
self.bitmap = Cache.system("atb_bar_skin")
@gauge = Sprite.new(viewport)
@gauge.bitmap = Cache.system("atb_bar")
@gauge_max = Sprite.new(viewport)
@gauge_max.bitmap = Cache.system("atb_bar_active")
@gauge_max.visible = false
@gauge_division = 1000 / N02::ATB_WIDTH
@gauge_space = N02::ATB_SPACE
end
#--------------------------------------------------------------------------
# ● 좌표 세트
#--------------------------------------------------------------------------
def set(x, y)
self.ox = @gauge.ox = @gauge_max.ox = self.bitmap.width / 2
self.oy = @gauge.oy = @gauge_max.oy = self.bitmap.height / 2
self.visible = @gauge.visible = @gauge_max.visible = false
if @battler.actor? && N02::ATB_POSITION_HPWINDOW
self.z = @gauge.z = @gauge_max.z = 1000
self.x = @gauge.x = @gauge_max.x = N02::ATB_PARTY_POSITION[@battler.index][0]
self.y = @gauge.y = @gauge_max.y = N02::ATB_PARTY_POSITION[@battler.index][1]
return
end
adjust = N02::ATB_POSITION_ENEMY
adjust = N02::ATB_POSITION_ACTOR if battler.actor?
self.x = @gauge.x = @gauge_max.x = x + adjust[0]
self.x = @gauge.x = @gauge_max.x = x - adjust[0] if $back_attack
self.y = @gauge.y = @gauge_max.y = y + adjust[1]
self.z = @gauge.z = @gauge_max.z = battler.position_z + 10
@gauge_max.z += 1
end
#--------------------------------------------------------------------------
# ● ATB 게이지 변환
#--------------------------------------------------------------------------
def change_atb(restart_gauge = 0)
@battler.atb_base_speed_refresh
case N02::ATB_BASE_SPEED
when 0
return @base_atb_count = @battler.at_speed * battler.agi if N02::ATB_ABSOLUTE_SPEED == 0
@base_atb_count = @battler.at_speed * battler.agi / N02::ATB_ABSOLUTE_SPEED
when 1
return @base_atb_count = @battler.at_speed * battler.agi if @battler.speed_level == 0
@base_atb_count = @battler.at_speed * battler.agi / @battler.speed_level
when 2
return @base_atb_count = @battler.at_speed * @battler.agi if @battler.low_speed_level == 0
@base_atb_count = @battler.at_speed * @battler.agi / @battler.low_speed_level
when 3
return @base_atb_count = @battler.at_speed * @battler.agi if @battler.speed_level / 2 + @battler.low_speed_level / 2 == 0
@base_atb_count = @battler.at_speed * @battler.agi / (@battler.speed_level / 2 + @battler.low_speed_level / 2)
end
@base_atb_count = 1 if @base_atb_count == 0
@battler.at_count = restart_gauge
@battler.act_count = 0
@gauge.bitmap = Cache.system("atb_bar")
@battler.act_active = false
@battler.at_active = false
@battler.atb_count_up = true
end
#--------------------------------------------------------------------------
# ● ACT 게이지 변환
#--------------------------------------------------------------------------
def change_act(act_type)
change_atb
case act_type[0]
when 0
base = @battler.at_speed * @battler.agi
base = @battler.at_speed * @battler.agi / act_type[2] if act_type[2] != 0
when 1
base = @battler.at_speed * @battler.agi / @battler.speed_level
when 2
base = @battler.at_speed * @battler.agi if @battler.low_speed_level == 0
base = @battler.at_speed * @battler.agi / @battler.low_speed_level
when 3
base = @battler.at_speed * @battler.agi if @battler.speed_level / 2 + @battler.low_speed_level / 2 == 0
base = @battler.at_speed * @battler.agi / (@battler.speed_level / 2 + @battler.low_speed_level / 2)
when 4
base = @battler.at_speed
end
if act_type[1] <= 0
@base_act_count = 1000
else
@base_act_count = base * 100 / act_type[1]
end
@base_act_count = 1 if @base_act_count == 0
@battler.act_count = 0
@gauge.bitmap = Cache.system("act_bar")
@battler.atb_count_up = false
@battler.at_active = false
end
#--------------------------------------------------------------------------
# ● 프레임 갱신
#--------------------------------------------------------------------------
def update
# 스테이트 관리
states_control
# 강제 게이지 스톱
return if $gauge_stop or !@battler.exist? or $game_message.visible
# 액션 웨이트
wait = true if $in_action && !@action_wait
wait = false if $in_action && @action_wait
# 파티 커멘드 선택중 웨이트
wait = true if $in_party_command && !@party_command_wait
wait = false if $in_party_command && @party_command_wait
# 전투 커멘드 선택중 웨이트
wait = true if $in_command && !@command_wait
wait = false if $in_command && @command_wait
# 타겟 선택중 웨이트
wait = true if $in_target && !@target_wait
wait = false if $in_target && @target_wait
# 스킬/아이템 선택중 웨이트
wait = true if $in_select && !@select_wait
wait = false if $in_select && @select_wait
# 액션중은 게이지를 지울까
self.visible = @gauge.visible = true
self.visible = @gauge_max.visible = @gauge.visible = false if @battler.act_active && N02::ATB_ACTION_ENEMY_OFF && !@battler.actor? && @battler.union_skill_id == 0
self.visible = @gauge_max.visible = @gauge.visible = false if @battler.act_active && N02::ATB_ACTION_ACTOR_OFF && @battler.actor? && @battler.union_skill_id == 0
# 게이지 표시 설정
self.visible = @gauge.visible = @gauge_max.visible = false if !@battler.atb_on
self.visible = @gauge.visible = @gauge_max.visible = false if @battler.actor? && $game_message.visible && N02::ATB_POSITION_HPWINDOW
# 안보이는 에너미는 게이지 은폐
self.visible = @gauge.visible = @gauge_max.visible = false if !@battler.actor? && !@battler.exist?
# 버튼 입력에 의한 게이지 제어
wait = true if Input.press?(Input::ALT) && N02::ATB_ALT_WAIT
wait = false if Input.press?(Input::CTRL) && N02::ATB_CTRL_ACTIVE
# 자신만 액션 웨이트
wait = true if @battler.act_active
# 게이지 웨이트
return if wait
# 스테이트에 의한 게이지 스톱 처리
return recover_states_freeze if @state_freeze
# 게이지 카운트업
gauge_update
# 게이지 묘화
return if @pre_width == @gauge_space + @battler.act_count / @gauge_division && !@battler.atb_count_up
return if @pre_width == @gauge_space + @battler.at_count / @gauge_division && @battler.atb_count_up
gauge_refresh
end
#--------------------------------------------------------------------------
# ● 게이지 카운트업
#--------------------------------------------------------------------------
def gauge_update
# ACT 카운트업
act if !@battler.atb_count_up && !@battler.at_active && !@battler.act_active
# ATB 카운트업
atb if @battler.atb_count_up
end
#--------------------------------------------------------------------------
# ● 게이지 리프레쉬
#--------------------------------------------------------------------------
def gauge_refresh
@gauge_max.visible = false if !@battler.act_active && !@battler.at_active
@gauge.src_rect.width = @pre_width = @gauge_space + @battler.act_count / @gauge_division if !@battler.atb_count_up && !@battler.at_active && !@battler.act_active
@gauge.src_rect.width = @pre_width = @gauge_space + @battler.at_count / @gauge_division if @battler.atb_count_up
end
#--------------------------------------------------------------------------
# ● 게이지 은폐
#--------------------------------------------------------------------------
def off
self.visible = @gauge.visible = @gauge_max.visible = false
end
#--------------------------------------------------------------------------
# ● 게이지 표시
#--------------------------------------------------------------------------
def on
self.visible = @gauge.visible = @gauge_max.visible = true
gauge_refresh
end
#--------------------------------------------------------------------------
# ● 스테이트 관리
#--------------------------------------------------------------------------
def states_control
if !@state_freeze && !@battler.movable?
# 행동 불능은 게이지를 0에
@restriction_count = @battler.at_count
@state_freeze = true
@atb_dead = true if @battler.dead? && !@atb_dead
change_atb(0)
gauge_refresh
self.visible = @gauge_max.visible = @gauge.visible = false if !@battler.actor? && !@battler.exist?
# 스테이트 복귀시
elsif @battler.movable? && @state_freeze
@state_freeze = false
# 전투 불능 복귀시의 게이지 처리
return if !@atb_dead
change_atb(N02::ATB_DEAD_COUNT * 10)
@atb_dead = false
gauge_refresh
end
end
#--------------------------------------------------------------------------
# ● 스테이트에 의한 게이지 스톱 회복
#--------------------------------------------------------------------------
def recover_states_freeze
@restriction_count += @base_atb_count
@restriction_count += @base_atb_count * 2 if Input.press?(Input::SHIFT) && N02::ATB_SHIFT_BOOST
if @restriction_count >= 1000
# 스테이트 자연 회복 허가
@battler.remove_states_auto
@restriction_count = 0
end
end
#--------------------------------------------------------------------------
# ● ATB 카운트
#--------------------------------------------------------------------------
def atb
if @battler.at_count <= 1000
@gauge_max.visible = false
@battler.at_count += @base_atb_count
@battler.at_count += @base_atb_count * 2 if Input.press?(Input::SHIFT) && N02::ATB_SHIFT_BOOST
end
# ATB 게이지 MAX
if @battler.at_count >= 1000
# 스테이트 자연 회복
@battler.remove_states_auto
@battler.atb_count_up = false
@battler.at_active = true
@gauge.src_rect.width = 52
return if !@battler.atb_on
Audio.se_play("Audio/SE/" + N02::ATB_MAX_SOUND01[2], N02::ATB_MAX_SOUND01[1], N02::ATB_MAX_SOUND01[0])
@gauge_max.visible = true
end
@battler.act_active = false
end
#--------------------------------------------------------------------------
# ● ACT 카운트
#--------------------------------------------------------------------------
def act
if @battler.act_count <= 1000
@gauge_max.visible = false
@battler.act_count += @base_act_count
@battler.at_count += @base_atb_count * 3 if Input.press?(Input::SHIFT) && N02::ATB_SHIFT_BOOST
end
# ACT 게이지 MAX
if @battler.act_count >= 1000 && !@battler.act_active
@battler.act_active = true
@gauge.src_rect.width = 52
return if !@battler.atb_on
Audio.se_play("Audio/SE/" + N02::ACT_MAX_SOUND01[2], N02::ACT_MAX_SOUND01[1], N02::ACT_MAX_SOUND01[0])
@gauge_max.visible = true
end
end
#--------------------------------------------------------------------------
# ● 해방
#--------------------------------------------------------------------------
def dispose
super
@gauge.dispose
@gauge_max.dispose
end
end
#==============================================================================
# ■ Sprite_Cursor
#------------------------------------------------------------------------------
# 커서의 스프라이트입니다.
#==============================================================================
class Sprite_Cursor < Sprite_Base
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
def initialize
super
create_target_cursor
end
#--------------------------------------------------------------------------
# ● 타겟 커서 스프라이트의 작성
#--------------------------------------------------------------------------
def create_target_cursor
self.bitmap = Cache.system("cursor")
@width = self.bitmap.width
@height = self.bitmap.height / 3
self.src_rect.set(0, 0, @width, @height)
@cursor_flame = 0
self.x = @pre_x = 272
self.y = @pre_y = 208
self.z = 300
self.ox = @width
self.oy = @height
self.visible = false
@time = 0
@flash_time = 0
end
#--------------------------------------------------------------------------
# ● 프레임 갱신
#--------------------------------------------------------------------------
def update
# 커서 화상 갱신
@cursor_flame = 0 if @cursor_flame == 40
self.src_rect.set(0, 0, @width, @height) if @cursor_flame == 0
self.src_rect.set(0, @height, @width, @height) if @cursor_flame == 10
self.src_rect.set(0, 2 * @height, @width, @height) if @cursor_flame == 20
self.src_rect.set(0, @height, @width, @height) if @cursor_flame == 30
@cursor_flame += 1
# 커서 좌표 갱신
return if @battler == nil
# 타겟을 빛낸다
@flash_time -= 1
if @flash_time == 0 && @battler.exist? && !@battler.collapse
@battler.white_flash = true
@flash_time = 20
end
if @time == 0
self.x = @battler.position_x
return self.y = @battler.position_y - @battler.graphics_width / 5
end
@time -= 1
self.x = @pre_x + (@battler.position_x - @pre_x) * (9 - @time) / 9
self.y = @pre_y + (@battler.position_y - @battler.graphics_width / 5 - @pre_y) * (9 - @time) / 9
end
#--------------------------------------------------------------------------
# ● 커서 이동 정보 세트
#--------------------------------------------------------------------------
def set(battler)
self.visible = true
@battler = battler
return if @battler == nil
@battler.white_flash = true if @battler.exist? && !@battler.collapse
@time = 9
@flash_time = 20
@pre_x = self.x
@pre_y = self.y
end
end
#==============================================================================
# ■ Sprite_Battler
#------------------------------------------------------------------------------
# 버틀러 표시용의 스프라이트입니다.
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# ● 버틀러 작성
#--------------------------------------------------------------------------
alias make_battler_n01 make_battler
def make_battler
make_battler_n01
@battler.graphics_width = @width
@battler.graphics_height = @height
make_atb
end
#--------------------------------------------------------------------------
# ● 해방
#--------------------------------------------------------------------------
alias dispose_n01 dispose
def dispose
dispose_n01
@atb_gauge.dispose if @atb_gauge != nil
end
#--------------------------------------------------------------------------
# ● 대기 액션 ※재정의
#--------------------------------------------------------------------------
def stand_by
# 요금 액션을 우선
@battler.charge_start = false if @battler.charge_start && !@battler.exist?
return @repeat_action = @battler.charge_action if @battler.charge_start
# 통상 대기에
@repeat_action = @battler.normal
# HP가1/4로 핀치모션에
@repeat_action = @battler.pinch if @battler.hp <= @battler.maxhp / 4
# 방어중
@repeat_action = @battler.defence if @battler.guarding?
# 아무것도 스테이트가 없으면 종료
return if @battler.state_id == nil
for state in @battler.states.reverse
# 액션 금지의 스테이트라면 스킵
next if state.extension.include?("NOSTATEANIME")
# 에너미로 금지되고 있는 스테이트 액션이라면 스킵
next if @battler.is_a?(Game_Enemy) && state.extension.include?("EXCEPTENEMY")
# 스테이트의 모션에
@repeat_action = state.base_action
end
end
#--------------------------------------------------------------------------
# ● ATB 게이지 작성
#--------------------------------------------------------------------------
def make_atb
return if battler == nil
battler.atb_setting
if battler.actor? && N02::ATB_POSITION_HPWINDOW
@atb_gauge = Sprite_ATB.new(@viewport2,battler)
else
@atb_gauge = Sprite_ATB.new(viewport,battler)
end
@atb_gauge.set(self.x, self.y)
end
#--------------------------------------------------------------------------
# ● ATB 게이지뷰포트 작성
#--------------------------------------------------------------------------
def make_atb_viewport(new_viewport)
@viewport2 = new_viewport
end
#--------------------------------------------------------------------------
# ● 프레임 갱신
#--------------------------------------------------------------------------
alias update_n01 update
def update
update_n01
# ATB 갱신
@atb_gauge.update if @atb_gauge != nil
end
#--------------------------------------------------------------------------
# ● 게이지 갱신
#--------------------------------------------------------------------------
def gauge_update
@atb_gauge.gauge_update if @atb_gauge != nil
end
#--------------------------------------------------------------------------
# ● 게이지 리프레쉬
#--------------------------------------------------------------------------
def gauge_refresh
@atb_gauge.gauge_refresh if @atb_gauge != nil
end
#--------------------------------------------------------------------------
# ● 게이지 표시
#--------------------------------------------------------------------------
def gauge_on
@atb_gauge.on if @atb_gauge != nil
end
#--------------------------------------------------------------------------
# ● 게이지 은폐
#--------------------------------------------------------------------------
def gauge_off
@atb_gauge.off if @atb_gauge != nil
end
#--------------------------------------------------------------------------
# ● ATB 게이지 변환
#--------------------------------------------------------------------------
def change_atb(restart_gauge)
@atb_gauge.change_atb(restart_gauge) if @atb_gauge != nil
end
#--------------------------------------------------------------------------
# ● ACT 게이지 변환
#--------------------------------------------------------------------------
def change_act(act_type)
@atb_gauge.change_act(act_type) if @atb_gauge != nil
end
#--------------------------------------------------------------------------
# ● ATB 게이지 개방
#--------------------------------------------------------------------------
def atb_dispose
@atb_gauge.dispose if @atb_gauge != nil
@atb_gauge = nil
end
end
#==============================================================================
# ■ Spriteset_Battle
#------------------------------------------------------------------------------
# 배틀 화면의 스프라이트를 정리한 클래스입니다.
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● 액터 스프라이트의 작성
#--------------------------------------------------------------------------
alias create_actors_n01 create_actors
def create_actors
create_actors_n01
if N02::ATB_POSITION_HPWINDOW
for sprites in @actor_sprites + @enemy_sprites
sprites.make_atb_viewport(@viewport4)
end
end
end
#--------------------------------------------------------------------------
# ● 타겟 정보 리프레쉬
#--------------------------------------------------------------------------
def update_target(actor, index)
@actor_sprites[index].update_target if actor
@enemy_sprites[index].update_target unless actor
end
#--------------------------------------------------------------------------
# ● 게이지 갱신
#--------------------------------------------------------------------------
def gauge_update
for sprites in @actor_sprites + @enemy_sprites
sprites.gauge_update if sprites != nil
end
end
#--------------------------------------------------------------------------
# ● 게이지 리프레쉬
#--------------------------------------------------------------------------
def gauge_refresh(actor, index)
@actor_sprites[index].gauge_refresh if actor
@enemy_sprites[index].gauge_refresh unless actor
end
#--------------------------------------------------------------------------
# ● 게이지 표시
#--------------------------------------------------------------------------
def gauge_on
for sprites in @actor_sprites + @enemy_sprites
sprites.gauge_on if sprites != nil
end
end
#--------------------------------------------------------------------------
# ● 게이지 은폐
#--------------------------------------------------------------------------
def gauge_off
for sprites in @actor_sprites + @enemy_sprites
sprites.gauge_off if sprites != nil
end
end
#--------------------------------------------------------------------------
# ● ATB 게이지 변환
#--------------------------------------------------------------------------
def change_atb(restart_gauge, actor, index)
@actor_sprites[index].change_atb(restart_gauge) if actor
@enemy_sprites[index].change_atb(restart_gauge) unless actor
end
#--------------------------------------------------------------------------
# ● ACT 게이지 변환
#--------------------------------------------------------------------------
def change_act(act_type, actor, index)
@actor_sprites[index].change_act(act_type) if actor
@enemy_sprites[index].change_act(act_type) unless actor
end
#--------------------------------------------------------------------------
# ● ATB 게이지 일제 개방
#--------------------------------------------------------------------------
def atb_dispose
for sprites in @actor_sprites + @enemy_sprites
sprites.atb_dispose if sprites != nil
end
end
end
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# 스킬이나 아이템의 설명, 액터의 스테이터스등을 표시하는 윈도우입니다.
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# ● 텍스트 설정
#--------------------------------------------------------------------------
def set_text_n02add(member)
return if member == nil
self.contents.clear
self.contents.font.color = normal_color
if !member.actor? && N02::ENEMY_NON_DISPLAY.include?(member.enemy_id)
return self.contents.draw_text(4, 0, self.width - 40, WLH, member.name, 1)
elsif member.actor? && !N02::ACTOR_DISPLAY
return self.contents.draw_text(4, 0, self.width - 40, WLH, member.name, 1)
end
if N02::WORD_STATE_DISPLAY && N02::HP_DISPLAY
self.contents.draw_text(0, 0, 180, WLH, member.name, 1)
draw_actor_hp(member, 182, 0, 120)
text = "["
for state in member.states
next if N02::STATE_NON_DISPLAY.include?(state.id)
text += " " if text != "["
text += state.name
end
text += N02::WORD_NORMAL_STATE if text == "["
text += "]"
text = "" if text == "[]"
self.contents.draw_text(315, 0, 195, WLH, text, 0)
elsif N02::WORD_STATE_DISPLAY
text = member.name + " ["
for state in member.states
next if N02::STATE_NON_DISPLAY.include?(state.id)
text += " " if text != member.name + " ["
text += state.name
end
text += N02::WORD_NORMAL_STATE if text == member.name + " ["
text += "]"
text = "" if text == "[]"
self.contents.draw_text(4, 0, self.width - 40, WLH, text, 1)
elsif N02::HP_DISPLAY
self.contents.draw_text(4, 0, 240, WLH, member.name, 1)
draw_actor_hp(member, 262, 0, 120)
end
end
end
#==============================================================================
# ■ Window_Skill
#------------------------------------------------------------------------------
# 스킬 화면등에서, 사용할 수 있는 스킬의 일람을 표시하는 윈도우입니다.
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ● 항목의 묘화 ※재정의
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
enabled = @actor.skill_can_use?(skill)
enabled = @actor.union_skill_can_use?(skill.id) if @actor.union_skill?(skill.id)
draw_item_name(skill, rect.x, rect.y, enabled)
self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
end
end
end
#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
# 배틀 화면에서 파티 멤버의 스테이터스를 표시하는 윈도우입니다.
#==============================================================================
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● 커서를 아래에 이동 ※재정의
#--------------------------------------------------------------------------
def cursor_down(wrap = false)
end
#--------------------------------------------------------------------------
# ● 커서를 위에 이동 ※재정의
#--------------------------------------------------------------------------
def cursor_up(wrap = false)
end
#--------------------------------------------------------------------------
# ● 프레임 갱신 ※재정의
#--------------------------------------------------------------------------
def update
super
update_cursor
call_update_help
end
end
#==============================================================================
# ■ Window_PartyCommand2
#------------------------------------------------------------------------------
# 배틀 화면에서, 싸울까 도망치는지를 선택하는 윈도우입니다.
#==============================================================================
class Window_PartyCommand2 < Window_Selectable
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
def initialize
super(0, 234, 544, 56)
@item_max = 2
@column_max = 2
self.contents.draw_text(32, 0, 96, WLH, "싸운다", 2)
self.contents.draw_text(310, 0, 96, WLH, "도망", 2) if $game_troop.can_escape
self.contents.font.color.alpha = 128
self.contents.draw_text(310, 0, 96, WLH, "도망", 2) if !$game_troop.can_escape
self.active = false
end
end
#==============================================================================
# ■ Window_MenuATB
#------------------------------------------------------------------------------
# 메뉴 화면에서 ATB 설정을 표시하는 윈도우입니다.
#==============================================================================
class Window_ATB_active < Window_Selectable
# 액티브 타임 배틀의 커스터마이즈 항목으로부터의 텍스트
ATB_MODE_NAME = N02::ATB_MODE_NAME
ATB_MODE1 = N02::ATB_MODE1[0]
ATB_MODE2 = N02::ATB_MODE2[0]
ATB_MODE3 = N02::ATB_MODE3[0]
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
def initialize
super(0, 174, 544, 56)
@item_max = 3
@column_max = 3
set_active
self.active = true
self.index = $game_party.atb_custom[0]
end
#--------------------------------------------------------------------------
# ● 액티브화
#--------------------------------------------------------------------------
def set_active
self.contents.clear
self.contents.font.size = 15
self.contents.font.color = crisis_color
self.contents.draw_text( 0, 0, 100, WLH, ATB_MODE_NAME, 0)
self.contents.draw_text( 0, 0, 100, WLH, ATB_MODE_NAME, 0)
self.contents.font.size = 20
self.contents.font.color = normal_color
refresh
end
#--------------------------------------------------------------------------
# ● 액티브 해제
#--------------------------------------------------------------------------
def non_active
self.contents.clear
self.contents.font.size = 15
self.contents.font.color = system_color
self.contents.draw_text( 0, 0, 100, WLH, ATB_MODE_NAME, 0)
self.contents.font.size = 20
self.contents.font.color = normal_color
refresh
end
#--------------------------------------------------------------------------
# ● 항목을 묘화 하는 구형의 취득
#--------------------------------------------------------------------------
def refresh
case $game_party.atb_custom[0]
when 0
self.contents.draw_text(100, 0, 140, WLH, ATB_MODE1, 1)
self.contents.font.color.alpha = 100
self.contents.draw_text(240, 0, 140, WLH, ATB_MODE2, 1)
self.contents.draw_text(380, 0, 140, WLH, ATB_MODE3, 1)
when 1
self.contents.font.color.alpha = 100
self.contents.draw_text(100, 0, 140, WLH, ATB_MODE1, 1)
self.contents.font.color = normal_color
self.contents.draw_text(240, 0, 140, WLH, ATB_MODE2, 1)
self.contents.font.color.alpha = 100
self.contents.draw_text(380, 0, 140, WLH, ATB_MODE3, 1)
when 2
self.contents.font.color.alpha = 100
self.contents.draw_text(100, 0, 140, WLH, ATB_MODE1, 1)
self.contents.draw_text(240, 0, 140, WLH, ATB_MODE2, 1)
self.contents.font.color = normal_color
self.contents.draw_text(380, 0, 140, WLH, ATB_MODE3, 1)
end
end
#--------------------------------------------------------------------------
# ● 항목을 묘화 하는 구형의 취득
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = 140
rect.height = 24
rect.x = index % @column_max * rect.width + 100
rect.y = index / @column_max * WLH
return rect
end
end
#==============================================================================
# ■ Window_MenuATB
#------------------------------------------------------------------------------
# 메뉴 화면에서 ATB 설정을 표시하는 윈도우입니다.
#==============================================================================
class Window_ATB_speed < Window_Selectable
# 액티브 타임 배틀의 커스터마이즈 항목으로부터의 텍스트
ATB_MODE_NAME = N02::ATB_SPEED_NAME
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
def initialize
super(0, 230, 544, 56)
@item_max = 9
@column_max = 9
non_active
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● 액티브화
#--------------------------------------------------------------------------
def set_active
self.contents.clear
self.contents.font.size = 15
self.contents.font.color = crisis_color
self.contents.draw_text( 0, 0, 140, WLH, ATB_MODE_NAME, 0)
self.contents.draw_text( 0, 0, 140, WLH, ATB_MODE_NAME, 0)
self.contents.font.size = 22
self.contents.font.color = normal_color
refresh
end
#--------------------------------------------------------------------------
# ● 액티브 해제
#--------------------------------------------------------------------------
def non_active
self.contents.clear
self.contents.font.size = 15
self.contents.font.color = system_color
self.contents.draw_text( 0, 0, 140, WLH, ATB_MODE_NAME, 0)
self.contents.font.size = 22
self.contents.font.color = normal_color
refresh
end
#--------------------------------------------------------------------------
# ● 항목을 묘화 하는 구형의 취득
#--------------------------------------------------------------------------
def refresh
self.contents.font.color.alpha = 96
self.contents.draw_text(94 + 38 * 0, 0, 140, WLH, "1", 1)
self.contents.draw_text(94 + 38 * 1, 0, 140, WLH, "2", 1)
self.contents.draw_text(94 + 38 * 2, 0, 140, WLH, "3", 1)
self.contents.draw_text(94 + 38 * 3, 0, 140, WLH, "4", 1)
self.contents.draw_text(94 + 38 * 4, 0, 140, WLH, "5", 1)
self.contents.draw_text(94 + 38 * 5, 0, 140, WLH, "6", 1)
self.contents.draw_text(94 + 38 * 6, 0, 140, WLH, "7", 1)
self.contents.draw_text(94 + 38 * 7, 0, 140, WLH, "8", 1)
self.contents.draw_text(94 + 38 * 8, 0, 140, WLH, "9", 1)
self.contents.font.color.alpha = 256
case $game_party.atb_custom[1]
when 0;self.contents.draw_text(94 + 38 * 0, 0, 140, WLH, "1", 1)
when 1;self.contents.draw_text(94 + 38 * 1, 0, 140, WLH, "2", 1)
when 2;self.contents.draw_text(94 + 38 * 2, 0, 140, WLH, "3", 1)
when 3;self.contents.draw_text(94 + 38 * 3, 0, 140, WLH, "4", 1)
when 4;self.contents.draw_text(94 + 38 * 4, 0, 140, WLH, "5", 1)
when 5;self.contents.draw_text(94 + 38 * 5, 0, 140, WLH, "6", 1)
when 6;self.contents.draw_text(94 + 38 * 6, 0, 140, WLH, "7", 1)
when 7;self.contents.draw_text(94 + 38 * 7, 0, 140, WLH, "8", 1)
when 8;self.contents.draw_text(94 + 38 * 8, 0, 140, WLH, "9", 1)
end
end
#--------------------------------------------------------------------------
# ● 항목을 묘화 하는 구형의 취득
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = 38
rect.height = 24
rect.x = index % @column_max * rect.width + 145
rect.y = index / @column_max * WLH
return rect
end
end
#==============================================================================
# ■ Window_ATB_Help
#------------------------------------------------------------------------------
# ATB 설정의 설명을 표시하는 윈도우입니다.
#==============================================================================
class Window_ATB_Help < Window_Base
# 액티브 타임 배틀의 커스터마이즈 항목으로부터의 텍스트
ATB_MODE_NAME = N02::ATB_MODE_NAME
ATB_MODE1 = N02::ATB_MODE1[0]
ATB_MODE2 = N02::ATB_MODE2[0]
ATB_MODE3 = N02::ATB_MODE3[0]
ATB_MODE1_HELP = N02::ATB_MODE1_HELP
ATB_MODE2_HELP = N02::ATB_MODE2_HELP
ATB_MODE3_HELP = N02::ATB_MODE3_HELP
ATB_SPEED_NAME = N02::ATB_SPEED_NAME
ATB_SPEED_HELP = N02::ATB_SPEED_HELP
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
def initialize
super(0, 56, 544, 96)
end
#--------------------------------------------------------------------------
# ● 텍스트 설정
#--------------------------------------------------------------------------
def set_text_active(index)
text1 = ATB_MODE_NAME + " ["
case index
when 0
text1 += ATB_MODE1 + "]"
text2 = ATB_MODE1_HELP
when 1
text1 += ATB_MODE2 + "]"
text2 = ATB_MODE2_HELP
when 2
text1 += ATB_MODE3 + "]"
text2 = ATB_MODE3_HELP
end
self.contents.clear
self.contents.font.color = crisis_color
self.contents.draw_text(4, 4, self.width - 40, WLH, text1, 0)
self.contents.font.color = normal_color
self.contents.draw_text(4, 34, self.width - 40, WLH, text2, 0)
end
#--------------------------------------------------------------------------
# ● 텍스트 설정
#--------------------------------------------------------------------------
def set_text_speed
text1 = ATB_SPEED_NAME
text2 = ATB_SPEED_HELP
self.contents.clear
self.contents.font.color = crisis_color
self.contents.draw_text(4, 4, self.width - 40, WLH, text1, 0)
self.contents.font.color = normal_color
self.contents.draw_text(4, 34, self.width - 40, WLH, text2, 0)
end
end
#==============================================================================
# ■ Window_ATB_Help
#------------------------------------------------------------------------------
# ATB 설정 타이틀·조작을 표시하는 윈도우입니다.
#==============================================================================
class Window_ATB_Title < Window_Base
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
def initialize
super(0, 0, 544, 56)
refresh
end
#--------------------------------------------------------------------------
# ● 텍스트 설정
#--------------------------------------------------------------------------
def refresh
text1 = N02::ATB_CUSTOMIZE_NAME
text2 = "Use the directional keys to select options."
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 96, WLH, text1, 0)
self.contents.font.color = normal_color
self.contents.draw_text(110, 0, 420, WLH, text2, 0)
end
end
#==============================================================================
# ■ Scene_ATB
#------------------------------------------------------------------------------
# ATB 설정을 실시하는 클래스입니다.
#==============================================================================
class Scene_ATB < Scene_Base
#--------------------------------------------------------------------------
# ● 개시 처리
#--------------------------------------------------------------------------
def start
super
create_menu_background
@title_window = Window_ATB_Title.new
@help_window = Window_ATB_Help.new
@active_window = Window_ATB_active.new
@speed_window = Window_ATB_speed.new
@help_window.set_text_active(@active_window.index)
@active_window_index = @active_window.index
@speed_window_index = $game_party.atb_custom[1]
end
#--------------------------------------------------------------------------
# ● 종료 처리
#--------------------------------------------------------------------------
def terminate
super
$game_party.atb_customize
dispose_menu_background
@title_window.dispose
@help_window.dispose
@active_window.dispose
@speed_window.dispose
end
#--------------------------------------------------------------------------
# ● 원래의 화면에 돌아온다
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(4)
end
#--------------------------------------------------------------------------
# ● 프레임 갱신
#--------------------------------------------------------------------------
def update
super
update_menu_background
@help_window.update
@active_window.update
@speed_window.update
if @active_window.active
update_active_selection
elsif @speed_window.active
update_speed_selection
end
end
#--------------------------------------------------------------------------
# ● 아이템 선택의 갱신
#--------------------------------------------------------------------------
def update_active_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
Sound.play_decision
$game_party.atb_custom[0] = @active_window.index
@active_window.set_active
elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
Sound.play_cursor
@speed_window.active = true
@speed_window.set_active
@speed_window.index = @speed_window_index
@active_window.active = false
@active_window.non_active
@active_window_index = @active_window.index
@active_window.index = -1
@help_window.set_text_speed
elsif Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
@help_window.set_text_active(@active_window.index)
end
end
#--------------------------------------------------------------------------
# ● 타겟 선택의 갱신
#--------------------------------------------------------------------------
def update_speed_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
Sound.play_decision
$game_party.atb_custom[1] = @speed_window.index
@speed_window.set_active
elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
Sound.play_cursor
@active_window.active = true
@active_window.set_active
@active_window.index = @active_window_index
@speed_window.active = false
@speed_window.non_active
@speed_window_index = @speed_window.index
@speed_window.index = -1
@help_window.set_text_active(@active_window.index)
end
end
end
#==============================================================================
# ■ Scene_File
#------------------------------------------------------------------------------
# 파일 화면의 처리를 실시하는 클래스입니다.
#==============================================================================
class Scene_File < Scene_Base
#--------------------------------------------------------------------------
# ● 원래의 화면에 돌아오는 ※재정의
#--------------------------------------------------------------------------
def return_scene
if @from_title
$scene = Scene_Title.new
elsif @from_event
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(5)
end
end
end
#==============================================================================
# ■ Scene_End
#------------------------------------------------------------------------------
# 게임 종료 화면의 처리를 실시하는 클래스입니다.
#==============================================================================
class Scene_End < Scene_Base
#--------------------------------------------------------------------------
# ● 원래의 화면에 돌아오는 ※재정의
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(6)
end
end
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
# 메뉴 화면의 처리를 실시하는 클래스입니다.
#==============================================================================
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# ● 커멘드 윈도우의 작성
#--------------------------------------------------------------------------
alias create_command_window_n02 create_command_window
def create_command_window
return create_command_window_n02 if !N02::ATB_CUSTOMIZE
s1 = Vocab::item
s2 = Vocab::skill
s3 = Vocab::equip
s4 = Vocab::status
s5 = N02::ATB_CUSTOMIZE_NAME
s6 = Vocab::save
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
if $game_party.members.size == 0 # 파티 인원수가 0 명의 경우
@command_window.draw_item(0, false) # 아이템을 무효화
@command_window.draw_item(1, false) # 스킬을 무효화
@command_window.draw_item(2, false) # 장비를 무효화
@command_window.draw_item(3, false) # 스테이터스를 무효화
end
if $game_system.save_disabled # 세이브 금지의 경우
@command_window.draw_item(5, false) # 세이브를 무효화
end
end
#--------------------------------------------------------------------------
# ● 커멘드 선택의 갱신
#--------------------------------------------------------------------------
alias update_command_selection_n02 update_command_selection
def update_command_selection
return update_command_selection_n02 if !N02::ATB_CUSTOMIZE
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.members.size == 0 and @command_window.index < 4
Sound.play_buzzer
return
elsif $game_system.save_disabled and @command_window.index == 5
Sound.play_buzzer
return
end
Sound.play_decision
case @command_window.index
when 0 # 아이템
$scene = Scene_Item.new
when 1,2,3 # 스킬, 장비, 스테이터스
start_actor_selection
when 4 # ATB 설정
$scene = Scene_ATB.new
when 5 # 세이브
$scene = Scene_File.new(true, false, false)
end
end
end
end