Fix #294 code for brewery

Fix #294 now brewery is fully coded!
This commit is contained in:
novgorodschi catalin
2026-06-29 08:02:09 +03:00
parent b4e54c6ac3
commit a998edc205
18 changed files with 335 additions and 66 deletions
+17 -4
View File
@@ -428,9 +428,22 @@ class Units {
}
}
// Bug fix: Brewery (35) is Teuton-only, capital-only, but empire-wide —
// the catapult-randomization side effect must be checked on the SENDER'S
// CAPITAL (not $village->wid, the village the rally point belongs to,
// which may not be the capital), and only while a Mead-Festival is
// actually active there — not simply because the Brewery is built.
$hasActiveBrewery = false;
if ($session->tribe == 2) {
$senderCapital = $database->getVillage($session->uid, 3);
$hasActiveBrewery = $senderCapital
&& (int)$senderCapital['festival'] > time()
&& $database->getFieldLevelInVillage($senderCapital['wref'], 35) > 0;
}
if(isset($post['ctar1'])) {
//Is the Brewery built?
if($session->tribe != 2 || $database->getFieldLevelInVillage($village->wid, 35) == 0){
//Is the Mead-Festival active?
if(!$hasActiveBrewery){
if($rivalsGreatConfusion['totals'] > 0) {
if($post['ctar1'] != 40 && ($post['ctar1'] != 27 || ($post['ctar1'] == 27 && $rivalsGreatConfusion['unique'] > 0))) {
$post['ctar1'] = 0;
@@ -442,8 +455,8 @@ class Units {
else $post['ctar1'] = 0;
if(isset($post['ctar2']) && $post['ctar2'] > 0) {
//Is the Brewery built?
if($session->tribe != 2 || $database->getFieldLevelInVillage($village->wid, 35) == 0){
//Is the Mead-Festival active?
if(!$hasActiveBrewery){
if($rivalsGreatConfusion['totals'] > 0) {
if ($post['ctar2'] != 40 && ($post['ctar2'] != 27 || ($post['ctar2'] == 27 && $rivalsGreatConfusion['unique'] > 0))) {
$post['ctar2'] = 99;