I've modified "func_attack.php" (netrisk 1.9.7) to defend with 2 or 3 rolls a territory, it's based on $_SESSION['game_rolls'] tath have to set in the login page.
this is the code:
Code:
// NOW DO BATTLE
$attackrolls = array(0,0,0);
if($_SESSION['game_rolls'] == 3){
$defendrolls = array(0,0,0);
}else{
$defendrolls = array(0,0);}
// reset Session data
$_SESSION['defend_rolls'] = $defendrolls;
$_SESSION['attack_rolls'] = $attackrolls;
// generate first roll
$defendrolls[0] = mt_rand(1,6);
$attackrolls[0] = mt_rand(1,6);
// generate additional rolls if necessary
if($opposing_armies > 1){
$defendrolls[1] = mt_rand(1,6); // default defend with 2 which is max if there are 2
if($opposing_armies > 2 && $_SESSION['game_rolls'] == 3) {
$defendrolls[2] = mt_rand(1,6); // generate 3rd defensive roll
}
}
if($attacking_armies > 1){
$attackrolls[1] = mt_rand(1,6); // generate 2nd attack roll
if($attacking_armies > 2)
$attackrolls[2] = mt_rand(1,6); // generate 3rd attack roll
}
rsort($attackrolls); // sort highest to lowest
rsort($defendrolls);
// Save the die rolls as Session data
$_SESSION['defend_rolls'] = $defendrolls;
$_SESSION['attack_rolls'] = $attackrolls;
$attackcasualties = 0;
$defendcasualties = 0;
if($_SESSION['game_rolls'] == 3){
$fighters = 1; // keeps track of what rolls are fighting, subtract 1 to get at correct array index
while($fighters <= 3 && $fighters <= $opposing_armies && $fighters <= $attacking_armies){ // to keep 0's from engaging // 2 instead of attack armies cause
if($attackrolls[$fighters-1] > $defendrolls[$fighters-1]) // you cant have 3 fighting ever in Risk
$defendcasualties -= 1;
else
$attackcasualties -= 1;
$fighters++;
}
}else{
$fighters = 1; // keeps track of what rolls are fighting, subtract 1 to get at correct array index
while($fighters <= 2 && $fighters <= $opposing_armies && $fighters <= $attacking_armies){ // to keep 0's from engaging // 2 instead of attack armies cause
if($attackrolls[$fighters-1] > $defendrolls[$fighters-1]) // you cant have 3 fighting ever in Risk
$defendcasualties -= 1;
else
$attackcasualties -= 1;
$fighters++;
}
}
Maybe you can insert this option in netrisk 2.0
See You!