Add Natars into combat simulator

This commit is contained in:
Martin Kalabek
2024-10-26 21:01:58 +02:00
parent d7411e85b5
commit 1efe104ed2
6 changed files with 357 additions and 4 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ class Battle {
global $form;
// receive form and process
if(isset($post['a1_v']) && (isset($post['a2_v1']) || isset($post['a2_v2']) || isset($post['a2_v3']) || isset($post['a2_v4']))){
if(isset($post['a1_v']) && (isset($post['a2_v1']) || isset($post['a2_v2']) || isset($post['a2_v3']) || isset($post['a2_v4']) || isset($post['a2_v5']))){
$_POST['mytribe'] = $post['a1_v'];
$target = [];
+116
View File
@@ -0,0 +1,116 @@
<table id="attacker" class="fill_in" cellpadding="1" cellspacing="1">
<thead>
<tr>
<th>Attacker</th>
</tr>
</thead>
<tbody>
<tr>
<th>Natars</th>
</tr>
<tr>
<td class="details">
<table cellpadding="1" cellspacing="1"><tr>
<td class="ico">
<img src="img/x.gif" class="unit u41" title="Pikeman" alt="Pikeman" />
</td>
<td class="desc">
Pikeman
</td><td class="value">
<input class="text" type="text" name="a1_1" value="<?php echo $form->getValue('a1_1'); ?>" maxlength="7" title="Number Pikeman" />
</td>
<td class="research">
</td></tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u42" title="Thorned Warrior" alt="Thorned Warrior" />
</td>
<td class="desc">
Thorned Warrior
</td><td class="value">
<input class="text" type="text" name="a1_2" value="<?php echo $form->getValue('a1_2'); ?>" maxlength="7" title="Number Thorned Warrior" />
</td>
</td></tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u43" title="Guardsman" alt="Guardsman" />
</td>
<td class="desc">
Guardsman
</td><td class="value">
<input class="text" type="text" name="a1_3" value="<?php echo $form->getValue('a1_3'); ?>" maxlength="7" title="Number Guardsman" />
</td>
</tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u44" title="Birds Of Prey" alt="Birds Of Prey" />
</td>
<td class="desc">
Birds Of Prey
</td><td class="value">
<input class="text" type="text" name="a1_4" value="<?php echo $form->getValue('a1_4'); ?>" maxlength="7" title="Number Birds Of Prey" />
</td>
</tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u45" title="Axerider" alt="Axerider" />
</td>
<td class="desc">
Axerider
</td><td class="value">
<input class="text" type="text" name="a1_5" value="<?php echo $form->getValue('a1_5'); ?>" maxlength="7" title="Number Axerider" />
</td>
</tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u46" title="Natarian Knight" alt="Natarian Knight" />
</td>
<td class="desc">
Natarian Knight
</td><td class="value">
<input class="text" type="text" name="a1_6" value="<?php echo $form->getValue('a1_6'); ?>" maxlength="7" title="Number Natarian Knight" />
</td>
</tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u47" title="War Elephant" alt="War Elephant" />
</td>
<td class="desc">
War Elephant
</td><td class="value">
<input class="text" type="text" name="a1_7" value="<?php echo $form->getValue('a1_7'); ?>" maxlength="7" title="Number War Elephant" />
</td></tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u48" title="Ballista" alt="Ballista" />
</td>
<td class="desc">
Ballista
</td><td class="value">
<input class="text" type="text" name="a1_8" value="<?php echo $form->getValue('a1_8'); ?>" maxlength="7" title="Number Ballista" />
</td>
</tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u49" title="Natarian Emperor" alt="Natarian Emperor" />
</td>
<td class="desc">
Natarian Emperor
</td><td class="value">
<input class="text" type="text" name="a1_9" value="<?php echo $form->getValue('a1_9'); ?>" maxlength="6" title="Number Natarian Emperor" />
</td>
<td class="research"></td></tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u50" title="Natarian Settler" alt="Natarian Settler" />
</td>
<td class="desc">
Natarian Settler
</td><td class="value">
<input class="text" type="text" name="a1_10" value="<?php echo $form->getValue('a1_10'); ?>" maxlength="6" title="Number Natarian Settler" />
</td>
<td class="research"></td></tr></table>
</td>
</tr>
</tbody></table>
+108
View File
@@ -0,0 +1,108 @@
<tbody>
<tr>
<th>Natars</th>
</tr>
<tr>
<td class="details">
<table cellpadding="1" cellspacing="1"><tr>
<td class="ico">
<img src="img/x.gif" class="unit u41" title="Pikeman" alt="Pikeman" />
</td>
<td class="desc">
Pikeman
</td><td class="value">
<input class="text" type="text" name="a2_41" value="<?php echo $form->getValue('a2_41'); ?>" maxlength="10" title="Number Pikeman" />
</td>
</tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u42" title="Thorned Warrior" alt="Thorned Warrior" />
</td>
<td class="desc">
Thorned Warrior
</td><td class="value">
<input class="text" type="text" name="a2_42" value="<?php echo $form->getValue('a2_42'); ?>" maxlength="10" title="Number Thorned Warrior" />
</td>
</tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u43" title="Guardsman" alt="Guardsman" />
</td>
<td class="desc">
Guardsman
</td><td class="value">
<input class="text" type="text" name="a2_43" value="<?php echo $form->getValue('a2_43'); ?>" maxlength="10" title="Number Guardsman" />
</td>
</tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u44" title="Birds Of Prey" alt="Birds Of Prey" />
</td>
<td class="desc">
Birds Of Prey
</td><td class="value">
<input class="text" type="text" name="a2_44" value="<?php echo $form->getValue('a2_44'); ?>" maxlength="10" title="Number Birds Of Prey" />
</td>
</tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u45" title="Axerider" alt="Axerider" />
</td>
<td class="desc">
Axerider
</td><td class="value">
<input class="text" type="text" name="a2_45" value="<?php echo $form->getValue('a2_45'); ?>" maxlength="10" title="Number Axerider" />
</td>
</tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u46" title="Natarian Knight" alt="Natarian Knight" />
</td>
<td class="desc">
Natarian Knight
</td><td class="value">
<input class="text" type="text" name="a2_46" value="<?php echo $form->getValue('a2_46'); ?>" maxlength="10" title="Number Natarian Knight" />
</td>
</tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u47" title="War Elephant" alt="War Elephant" />
</td>
<td class="desc">
War Elephant
</td><td class="value">
<input class="text" type="text" name="a2_47" value="<?php echo $form->getValue('a2_47'); ?>" maxlength="10" title="Number War Elephant" />
</td>
</tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u48" title="Ballista" alt="Ballista" />
</td>
<td class="desc">
Ballista
</td><td class="value">
<input class="text" type="text" name="a2_48" value="<?php echo $form->getValue('a2_48'); ?>" maxlength="10" title="Number Ballista" />
</td>
</tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u49" title="Natarian Emperor" alt="Natarian Emperor" />
</td>
<td class="desc">
Natarian Emperor
</td><td class="value">
<input class="text" type="text" name="a2_49" value="<?php echo $form->getValue('a2_49'); ?>" maxlength="6" title="Number Natarian Emperor" />
</td>
</tr><tr>
<td class="ico">
<img src="img/x.gif" class="unit u50" title="Natarian Settler" alt="Natarian Settler" />
</td>
<td class="desc">
Natarian Settler
</td><td class="value">
<input class="text" type="text" name="a2_50" value="<?php echo $form->getValue('a2_50'); ?>" maxlength="6" title="Number Natarian Settler" />
</td>
</tr></table>
</td>
</tr>
</tbody>
+64
View File
@@ -0,0 +1,64 @@
<table class="results attacker" cellpadding="1" cellspacing="1">
<thead>
<tr>
<td class="role">
Attacker
</td><td>
<img src="img/x.gif" class="unit u41" title="Pikeman" alt="Pikeman" />
</td><td>
<img src="img/x.gif" class="unit u42" title="Thorned Warrior" alt="Thorned Warrior" />
</td><td>
<img src="img/x.gif" class="unit u43" title="Guardsman" alt="Guardsman" />
</td><td>
<img src="img/x.gif" class="unit u44" title="Birds Of Prey" alt="Birds Of Prey"r" />
</td><td>
<img src="img/x.gif" class="unit u45" title="Axerider" alt="Axerider" />
</td><td>
<img src="img/x.gif" class="unit u46" title="Natarian Knight" alt="Natarian Knight" />
</td><td>
<img src="img/x.gif" class="unit u47" title="War Elephant" alt="War Elephant" />
</td><td>
<img src="img/x.gif" class="unit u48" title="Ballista" alt="Ballista" />
</td><td>
<img src="img/x.gif" class="unit u49" title="Natarian Emperor" alt="Natarian Emperor" />
</td><td>
<img src="img/x.gif" class="unit u50" title="Natarian Settler" alt="Natarian Settler" />
</td>
</tr>
</thead>
<tbody>
<tr>
<th>
Troops
</th>
<td <?php if (!$form->getValue('a1_1')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a1_1');} ?></td>
<td <?php if (!$form->getValue('a1_2')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a1_2');} ?></td>
<td <?php if (!$form->getValue('a1_3')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a1_3');} ?></td>
<td <?php if (!$form->getValue('a1_4')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a1_4');} ?></td>
<td <?php if (!$form->getValue('a1_5')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a1_5');} ?></td>
<td <?php if (!$form->getValue('a1_6')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a1_6');} ?></td>
<td <?php if (!$form->getValue('a1_7')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a1_7');} ?></td>
<td <?php if (!$form->getValue('a1_8')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a1_8');} ?></td>
<td <?php if (!$form->getValue('a1_9')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a1_9');} ?></td>
<td <?php if (!$form->getValue('a1_10')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a1_10');} ?></td>
</tr>
<tr>
<th>
Casualties
</th>
<td <?php if (!$troops = $form->getValue('a1_1')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][1]);} ?></td>
<td <?php if (!$troops = $form->getValue('a1_2')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][1]);} ?></td>
<td <?php if (!$troops = $form->getValue('a1_3')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][1]);} ?></td>
<td <?php if (!$troops = $form->getValue('a1_4')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][1]);} ?></td>
<td <?php if (!$troops = $form->getValue('a1_5')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][1]);} ?></td>
<td <?php if (!$troops = $form->getValue('a1_6')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][1]);} ?></td>
<td <?php if (!$troops = $form->getValue('a1_7')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][1]);} ?></td>
<td <?php if (!$troops = $form->getValue('a1_8')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][1]);} ?></td>
<td <?php if (!$troops = $form->getValue('a1_9')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][1]);} ?></td>
<td <?php if (!$troops = $form->getValue('a1_10')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][1]);} ?></td>
</tr>
</tbody>
</table>
+64
View File
@@ -0,0 +1,64 @@
<table class="results defender" cellpadding="1" cellspacing="1">
<thead>
<tr>
<td class="role">
Defender
</td><td>
<img src="img/x.gif" class="unit u41" title="Pikeman" alt="Pikeman" />
</td><td>
<img src="img/x.gif" class="unit u42" title="Thorned Warrior" alt="Thorned Warrior" />
</td><td>
<img src="img/x.gif" class="unit u43" title="Guardsman" alt="Guardsman" />
</td><td>
<img src="img/x.gif" class="unit u44" title="Birds Of Prey" alt="Birds Of Prey"r" />
</td><td>
<img src="img/x.gif" class="unit u45" title="Axerider" alt="Axerider" />
</td><td>
<img src="img/x.gif" class="unit u46" title="Natarian Knight" alt="Natarian Knight" />
</td><td>
<img src="img/x.gif" class="unit u47" title="War Elephant" alt="War Elephant" />
</td><td>
<img src="img/x.gif" class="unit u48" title="Ballista" alt="Ballista" />
</td><td>
<img src="img/x.gif" class="unit u49" title="Natarian Emperor" alt="Natarian Emperor" />
</td><td>
<img src="img/x.gif" class="unit u50" title="Natarian Settler" alt="Natarian Settler" />
</td>
</thead>
<tbody>
<tr>
<th>
Troops
</th>
<td <?php if (!$form->getValue('a2_41')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a2_41');} ?></td>
<td <?php if (!$form->getValue('a2_42')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a2_42');} ?></td>
<td <?php if (!$form->getValue('a2_43')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a2_43');} ?></td>
<td <?php if (!$form->getValue('a2_44')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a2_44');} ?></td>
<td <?php if (!$form->getValue('a2_45')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a2_45');} ?></td>
<td <?php if (!$form->getValue('a2_46')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a2_46');} ?></td>
<td <?php if (!$form->getValue('a2_47')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a2_47');} ?></td>
<td <?php if (!$form->getValue('a2_48')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a2_48');} ?></td>
<td <?php if (!$form->getValue('a2_49')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a2_49');} ?></td>
<td <?php if (!$form->getValue('a2_50')) { echo "class=\"none\">0"; }else{ echo ">".$form->getValue('a2_50');} ?></td>
</tr>
<tr>
<th>
Casualties
</th>
</th>
<td <?php if (!$troops = $form->getValue('a2_41')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][2]);} ?></td>
<td <?php if (!$troops = $form->getValue('a2_42')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][2]);} ?></td>
<td <?php if (!$troops = $form->getValue('a2_43')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][2]);} ?></td>
<td <?php if (!$troops = $form->getValue('a2_44')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][2]);} ?></td>
<td <?php if (!$troops = $form->getValue('a2_45')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][2]);} ?></td>
<td <?php if (!$troops = $form->getValue('a2_46')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][2]);} ?></td>
<td <?php if (!$troops = $form->getValue('a2_47')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][2]);} ?></td>
<td <?php if (!$troops = $form->getValue('a2_48')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][2]);} ?></td>
<td <?php if (!$troops = $form->getValue('a2_49')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][2]);} ?></td>
<td <?php if (!$troops = $form->getValue('a2_50')) { echo "class=\"none\">0"; }else{ echo ">".$dead = round($troops * $_POST['result'][2]);} ?></td>
</tr>
</tbody>
</table>
+4 -3
View File
@@ -146,13 +146,14 @@ if(count($target) > 0) {
<td>
<label><input class="radio" type="radio" name="a1_v" value="1" <?php if($tribe == 1) { echo "checked"; } ?>/> Romans</label><br/>
<label><input class="radio" type="radio" name="a1_v" value="2" <?php if($tribe == 2) { echo "checked"; } ?>/> Teutons</label><br/>
<label><input class="radio" type="radio" name="a1_v" value="3" <?php if($tribe == 3) { echo "checked"; } ?>/> Gauls</label>
<label><input class="radio" type="radio" name="a1_v" value="3" <?php if($tribe == 3) { echo "checked"; } ?>/> Gauls</label><br/>
<label><input class="radio" type="radio" name="a1_v" value="5" <?php if($tribe == 3) { echo "checked"; } ?>/> Natars</label>
</td><td>
<label><input class="check" type="checkbox" name="a2_v1" value="1" <?php if(in_array(1,$target)) { echo "checked"; } ?>/> Romans</label><br/>
<label><input class="check" type="checkbox" name="a2_v2" value="1" <?php if(in_array(2,$target)) { echo "checked"; } ?>/> Teutons</label><br/>
<label><input class="check" type="checkbox" name="a2_v3" value="1" <?php if(in_array(3,$target)) { echo "checked"; } ?>/> Gauls</label><br/>
<label><input class="check" type="checkbox" name="a2_v4" value="1" <?php if(in_array(4,$target)) { echo "checked"; } ?>/> Nature</label>
<label><input class="check" type="checkbox" name="a2_v4" value="1" <?php if(in_array(4,$target)) { echo "checked"; } ?>/> Nature</label><br/>
<label><input class="check" type="checkbox" name="a2_v5" value="1" <?php if(in_array(5,$target)) { echo "checked"; } ?>/> Natars</label>
</td><td>
<label><input class="radio" type="radio" name="ktyp" value="0" <?php if($form->getValue('ktyp') == 0 || $form->getValue('ktyp') == "") { echo "checked"; } ?>/> normal</label><br/>