\n" if($mv_mode eq 'pc');
$log2 .="\n";
$log2 .="\n";
$log .=" \n";
$ck=1;
}elsif($ck==1){
# 전투 처리 파일 읽기
require './inc/ore_sub-battle.cgi';
$j=int($b_n-$b_v);
$j=0 if($j<1);
$log .="$cmp[$camp]군 $nm $cl[$rank] 지휘($lr) 부대수($sol) VS $cmp[$nation]군 $tnm 지휘($tlr) 부대수($tsol) \n";
$log .="- 전투 한계까지 남은 턴: $j 턴 - \n";
$log .=" \n";
$qz = int($lv-20);
if($b_n eq'' && $tlr eq''){
$tm = $ck = $cmd = 0;
$nation = 0;
$type='';
$log .="전투 중에 버그가 발생했습니다! 강제로 메인 화면으로 돌아갑니다 \n";
&call_main_st;
}
if($j>2 && $tm<10 && $cmd !=-1){
my $l=int(rand(5));
if($l==0 && $qz<$tlv){
$tm=50;
$log .="적군을 지휘하는 $tnm(으)로부터 일대일 결투 신청이 들어왔습니다! 어떻게 하겠습니까? \n";
$log .="적장 스탯 - $tnm ( HP $thp MP $tmp UA $tua UD $tud LV $tlv ) \n";
}
}
if($tm==50){
if($cmd==10){
$log .="일대일 결투 신청을 거절했습니다. 평판이 소폭 하락했습니다. \n";
$tm=0;
$rank_exe-=1;
}elsif($cmd==20){
$log .="$tnm 의 도전을 수락하여 이 전쟁의 승패를 건 일대일 결투를 치르기로 했습니다! \n";
$tm=60;
$rank_exe+=1;
}
}elsif($tm==60){
$log .="진검승부 시작! \n";
$tm=70;
}elsif($tm==70){
# 전투 처리 호출
&bt_cm;
if($thp<1){
$G =int(rand(200))+((500*$tlv)-($lv*50));
$G =1 if($G<1);
$G =int(rand(500))+1500 if($G>2000);
$gold +=$G;
$E =int((((((rand(5))+5)+$tlv)*2)*0.8)-$lv);
$E =1 if($E<1);
$E =int(rand(50))+250 if($E>300);
$exe+=$E;
$thp=0;
$bst ='';
$bt =0;
$log .="$nm 은(는) $tnm(을)를 쓰러뜨렸다! \n";
$log .="$G GOLD와 $E 경험치를 획득했다! \n";
$log .="\n";
$H =int(rand(51));
$E = int((100+$H)*$lv);
$E = int((rand(500))+1800) if($E>2000);
$G = 20000;
# 개조 전은 50+$H
$N = $H+150;
# 여기까지
$exe+=$E;
$gold+=$G;
if($camp==1){
$cs1+=int($sol);
$cn1+=$N;
}elsif($camp==2){
$cs2+=int($sol);
$cn2+=$N;
}elsif($camp==3){
$cs3+=int($sol);
$cn3+=$N;
}elsif($camp==4){
$cs4+=int($sol);
$cn4+=$N;
}elsif($camp==5){
$cs5+=int($sol);
$cn5+=$N;
}
$tsol=int($tsol/2);
if($nation==1){
$cs1+=$tsol;
}elsif($nation==2){
$cs2+=$tsol;
}elsif($nation==3){
$cs3+=$tsol;
}elsif($nation==4){
$cs4+=$tsol;
}elsif($nation==5){
$cs5+=$tsol;
}
if($nation==1){
$cn1-=$N;
$cn1=0 if($cn1<1);
}elsif($nation==2){
$cn2-=$N;
$cn2=0 if($cn2<1);
}elsif($nation==3){
$cn3-=$N;
$cn3=0 if($cn3<1);
}elsif($nation==4){
$cn4-=$N;
$cn4=0 if($cn4<1);
}elsif($nation==5){
$cn5-=$N;
$cn5=0 if($cn5<1);
}
$log .="적군은 $tnm 의 패배에 전의를 상실했습니다! 장수를 잃은 부대 따위는 아군의 상대가 아닙니다. 적군을 추격하여 엄청난 타격을 입혔습니다! \n";
$log .="$cmp[$nation]로부터 국력 $N을 빼앗았습니다. 추가로 $E 경험치와 $G GOLD의 보상을 획득했다! \n";
$wr_mes ="$date $cmp[$camp] 의 $syogo 가 $cmp[$nation] 에 침공, $tnm 와 일대일 결투 끝에 승리하고 국력 $N 을 빼앗는 데 성공한 것 같습니다.";
&touitu;
$V =int(rand(6))+5;
$sol_lv-=$V;
$rank_exe+=int($V*2)+5;
$sol=0;
$tnm='';
$ck = $tm = $cmd = 0;
$nation=0;
$type='';
&hist_write;#국가 로그
}elsif($hp<1){
$bst ='';
$bt =0;
$ck =0;
$hp =0;
$G=int(rand(10))+1;
$E=int(rand(5))+1;
$gold+=$G;
$exe+=$E;
$log .="당신은 적장 $tnm 에게 패배하고 말았다… \n";
$log .="$G GOLD와 $E 경험치를 획득했다 \n";
$log .="\n";
$sol=int($sol/2);
if($camp==1){
$cs1+=int($sol);
$cn1+=$N;
}elsif($camp==2){
$cs2+=int($sol);
$cn2+=$N;
}elsif($camp==3){
$cs3+=int($sol);
$cn3+=$N;
}elsif($camp==4){
$cs4+=int($sol);
$cn4+=$N;
}elsif($camp==5){
$cs5+=int($sol);
$cn5+=$N;
}
if($nation==1){
$cs1+=$tsol;
}elsif($nation==2){
$cs2+=$tsol;
}elsif($nation==3){
$cs3+=$tsol;
}elsif($nation==4){
$cs4+=$tsol;
}elsif($nation==5){
$cs5+=$tsol;
}
$log .="일대일 결투에 패배하여 지휘관을 잃은 당신의 부대는 적에게 막대한 피해를 입었습니다… \n";
$rank_exe-=15;
$log .="부대 전멸이라는 불명예스러운 패배로 인해 당신에 대한 평판이 크게 떨어졌다 \n";
if($rank_exe<1){
$rank--;
$rank=1 if($rank<1);
$next_rank=int(($rank*$rank)*3);
$v=$next_rank-10;
$rank_exe=$v;
$log .="일계급 강등되어 버렸다… \n";
}
$wr_mes ="$date $cmp[$camp] 의 $syogo 가 $cmp[$nation] 에 침공, $tnm 와 일대일 결투를 치렀으나 패배하여 부대는 패주한 것 같습니다.";
$sol=0;
$tnm='';
$ck = $tm = $cmd = 0;
$nation=0;
$type='';
&hist_write;#국가 로그
}
}elsif($tm<1){
if($cmd==10){
my $btp = $ag + int(rand($lv/2) +1);
my $bte = $tag+ int(rand($tlv/2)+1);
if($j<3){
$log .="여기까지 전투가 진행된 상태에서의 퇴각은 불가능합니다. \n";
$b_n+=1;
}elsif($btp<$bte){
$log .="적군에게 도주 경로가 막혀 더 이상 퇴각할 수 없습니다. \n";
$b_n+=1;
}else{
$log .="아쉽지만 작전을 중지하고 퇴각합니다. \n";
if($camp==1){
$cs1+=int($sol);
}elsif($camp==2){
$cs2+=int($sol);
}elsif($camp==3){
$cs3+=int($sol);
}elsif($camp==4){
$cs4+=int($sol);
}elsif($camp==5){
$cs5+=int($sol);
}
if($nation==1){
$cs1+=$tsol;
}elsif($nation==2){
$cs2+=$tsol;
}elsif($nation==3){
$cs3+=$tsol;
}elsif($nation==4){
$cs4+=$tsol;
}elsif($nation==5){
$cs5+=$tsol;
}
$wr_mes ="$date $cmp[$camp] 의 $syogo 가 $cmp[$nation] 에 침공, $tnm 방위 부대와 교전 후 부득이하게 퇴각한 것 같습니다.";
$sol_lv-=int(rand(40));
$rank_exe-=1;
$rank_exe = 0 if($rank_exe<1);
$tnm='';
$ck = $tm = $cmd = 0;
$nation=0;
$type='';
&hist_write;#국가 로그
}
}elsif($cmd==1){
$l=int(rand(3));
if($l==0){
$x=int(($sol/100)+($lr*10))+$sol_lv;
$y=int(($tsol/100)+($tlr*10))+$tsol_lv;
$x=1 if($x<1);
$y=1 if($y<1);
$log .="$nm (공격진형) VS $tnm (공격진형) \n";
$log .="○자군 피해 $y ●적군 피해 $x \n";
$sol-=$y;
$tsol-=$x;
}elsif($l==1){
$x=int((($sol/100)+($lr*10))*2)+$sol_lv;
$y=int((($tsol/100)+($tlr*10))*0.5)+$tsol_lv;
$x=1 if($x<1);
$y=1 if($y<1);
$log .="$nm (공격진형) VS $tnm (방어진형) \n";
$log .="○자군 피해 $y ●적군 피해 $x \n";
$sol-=$y;
$tsol-=$x;
}elsif($l==2){
$x=int((($sol/100)+($lr*10))*0.5)+$sol_lv;
$y=int((($tsol/100)+($tlr*10))*2)+$tsol_lv;
$x=1 if($x<1);
$y=1 if($y<1);
$log .="$nm (공격진형) VS $tnm (돌격진형) \n";
$log .="○자군 피해 $y ●적군 피해 $x \n";
$sol-=$y;
$tsol-=$x;
}
}elsif($cmd==2){
$l=int(rand(3));
if($l==0){
$x=int((($sol/100)+($lr*10))*0.5)+$sol_lv;
$y=int((($tsol/100)+($tlr*10))*2)+$tsol_lv;
$x=1 if($x<1);
$y=1 if($y<1);
$log .="$nm (방어진형) VS $tnm (공격진형) \n";
$log .="○자군 피해 $y ●적군 피해 $x \n";
$sol-=$y;
$tsol-=$x;
}elsif($l==1){
$x=int(($sol/100)+($lr*10))+$sol_lv;
$y=int(($tsol/100)+($tlr*10))+$tsol_lv;
$x=1 if($x<1);
$y=1 if($y<1);
$log .="$nm (방어진형) VS $tnm (방어진형) \n";
$log .="○자군 피해 $y ●적군 피해 $x \n";
$sol-=$y;
$tsol-=$x;
}elsif($l==2){
$x=int((($sol/100)+($lr*10))*2)+$sol_lv;
$y=int((($tsol/100)+($tlr*10))*0.5)+$tsol_lv;
$x=1 if($x<1);
$y=1 if($y<1);
$log .="$nm (방어진형) VS $tnm (돌격진형) \n";
$log .="○자군 피해 $y ●적군 피해 $x \n";
$sol-=$y;
$tsol-=$x;
}
}elsif($cmd==3){
$l=int(rand(3));
if($l==0){
$x=int((($sol/100)+($lr*10))*2)+$sol_lv;
$y=int((($tsol/100)+($tlr*10))*0.5)+$tsol_lv;
$x=1 if($x<1);
$y=1 if($y<1);
$log .="$nm (돌격진형) VS $tnm (공격진형) \n";
$log .="○자군 피해 $y ●적군 피해 $x \n";
$sol-=$y;
$tsol-=$x;
}elsif($l==1){
$x=int((($sol/100)+($lr*10))*0.5)+$sol_lv;
$y=int((($tsol/100)+($tlr*10))*2)+$tsol_lv;
$x=1 if($x<1);
$y=1 if($y<1);
$log .="$nm (돌격진형) VS $tnm (방어진형) \n";
$log .="○자군 피해 $y ●적군 피해 $x \n";
$sol-=$y;
$tsol-=$x;
}elsif($l==2){
$x=int(($sol/100)+($lr*10))+$sol_lv;
$y=int(($tsol/100)+($tlr*10))+$tsol_lv;
$x=1 if($x<1);
$y=1 if($y<1);
$log .="$nm (돌격진형) VS $tnm (돌격진형) \n";
$log .="○자군 피해 $y ●적군 피해 $x \n";
$sol-=$y;
$tsol-=$x;
}
}
$log .=" \n";
if($sol<1&&$tsol<1){
$log .="양군 모두 괴멸적인 타격을 입어 전투 지속이 불가능하게 되었습니다. 이번 작전은 무승부입니다. \n";
$log .="국력은 양 진영 모두 변화 없음 \n";
$H =int(rand(21));
$E = int((20+$H)*$lv);
$E = int(rand(50))+170 if($E>200);
$G = 5000;
$exe+=$E;
$gold+=$G;
$rank_exe-=10;
$log .="부대 전멸이라는 불명예스러운 패배로 인해 당신에 대한 평판이 크게 떨어졌다 \n";
if($rank_exe<1){
$rank--;
$rank=1 if($rank<1);
$next_rank=int(($rank*$rank)*3);
$v=$next_rank-10;
$rank_exe=$v;
$log .="일계급 강등되어 버렸다… \n";
}
$log .="$E 의 경험치와 $G 의 보상을 얻었다 \n";
$wr_mes ="$date $cmp[$camp] 의 $syogo 가 $cmp[$nation] 에 침공, $tnm 방위 부대에 가로막혀 격전 끝에 양군 모두 괴멸한 것 같습니다.";
$sol=0;
$sol_lv=0;
$tnm='';
$ck = $tm = $cmd = 0;
$nation=0;
$type='';
&hist_write;#국가 로그
}elsif($tsol<1){
$log .="적 부대를 격파했습니다! 아군의 승리입니다! \n";
$H =int(rand(51));
$E = int((100+$H)*$lv);
$E = int((rand(500))+1800) if($E>2000);
$G = 20000;
# 개조 전은 50+$H
$N = $H+150;
# 여기까지
$exe+=$E;
$gold+=$G;
if($camp==1){
$cs1+=int($sol);
$cn1+=$N;
}elsif($camp==2){
$cs2+=int($sol);
$cn2+=$N;
}elsif($camp==3){
$cs3+=int($sol);
$cn3+=$N;
}elsif($camp==4){
$cs4+=int($sol);
$cn4+=$N;
}elsif($camp==5){
$cs5+=int($sol);
$cn5+=$N;
}
if($nation==1){
$cn1-=$N;
$cn1=0 if($cn1<1);
}elsif($nation==2){
$cn2-=$N;
$cn2=0 if($cn2<1);
}elsif($nation==3){
$cn3-=$N;
$cn3=0 if($cn3<1);
}elsif($nation==4){
$cn4-=$N;
$cn4=0 if($cn4<1);
}elsif($nation==5){
$cn5-=$N;
$cn5=0 if($cn5<1);
}
$log .="$cmp[$nation]로부터 국력 $N 을 빼앗았습니다. $E 경험치와 $G GOLD의 보상을 얻었다! \n";
$wr_mes ="$date $cmp[$camp] 의 $syogo 가 $cmp[$nation] 에 침공, $tnm 방위 부대를 격파하고 국력 $N 을 빼앗는 데 성공한 것 같습니다.";
&touitu;
$V =int(rand(6))+10;
$sol_lv-=$V;
$rank_exe+=$V;
$sol=0;
$tnm='';
$ck = $tm = $cmd = 0;
$nation=0;
$type='';
&hist_write;#국가 로그
}elsif($sol<1){
$log .="아군은 패배했습니다… 아쉽지만 철수합니다. \n";
$log .="국력은 양 진영 모두 변화 없음 \n";
$H =int(rand(21));
$E = int((20+$H)*$lv);
$E = int(rand(50))+170 if($E>200);
$G = 5000;
$exe+=$E;
$gold+=$G;
$log .="$E 의 경험치와 $G 의 보상을 얻었다 \n";
$wr_mes ="$date $cmp[$camp] 의 $syogo 가 $cmp[$nation] 에 침공, $tnm 방위 부대 앞에 패퇴한 것 같습니다.";
if($nation==1){
$cs1+=$tsol;
}elsif($nation==2){
$cs2+=$tsol;
}elsif($nation==3){
$cs3+=$tsol;
}elsif($nation==4){
$cs4+=$tsol;
}elsif($nation==5){
$cs5+=$tsol;
}
$rank_exe-=10;
$log .="부대 전멸이라는 불명예스러운 패배로 인해 당신에 대한 평판이 떨어졌다 \n";
if($rank_exe<1){
$rank--;
$rank=1 if($rank<1);
$next_rank=int(($rank*$rank)*3);
$v=$next_rank-10;
$rank_exe=$v;
$log .="일계급 강등되어 버렸다… \n";
}
$sol=0;
$tnm='';
$ck = $tm = $cmd = 0;
$nation=0;
$type='';
&hist_write;#국가 로그
}elsif($b_n<$b_v){
$log .="전투 한계 턴을 초과하고 말았다… 더 이상은 싸울 수 없습니다. \n";
$log .="국력은 양 진영 모두 변화 없음 \n";
$H =int(rand(21));
$E = int((20+$H)*$lv);
$E = int(rand(50))+170 if($E>200);
$G = 5000;
$exe+=$E;
$gold+=$G;
$log .="$E 의 경험치와 $G 의 보상을 얻었다 \n";
$wr_mes ="$date $cmp[$camp] 의 $syogo 가 $cmp[$nation] 에 침공, $tnm 방위 부대에 가로막혀 전투 한계를 초과한 것 같습니다.";
$rank_exe-=5;
$log .="작전에 실패하여 당신에 대한 평판이 떨어졌다. \n";
if($rank_exe<1){
$rank--;
$rank=1 if($rank<1);
$next_rank=int(($rank*$rank)*3);
$v=$next_rank-10;
$rank_exe=$v;
$log .="일계급 강등되어 버렸다… \n";
}
$sol_lv-=int(rand(40));
$sol=0;
$tnm='';
$ck = $tm = $cmd = 0;
$nation=0;
$type='';
&hist_write;#국가 로그
}
$b_v+=1 if($cmd>0);
}
$log2 .=" |