BlueGit

blue-star tribegen

fix heatwave doing what draught should be doing

timfa Tim Falken · pushed by timfa

Authored 2026-02-05 · 9 months ago

Hash
7c42ecabcfda6472d29cba25346f6dc6ca2a5085
Parent
8d0ee02f
6 files changed +10 −12
web/src/Classes/Tribe.php +1 −0
@@ -834,6 +834,7 @@ class Tribe
834 834 }
835 835 $this->dataStore->heatWaveActive = false;
836 836 $this->dataStore->floodedThisMonth = false;
837 $this->dataStore->draught = false;
837 838
838 839 foreach ($this->kobolds as $kobold) {
839 840 $kobold->resetFatigue();
@@ -834,6 +834,7 @@ class Tribe
834 }
834 }
835 $this->dataStore->heatWaveActive = false;
835 $this->dataStore->heatWaveActive = false;
836 $this->dataStore->floodedThisMonth = false;
836 $this->dataStore->floodedThisMonth = false;
837 $this->dataStore->draught = false;
837
838
838 foreach ($this->kobolds as $kobold) {
839 foreach ($this->kobolds as $kobold) {
839 $kobold->resetFatigue();
840 $kobold->resetFatigue();
web/src/Events/ExplorationEvent.php +2 −2
@@ -82,9 +82,9 @@ class ExplorationEvent extends Event
82 82 $foodBonus = intval($avgIntelligence / 20); // Max +5 food from intelligence
83 83 $totalFood = $baseFood + $foodBonus;
84 84
85 if (!empty($this->tribe->dataStore->heatWaveActive)) {
85 if (!empty($this->tribe->dataStore->draught)) {
86 86 $totalFood = (int) floor($totalFood / 2);
87 $this->story .= "The heat sapped the harvest, cutting it down.";
87 $this->story .= "The drought stunted the forage, cutting it down.\n";
88 88 }
89 89
90 90 $this->tribe->addFood($totalFood);
@@ -82,9 +82,9 @@ class ExplorationEvent extends Event
82 $foodBonus = intval($avgIntelligence / 20); // Max +5 food from intelligence
82 $foodBonus = intval($avgIntelligence / 20); // Max +5 food from intelligence
83 $totalFood = $baseFood + $foodBonus;
83 $totalFood = $baseFood + $foodBonus;
84
84
85 if (!empty($this->tribe->dataStore->heatWaveActive)) {
85 if (!empty($this->tribe->dataStore->draught)) {
86 $totalFood = (int) floor($totalFood / 2);
86 $totalFood = (int) floor($totalFood / 2);
87 $this->story .= "The heat sapped the harvest, cutting it down.";
87 $this->story .= "The drought stunted the forage, cutting it down.\n";
88 }
88 }
89
89
90 $this->tribe->addFood($totalFood);
90 $this->tribe->addFood($totalFood);
web/src/Events/FarmingEvent.php +2 −2
@@ -175,9 +175,9 @@ class FarmingEvent extends Event
175 175 }
176 176
177 177
178 if (!empty($this->tribe->dataStore->heatWaveActive)) {
178 if (!empty($this->tribe->dataStore->draught)) {
179 179 $totalFood = (int) floor($totalFood / 2);
180 $this->story .= "The heat wilted the crops, halving what could be gathered.\n";
180 $this->story .= "The drought wilted the crops, halving what could be gathered.\n";
181 181 }
182 182 $months = $this->tribe->foodMonthsLeft($totalFood);
183 183 $this->tribe->addFood($totalFood);
@@ -175,9 +175,9 @@ class FarmingEvent extends Event
175 }
175 }
176
176
177
177
178 if (!empty($this->tribe->dataStore->heatWaveActive)) {
178 if (!empty($this->tribe->dataStore->draught)) {
179 $totalFood = (int) floor($totalFood / 2);
179 $totalFood = (int) floor($totalFood / 2);
180 $this->story .= "The heat wilted the crops, halving what could be gathered.\n";
180 $this->story .= "The drought wilted the crops, halving what could be gathered.\n";
181 }
181 }
182 $months = $this->tribe->foodMonthsLeft($totalFood);
182 $months = $this->tribe->foodMonthsLeft($totalFood);
183 $this->tribe->addFood($totalFood);
183 $this->tribe->addFood($totalFood);
web/src/Events/HeatWaveEvent.php +0 −2
@@ -37,13 +37,11 @@ class HeatWaveEvent extends MonthEndEvent
37 37
38 38 $this->tribe->dataStore->heatWaveActive = true;
39 39
40 $affected = 0;
41 40 foreach ($this->tribe->getKobolds() as $kobold) {
42 41 $vitality = (int) ($kobold->getStat('vitality') ?? 0);
43 42 $fatigue = (int) ceil($vitality * 0.25);
44 43 if ($fatigue > 0) {
45 44 $kobold->addFatigue($fatigue);
46 $affected++;
47 45 }
48 46 }
49 47
@@ -37,13 +37,11 @@ class HeatWaveEvent extends MonthEndEvent
37
37
38 $this->tribe->dataStore->heatWaveActive = true;
38 $this->tribe->dataStore->heatWaveActive = true;
39
39
40 $affected = 0;
41 foreach ($this->tribe->getKobolds() as $kobold) {
40 foreach ($this->tribe->getKobolds() as $kobold) {
42 $vitality = (int) ($kobold->getStat('vitality') ?? 0);
41 $vitality = (int) ($kobold->getStat('vitality') ?? 0);
43 $fatigue = (int) ceil($vitality * 0.25);
42 $fatigue = (int) ceil($vitality * 0.25);
44 if ($fatigue > 0) {
43 if ($fatigue > 0) {
45 $kobold->addFatigue($fatigue);
44 $kobold->addFatigue($fatigue);
46 $affected++;
47 }
45 }
48 }
46 }
49
47
web/src/Events/HuntingEvent.php +2 −3
@@ -195,10 +195,9 @@ class HuntingEvent extends Event
195 195 }
196 196
197 197 if ($totalFood > 0) {
198 if (!empty($this->tribe->dataStore->heatWaveActive)) {
198 if (!empty($this->tribe->dataStore->draught)) {
199 199 $totalFood = (int) floor($totalFood / 2);
200 $this->story .= "The heat slowed the hunters, cutting the haul in half.
201 ";
200 $this->story .= "The drought thinned the game, cutting the haul in half.\n";
202 201 }
203 202 $months = $this->tribe->foodMonthsLeft($totalFood);
204 203 $this->tribe->addFood($totalFood);
@@ -195,10 +195,9 @@ class HuntingEvent extends Event
195 }
195 }
196
196
197 if ($totalFood > 0) {
197 if ($totalFood > 0) {
198 if (!empty($this->tribe->dataStore->heatWaveActive)) {
198 if (!empty($this->tribe->dataStore->draught)) {
199 $totalFood = (int) floor($totalFood / 2);
199 $totalFood = (int) floor($totalFood / 2);
200 $this->story .= "The heat slowed the hunters, cutting the haul in half.
200 $this->story .= "The drought thinned the game, cutting the haul in half.\n";
201";
202 }
201 }
203 $months = $this->tribe->foodMonthsLeft($totalFood);
202 $months = $this->tribe->foodMonthsLeft($totalFood);
204 $this->tribe->addFood($totalFood);
203 $this->tribe->addFood($totalFood);
web/src/Events/WalkDiscoveryEvent.php +3 −3
@@ -53,7 +53,7 @@ class WalkDiscoveryEvent extends MonthEndEvent
53 53 // Food discovery
54 54 $foodAmount = rand(3, 8);
55 55
56 if (!empty($this->tribe->dataStore->heatWaveActive)) {
56 if (!empty($this->tribe->dataStore->draught)) {
57 57 $foodAmount = (int) floor($foodAmount / 2);
58 58 if ($foodAmount < 1) {
59 59 $foodAmount = 1;
@@ -74,8 +74,8 @@ class WalkDiscoveryEvent extends MonthEndEvent
74 74 ];
75 75
76 76 $this->story = $foodVariations[array_rand($foodVariations)];
77 if (!empty($this->tribe->dataStore->heatWaveActive)) {
78 $this->story .= " The heat kept the find small.";
77 if (!empty($this->tribe->dataStore->draught)) {
78 $this->story .= " The drought kept the find small.";
79 79 }
80 80 } else {
81 81 // Item discovery
@@ -53,7 +53,7 @@ class WalkDiscoveryEvent extends MonthEndEvent
53 // Food discovery
53 // Food discovery
54 $foodAmount = rand(3, 8);
54 $foodAmount = rand(3, 8);
55
55
56 if (!empty($this->tribe->dataStore->heatWaveActive)) {
56 if (!empty($this->tribe->dataStore->draught)) {
57 $foodAmount = (int) floor($foodAmount / 2);
57 $foodAmount = (int) floor($foodAmount / 2);
58 if ($foodAmount < 1) {
58 if ($foodAmount < 1) {
59 $foodAmount = 1;
59 $foodAmount = 1;
@@ -74,8 +74,8 @@ class WalkDiscoveryEvent extends MonthEndEvent
74 ];
74 ];
75
75
76 $this->story = $foodVariations[array_rand($foodVariations)];
76 $this->story = $foodVariations[array_rand($foodVariations)];
77 if (!empty($this->tribe->dataStore->heatWaveActive)) {
77 if (!empty($this->tribe->dataStore->draught)) {
78 $this->story .= " The heat kept the find small.";
78 $this->story .= " The drought kept the find small.";
79 }
79 }
80 } else {
80 } else {
81 // Item discovery
81 // Item discovery