#-----------------------------------------------------------# # 罪と罰++ 二律背反 # # Copyright(C) 2001-2002 by Vivid Studio. BLANK BOARD # # Vivid Studio.[ http://www17.big.or.jp/~obochan/vivid/ ] # # BLANK BOARD [ http://pom.to/ ] # #-----------------------------------------------------------# # 戦争中処理 Version 1.0 #--- [注意事項] --------------------------------------------# # 1.このスクリプトは以下の利用規程に従って配布しています。 # # http://www24.big.or.jp/~obo/game/ore_/gild/ # #-----------------------------------------------------------# #------------------------------------------------------------------------------- #戦争中処理 sub wr_st { &syogo; if(!$ck){ $log .="$date $cmp[$nation] に進入しました
\n"; $tm=0; &usrdata_read; $sach=0; while($sach<15){ my $tg = int(rand($#usrfile)); open(IN,"$usrdata$usrfile[$tg]") || &error("Can't open $usrfile[$tg].cgi",1); $tdat=; close(IN); # 参加者ステータス取得 %DAT = ''; @prats = split(/,/,$tdat); foreach $prats (@prats){ ($key,$v) = split(/;/,$prats); $DAT{$key} = $v; } $z = ($lv-20); if ($nation==$DAT{'camp'} && $DAT{'lv'}>$z){ $tnm = $DAT{'nm'}; #名前 敵 $tlv = $DAT{'lv'}; #レベル 敵 $thp = $DAT{'max_hp'}; #HP $thp_max= $DAT{'max_hp'}; #HP $tmp = $DAT{'max_mp'}; #MP $tua = $DAT{'ua'}; #UA $tud = $DAT{'ud'}; #UD $tag = $DAT{'ag'}; #AG $tcp = $DAT{'camp'}; #所属 $tdf_a = $DAT{'df_a'}; #防具 敵 $tdg_a = $DAT{'dg_a'}; #武具 敵 $tlr = $DAT{'lr'}; #LR $tsol = $g_p[$DAT{'rank'}];#階級 $tsol_lv= $DAT{'sol_lv'}; # $ck=1; } $sach++; } # NPC読み込み if(!$tnm){ require './inc/ore_sub-npc_1.cgi'; local $v=int(rand(5)); &ck_ne_1; } if($nation==1){ $t_cs=$cs1; }elsif($nation==2){ $t_cs=$cs2; }elsif($nation==3){ $t_cs=$cs3; }elsif($nation==4){ $t_cs=$cs4; }elsif($nation==5){ $t_cs=$cs5; } if($tsol<=$t_cs){ $t_cs-=$tsol; }elsif($tsol>$t_cs){ $tsol=$t_cs; } 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($tsol<100){ $log .="$cmp[$nation] 側は\予\備\兵不足の為、市民を急遽徴兵したようだ
\n"; $tsol=$g_p[$DAT{'rank'}]; if($nation==1){ $cn1-=100; $cn1=0 if($cn1<1); }elsif($nation==2){ $cn2-=100; $cn2=0 if($cn2<1); }elsif($nation==3){ $cn3-=100; $cn3=0 if($cn3<1); }elsif($nation==4){ $cn4-=100; $cn4=0 if($cn4<1); }elsif($nation==5){ $cn5-=100; $cn5=0 if($cn5<1); } &hist_write;#国ログ } if($tsol<100){ $tsol=$bs_h[$v]; } $b_n = int((rand(6))+5); $log .="今回の作戦の戦闘限界ターンは $b_n ターンです
\n"; $b_v=0; $log .="
\n"; $log .="$cmp[$nation] から $tnm が率いる防衛部隊が出撃してきた!
\n"; $log .="
\n"; $log .="侵攻作戦を実行に移します!戦闘開始!
\n"; $log2 .="
\n"; $log2 .="\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 の金 と $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 の報酬を得た!
\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 の金 と $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 の報酬を得た!
\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 .="\n"; $log2 .="\n" if($mv_mode eq 'pc'); $log2 .="\n"; $log2 .="\n"; if($tsol<1||$sol<1){ $log2 .="\n"; }elsif($tm==50){ $log2 .=""; }elsif($tm==60){ $log2 .="\n"; }elsif($tm==70){ &spell_sp; }elsif($tm<1){ $log2 .=""; } $log2 .="
";#テーブルずれ修正 $log2 .="$td_end
\n";#テーブル追加 } if($cn1<1&&$ce1<1){ $wr_mes ="$date $cmp[1] が $syogo によって壊滅的損害を受け亡国となりました。"; $ce1=1; &hist_write;#国ログ }elsif($cn2<1&&$ce2<1){ $wr_mes ="$date $cmp[2] が $syogo によって壊滅的損害を受け亡国となりました。"; $ce2=1; &hist_write;#国ログ }elsif($cn3<1&&$ce3<1){ $wr_mes ="$date $cmp[3] が $syogo によって壊滅的損害を受け亡国となりました。"; $ce3=1; &hist_write;#国ログ }elsif($cn4<1&&$ce4<1){ $wr_mes ="$date $cmp[4] が $syogo によって壊滅的損害を受け亡国となりました。"; $ce4=1; &hist_write;#国ログ }elsif($cn5<1&&$ce5<1){ $wr_mes ="$date $cmp[5] が $syogo によって壊滅的損害を受け亡国となりました。"; $ce5=1; &hist_write;#国ログ }elsif($cn1>1000&&$ce1>0){ $wr_mes ="$date $cmp[1] が $syogo の活躍により亡国から復興しました。"; $ce1=0; &hist_write;#国ログ }elsif($cn2>1000&&$ce2>0){ $wr_mes ="$date $cmp[2] が $syogo の活躍により亡国から復興しました。"; $ce2=0; &hist_write;#国ログ }elsif($cn3>1000&&$ce3>0){ $wr_mes ="$date $cmp[3] が $syogo の活躍により亡国から復興しました。"; $ce3=0; &hist_write;#国ログ }elsif($cn4>1000&&$ce4>0){ $wr_mes ="$date $cmp[4] が $syogo の活躍により亡国から復興しました。"; $ce4=0; &hist_write;#国ログ }elsif($cn5>1000&&$ce5>0){ $wr_mes ="$date $cmp[5] が $syogo の活躍により亡国から復興しました。"; $ce5=0; &hist_write;#国ログ } $layout_flag=1; &write_data; &hist_write if($touitu_flag); } #------------------------------------------------------------------------------- #統一処理 sub touitu{ &syogo; if($camp==1){ if($cn1>=$data_reset){ $wr_mes ="$date $cmp[$camp] が $syogo 等の活躍により大陸を制覇しました!!!"; $sogo=1;#覇者記録 $hasya=$nm;#覇者記録 $hcamp=$camp; $touitu_flag=1; } }elsif($camp==2){ if($cn2>=$data_reset){ $wr_mes ="$date $cmp[$camp] が $syogo 等の活躍により大陸を制覇しました!!!"; $sogo=1;#覇者記録 $hasya=$nm;#覇者記録 $hcamp=$camp; $touitu_flag=1; } }elsif($camp==3){ if($cn3>=$data_reset){ $wr_mes ="$date $cmp[$camp] が $syogo 等の活躍により大陸を制覇しました!!!"; $sogo=1;#覇者記録 $hasya=$nm;#覇者記録 $hcamp=$camp; $touitu_flag=1; } }elsif($camp==4){ if($cn4>=$data_reset){ $wr_mes ="$date $cmp[$camp] が $syogo 等の活躍により大陸を制覇しました!!!"; $sogo=1;#覇者記録 $hasya=$nm;#覇者記録 $hcamp=$camp; $touitu_flag=1; } }elsif($camp==5){ if($cn5>=$data_reset){ $wr_mes ="$date $cmp[$camp] が $syogo 等の活躍により大陸を制覇しました!!!"; $sogo=1;#覇者記録 $hasya=$nm;#覇者記録 $hcamp=$camp; $touitu_flag=1; } } } 1;