diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php
index 7043f9d0..4d316dbc 100644
--- a/GameEngine/Automation.php
+++ b/GameEngine/Automation.php
@@ -4124,6 +4124,7 @@ $wallimg = "
modifyEnforce($enf, $maxtype, $killunits, 0);
+ if($maxtype == "hero" && $maxcount > 0){
+ $heroid = $database->getHeroField($database->getVillageField($enf_vill,"owner"),"heroid");
+ $database->modifyHero("dead", 1, $heroid);
+ }
$database->setVillageField($starv['wref'], 'starv', $upkeep);
$database->setVillageField($starv['wref'], 'starvupdate', $time);
}else{
@@ -4177,6 +4182,8 @@ $wallimg = "
getHeroField($database->getVillageField($enf_vill,"owner"),"heroid");
+ $database->modifyHero("dead", 1, $heroid);
$database->deleteReinf($enf);
$killunits -= $maxcount;
}
@@ -4188,11 +4195,18 @@ $wallimg = "
modifyUnit($starv['wref'], array($maxtype), array($killunits), array(0));
$killunits = 0;
+ if($maxtype == "hero" && $maxcount > 0){
+ $heroid = $database->getHeroField($database->getVillageField($starv['wref'],"owner"),"heroid");
+ $database->modifyHero("dead", 1, $heroid);
+ }
$database->setVillageField($starv['wref'], 'starv', $upkeep);
$database->setVillageField($starv['wref'], 'starvupdate', $time);
}else{
- $database->modifyUnit($starv['wref'], array($maxtype), array($killunits), array(0));
+ $database->modifyUnit($starv['wref'], array($maxtype), array($maxcount), array(0));
+ if($maxtype != "hero"){
$killunits -= $maxcount;
+ $unitarray['u'.$maxtype] = 0;
+ $maxcount = 0;
for($i = 0 ; $i <= 50 ; $i++){
$units = $unitarray['u'.$i];
if($unitarray['u'.$i] > $maxcount){
@@ -4205,6 +4219,13 @@ $wallimg = "
0){
+ $heroid = $database->getHeroField($database->getVillageField($starv['wref'],"owner"),"heroid");
+ $database->modifyHero("dead", 1, $heroid);
+ }
+ $killunits = 0;
+ }
$database->setVillageField($starv['wref'], 'starv', $upkeep);
$database->setVillageField($starv['wref'], 'starvupdate', $time);
}