test
@@ -27,6 +27,22 @@
27
27
- **Creating New Events**: Extend `Event`, implement `execute()`, return narrative story via `$this->story`
28
28
- **Example**: [ExplorationEvent](src/Events/ExplorationEvent.php) — shows stat-based mechanics (intelligence affects food discovery, vitality reduces injury chance), food addition via `$tribe->addFood()`, and injury creation as array appended to kobold's injuries list
29
29
30
### Event Requirements And Scheduling
31
- **Month-end selection**: `Tribe::getEndOfMonthEvents()` filters by `isEndOfMonth()`, `isAvailable()`, `getMinAge()`, and `getMinParticipants()` before selecting events. `isAvailable()` must return false when an event cannot execute to avoid consuming cost budget.
32
- **Participant counts**: `getMinParticipants()` and `getMaxParticipants()` must reflect actual required participants for the event.
33
- **Participant bounds**: `getMaxParticipants()` must always be greater than or equal to `getMinParticipants()`.
34
- **Age gating**: `getMinAge()` should reflect the minimum required age for any kobold involved.
35
- **Monthly weather flags**: `endMonth()` resets `dataStore->heatWaveActive` and `dataStore->floodedThisMonth` at month start. Flood events set `floodedThisMonth = true`. Heat waves set `heatWaveActive = true`.
36
- **Drought rule**: Drought is summer-only and must not occur if `floodedThisMonth` is true.
37
- **Heat wave rule**: Heat wave is summer-only and causes all kobolds to gain 25% of vitality as fatigue. Food gathered in exploration, hunting, farming, and walk discovery is halved when `heatWaveActive` is true.
38
- **Event-specific availability**:
39
- Childcare bond: requires at least one adult and at least one baby/young, min participants 2.
40
- Jealous item: requires at least two eligible kobolds and at least one with an item, min participants 2.
41
- Incompetence frustration: requires at least two eligible kobolds and a target whose highest stat is 50-60, min participants 2.
42
- Small flood: spring or autumn only.
43
- Large flood: autumn only.
44
- Big storm: any season.
45
30
46
## API Endpoints
31
47
32
48
All endpoints in [src/api/game.php](src/api/game.php) require `userId` and `saveId` in POST body:
@@ -27,6 +27,22 @@27
- **Creating New Events**: Extend `Event`, implement `execute()`, return narrative story via `$this->story`27
- **Creating New Events**: Extend `Event`, implement `execute()`, return narrative story via `$this->story`28
- **Example**: [ExplorationEvent](src/Events/ExplorationEvent.php) — shows stat-based mechanics (intelligence affects food discovery, vitality reduces injury chance), food addition via `$tribe->addFood()`, and injury creation as array appended to kobold's injuries list28
- **Example**: [ExplorationEvent](src/Events/ExplorationEvent.php) — shows stat-based mechanics (intelligence affects food discovery, vitality reduces injury chance), food addition via `$tribe->addFood()`, and injury creation as array appended to kobold's injuries list29
29
30
### Event Requirements And Scheduling31
- **Month-end selection**: `Tribe::getEndOfMonthEvents()` filters by `isEndOfMonth()`, `isAvailable()`, `getMinAge()`, and `getMinParticipants()` before selecting events. `isAvailable()` must return false when an event cannot execute to avoid consuming cost budget.32
- **Participant counts**: `getMinParticipants()` and `getMaxParticipants()` must reflect actual required participants for the event.33
- **Participant bounds**: `getMaxParticipants()` must always be greater than or equal to `getMinParticipants()`.34
- **Age gating**: `getMinAge()` should reflect the minimum required age for any kobold involved.35
- **Monthly weather flags**: `endMonth()` resets `dataStore->heatWaveActive` and `dataStore->floodedThisMonth` at month start. Flood events set `floodedThisMonth = true`. Heat waves set `heatWaveActive = true`.36
- **Drought rule**: Drought is summer-only and must not occur if `floodedThisMonth` is true.37
- **Heat wave rule**: Heat wave is summer-only and causes all kobolds to gain 25% of vitality as fatigue. Food gathered in exploration, hunting, farming, and walk discovery is halved when `heatWaveActive` is true.38
- **Event-specific availability**:39
- Childcare bond: requires at least one adult and at least one baby/young, min participants 2.40
- Jealous item: requires at least two eligible kobolds and at least one with an item, min participants 2.41
- Incompetence frustration: requires at least two eligible kobolds and a target whose highest stat is 50-60, min participants 2.42
- Small flood: spring or autumn only.43
- Large flood: autumn only.44
- Big storm: any season.45
30
## API Endpoints46
## API Endpoints31
47
32
All endpoints in [src/api/game.php](src/api/game.php) require `userId` and `saveId` in POST body:48
All endpoints in [src/api/game.php](src/api/game.php) require `userId` and `saveId` in POST body:@@ -829,6 +829,12 @@ class Tribe
829
829
{
830
830
$this->currentMonth++;
831
831
832
if (!isset($this->dataStore)) {
833
$this->dataStore = new stdClass();
834
}
835
$this->dataStore->heatWaveActive = false;
836
$this->dataStore->floodedThisMonth = false;
837
832
838
foreach ($this->kobolds as $kobold) {
833
839
$kobold->resetFatigue();
834
840
}
@@ -899,6 +905,29 @@ class Tribe
899
905
$monthEventStory = '';
900
906
$endOfMonthEvents = $this->getEndOfMonthEvents();
901
907
908
$hasFloodEvent = false;
909
$hasHeatWaveEvent = false;
910
foreach ($endOfMonthEvents as $event) {
911
$className = get_class($event);
912
if ($className === 'SmallFloodEvent' || $className === 'LargeFloodEvent') {
913
$hasFloodEvent = true;
914
}
915
if ($className === 'HeatWaveEvent') {
916
$hasHeatWaveEvent = true;
917
}
918
}
919
920
if ($hasHeatWaveEvent) {
921
$this->dataStore->heatWaveActive = true;
922
}
923
924
if ($hasFloodEvent) {
925
$this->dataStore->floodedThisMonth = true;
926
$endOfMonthEvents = array_values(array_filter($endOfMonthEvents, function ($event) {
927
return get_class($event) !== 'DroughtEvent';
928
}));
929
}
930
902
931
foreach ($endOfMonthEvents as $event) {
903
932
// Select eligible participants
904
933
$eligible = array_filter($this->getAliveKobolds(), function ($kobold) use ($event) {
@@ -829,6 +829,12 @@ class Tribe829
{829
{830
$this->currentMonth++;830
$this->currentMonth++;831
831
832
if (!isset($this->dataStore)) {833
$this->dataStore = new stdClass();834
}835
$this->dataStore->heatWaveActive = false;836
$this->dataStore->floodedThisMonth = false;837
832
foreach ($this->kobolds as $kobold) {838
foreach ($this->kobolds as $kobold) {833
$kobold->resetFatigue();839
$kobold->resetFatigue();834
}840
}@@ -899,6 +905,29 @@ class Tribe899
$monthEventStory = '';905
$monthEventStory = '';900
$endOfMonthEvents = $this->getEndOfMonthEvents();906
$endOfMonthEvents = $this->getEndOfMonthEvents();901
907
908
$hasFloodEvent = false;909
$hasHeatWaveEvent = false;910
foreach ($endOfMonthEvents as $event) {911
$className = get_class($event);912
if ($className === 'SmallFloodEvent' || $className === 'LargeFloodEvent') {913
$hasFloodEvent = true;914
}915
if ($className === 'HeatWaveEvent') {916
$hasHeatWaveEvent = true;917
}918
}919
920
if ($hasHeatWaveEvent) {921
$this->dataStore->heatWaveActive = true;922
}923
924
if ($hasFloodEvent) {925
$this->dataStore->floodedThisMonth = true;926
$endOfMonthEvents = array_values(array_filter($endOfMonthEvents, function ($event) {927
return get_class($event) !== 'DroughtEvent';928
}));929
}930
902
foreach ($endOfMonthEvents as $event) {931
foreach ($endOfMonthEvents as $event) {903
// Select eligible participants932
// Select eligible participants904
$eligible = array_filter($this->getAliveKobolds(), function ($kobold) use ($event) {933
$eligible = array_filter($this->getAliveKobolds(), function ($kobold) use ($event) {@@ -0,0 +1,78 @@
1
<?php
2
3
require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4
5
class BigStormEvent extends MonthEndEvent
6
{
7
public function getMinAge()
8
{
9
return 0;
10
}
11
12
public function getMinParticipants()
13
{
14
return 0;
15
}
16
17
public function getMaxParticipants()
18
{
19
return 0;
20
}
21
22
public function getCost()
23
{
24
return 55;
25
}
26
27
public function isAvailable()
28
{
29
return true;
30
}
31
32
public function execute()
33
{
34
if (!isset($this->tribe->dataStore)) {
35
$this->tribe->dataStore = new stdClass();
36
}
37
38
$foodLost = 0;
39
$currentFood = $this->tribe->getFoodCount();
40
if ($currentFood > 0 && rand(1, 100) <= 70) {
41
$percent = rand(5, 20);
42
$foodLost = (int) floor($currentFood * ($percent / 100));
43
if ($foodLost > 0) {
44
$this->tribe->removeFood($foodLost);
45
}
46
}
47
48
$lightningVictim = null;
49
if (rand(1, 100) <= 5) {
50
$alive = array_values($this->tribe->getAliveKobolds());
51
if (!empty($alive)) {
52
$lightningVictim = $alive[array_rand($alive)];
53
$lightningVictim->die();
54
}
55
}
56
57
$intros = [
58
"A violent storm rolled over the tribe, tearing at tents and shaking the ground.",
59
"Dark clouds gathered quickly, and a brutal storm swept across the camp.",
60
"Wind and rain arrived in force, and the tribe huddled through a fierce storm."
61
];
62
63
$details = [];
64
if ($foodLost > 0) {
65
$details[] = "Some stores were ruined in the downpour, costing the tribe {$this->tribe->foodTimeStr($foodLost)} of food.";
66
} else {
67
$details[] = "The stores held up better than expected, and no food was lost.";
68
}
69
70
if ($lightningVictim) {
71
$details[] = "Tragedy struck when lightning found {$lightningVictim->getName()}, and the tribe mourned the loss.";
72
} else {
73
$details[] = "No one was lost to the storm, though the camp will remember the night.";
74
}
75
76
$this->story = $intros[array_rand($intros)] . ' ' . $details[0] . ' ' . $details[1];
77
}
78
}
@@ -0,0 +1,78 @@1
<?php2
3
require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';4
5
class BigStormEvent extends MonthEndEvent6
{7
public function getMinAge()8
{9
return 0;10
}11
12
public function getMinParticipants()13
{14
return 0;15
}16
17
public function getMaxParticipants()18
{19
return 0;20
}21
22
public function getCost()23
{24
return 55;25
}26
27
public function isAvailable()28
{29
return true;30
}31
32
public function execute()33
{34
if (!isset($this->tribe->dataStore)) {35
$this->tribe->dataStore = new stdClass();36
}37
38
$foodLost = 0;39
$currentFood = $this->tribe->getFoodCount();40
if ($currentFood > 0 && rand(1, 100) <= 70) {41
$percent = rand(5, 20);42
$foodLost = (int) floor($currentFood * ($percent / 100));43
if ($foodLost > 0) {44
$this->tribe->removeFood($foodLost);45
}46
}47
48
$lightningVictim = null;49
if (rand(1, 100) <= 5) {50
$alive = array_values($this->tribe->getAliveKobolds());51
if (!empty($alive)) {52
$lightningVictim = $alive[array_rand($alive)];53
$lightningVictim->die();54
}55
}56
57
$intros = [58
"A violent storm rolled over the tribe, tearing at tents and shaking the ground.",59
"Dark clouds gathered quickly, and a brutal storm swept across the camp.",60
"Wind and rain arrived in force, and the tribe huddled through a fierce storm."61
];62
63
$details = [];64
if ($foodLost > 0) {65
$details[] = "Some stores were ruined in the downpour, costing the tribe {$this->tribe->foodTimeStr($foodLost)} of food.";66
} else {67
$details[] = "The stores held up better than expected, and no food was lost.";68
}69
70
if ($lightningVictim) {71
$details[] = "Tragedy struck when lightning found {$lightningVictim->getName()}, and the tribe mourned the loss.";72
} else {73
$details[] = "No one was lost to the storm, though the camp will remember the night.";74
}75
76
$this->story = $intros[array_rand($intros)] . ' ' . $details[0] . ' ' . $details[1];77
}78
}@@ -0,0 +1,96 @@
1
<?php
2
3
require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4
5
class ChildcareBondEvent extends MonthEndEvent
6
{
7
public function getMinAge()
8
{
9
return 0;
10
}
11
12
public function getMinParticipants()
13
{
14
return 2;
15
}
16
17
public function getMaxParticipants()
18
{
19
return 150;
20
}
21
22
public function getCost()
23
{
24
return 35;
25
}
26
27
public function isAvailable()
28
{
29
$adults = array_filter($this->tribe->getKobolds(), function ($kobold) {
30
return $kobold->getAgeCategory() === 'adult';
31
});
32
33
if (empty($adults)) {
34
return false;
35
}
36
37
$children = array_filter($this->tribe->getKobolds(), function ($kobold) {
38
return $kobold->getAgeCategory() === 'baby' || $kobold->getAgeCategory() === 'young';
39
});
40
41
return !empty($children);
42
}
43
44
private function ensureLikes($kobold)
45
{
46
if (!isset($kobold->dataStore)) {
47
$kobold->dataStore = new stdClass();
48
}
49
if (!isset($kobold->dataStore->likes) || !is_array($kobold->dataStore->likes)) {
50
$kobold->dataStore->likes = [];
51
}
52
}
53
54
public function execute()
55
{
56
$adults = array_values(array_filter($this->tribe->getKobolds(), function ($kobold) {
57
return $kobold->getAgeCategory() === 'adult';
58
}));
59
60
$children = array_values(array_filter($this->tribe->getKobolds(), function ($kobold) {
61
return $kobold->getAgeCategory() === 'baby' || $kobold->getAgeCategory() === 'young';
62
}));
63
64
if (empty($adults) || empty($children)) {
65
return;
66
}
67
68
$caretaker = $adults[array_rand($adults)];
69
shuffle($children);
70
$count = rand(1, min(3, count($children)));
71
$wards = array_slice($children, 0, $count);
72
73
$this->ensureLikes($caretaker);
74
foreach ($wards as $ward) {
75
$this->ensureLikes($ward);
76
$caretaker->dataStore->likes[$ward->getId()] = ($caretaker->dataStore->likes[$ward->getId()] ?? 0) + 2;
77
$ward->dataStore->likes[$caretaker->getId()] = ($ward->dataStore->likes[$caretaker->getId()] ?? 0) + 2;
78
}
79
80
$wardNames = array_map(fn($k) => $k->getName(), $wards);
81
$namesText = implode(', ', $wardNames);
82
83
$variations = [
84
"{$caretaker->getName()} spent the month watching over {$namesText}, tending to their needs and sharing stories. The time together warmed their bond and left the young ones more trusting.",
85
"With the camp busy, {$caretaker->getName()} took care of {$namesText}. The simple acts of care grew mutual affection between them.",
86
"{$caretaker->getName()} guided {$namesText} through chores and play. By month's end, the tribe noticed their growing fondness."
87
];
88
89
$this->story = $variations[array_rand($variations)];
90
91
$caretaker->save();
92
foreach ($wards as $ward) {
93
$ward->save();
94
}
95
}
96
}
@@ -0,0 +1,96 @@1
<?php2
3
require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';4
5
class ChildcareBondEvent extends MonthEndEvent6
{7
public function getMinAge()8
{9
return 0;10
}11
12
public function getMinParticipants()13
{14
return 2;15
}16
17
public function getMaxParticipants()18
{19
return 150;20
}21
22
public function getCost()23
{24
return 35;25
}26
27
public function isAvailable()28
{29
$adults = array_filter($this->tribe->getKobolds(), function ($kobold) {30
return $kobold->getAgeCategory() === 'adult';31
});32
33
if (empty($adults)) {34
return false;35
}36
37
$children = array_filter($this->tribe->getKobolds(), function ($kobold) {38
return $kobold->getAgeCategory() === 'baby' || $kobold->getAgeCategory() === 'young';39
});40
41
return !empty($children);42
}43
44
private function ensureLikes($kobold)45
{46
if (!isset($kobold->dataStore)) {47
$kobold->dataStore = new stdClass();48
}49
if (!isset($kobold->dataStore->likes) || !is_array($kobold->dataStore->likes)) {50
$kobold->dataStore->likes = [];51
}52
}53
54
public function execute()55
{56
$adults = array_values(array_filter($this->tribe->getKobolds(), function ($kobold) {57
return $kobold->getAgeCategory() === 'adult';58
}));59
60
$children = array_values(array_filter($this->tribe->getKobolds(), function ($kobold) {61
return $kobold->getAgeCategory() === 'baby' || $kobold->getAgeCategory() === 'young';62
}));63
64
if (empty($adults) || empty($children)) {65
return;66
}67
68
$caretaker = $adults[array_rand($adults)];69
shuffle($children);70
$count = rand(1, min(3, count($children)));71
$wards = array_slice($children, 0, $count);72
73
$this->ensureLikes($caretaker);74
foreach ($wards as $ward) {75
$this->ensureLikes($ward);76
$caretaker->dataStore->likes[$ward->getId()] = ($caretaker->dataStore->likes[$ward->getId()] ?? 0) + 2;77
$ward->dataStore->likes[$caretaker->getId()] = ($ward->dataStore->likes[$caretaker->getId()] ?? 0) + 2;78
}79
80
$wardNames = array_map(fn($k) => $k->getName(), $wards);81
$namesText = implode(', ', $wardNames);82
83
$variations = [84
"{$caretaker->getName()} spent the month watching over {$namesText}, tending to their needs and sharing stories. The time together warmed their bond and left the young ones more trusting.",85
"With the camp busy, {$caretaker->getName()} took care of {$namesText}. The simple acts of care grew mutual affection between them.",86
"{$caretaker->getName()} guided {$namesText} through chores and play. By month's end, the tribe noticed their growing fondness."87
];88
89
$this->story = $variations[array_rand($variations)];90
91
$caretaker->save();92
foreach ($wards as $ward) {93
$ward->save();94
}95
}96
}@@ -0,0 +1,56 @@
1
<?php
2
3
require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4
5
class DroughtEvent extends MonthEndEvent
6
{
7
public function getMinAge()
8
{
9
return 0;
10
}
11
12
public function getMinParticipants()
13
{
14
return 0;
15
}
16
17
public function getMaxParticipants()
18
{
19
return 0;
20
}
21
22
public function getCost()
23
{
24
return 45;
25
}
26
27
public function isAvailable()
28
{
29
if ($this->tribe->getCurrentSeason() !== 'summer') {
30
return false;
31
}
32
33
if (isset($this->tribe->dataStore) && isset($this->tribe->dataStore->floodedThisMonth) && $this->tribe->dataStore->floodedThisMonth) {
34
return false;
35
}
36
37
return true;
38
}
39
40
public function execute()
41
{
42
if (!isset($this->tribe->dataStore)) {
43
$this->tribe->dataStore = new stdClass();
44
}
45
46
$this->tribe->dataStore->draught = true;
47
48
$variations = [
49
"The heat lingered and the land cracked. No rain came, and the tribe marked the month as a drought, watching the streams grow thin.",
50
"Summer skies stayed empty of rain. The tribe endured a drought and set aside what little moisture remained.",
51
"Days passed with no relief, and the camp felt the weight of drought. The elders warned that the dry season might worsen before it breaks."
52
];
53
54
$this->story = $variations[array_rand($variations)];
55
}
56
}
@@ -0,0 +1,56 @@1
<?php2
3
require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';4
5
class DroughtEvent extends MonthEndEvent6
{7
public function getMinAge()8
{9
return 0;10
}11
12
public function getMinParticipants()13
{14
return 0;15
}16
17
public function getMaxParticipants()18
{19
return 0;20
}21
22
public function getCost()23
{24
return 45;25
}26
27
public function isAvailable()28
{29
if ($this->tribe->getCurrentSeason() !== 'summer') {30
return false;31
}32
33
if (isset($this->tribe->dataStore) && isset($this->tribe->dataStore->floodedThisMonth) && $this->tribe->dataStore->floodedThisMonth) {34
return false;35
}36
37
return true;38
}39
40
public function execute()41
{42
if (!isset($this->tribe->dataStore)) {43
$this->tribe->dataStore = new stdClass();44
}45
46
$this->tribe->dataStore->draught = true;47
48
$variations = [49
"The heat lingered and the land cracked. No rain came, and the tribe marked the month as a drought, watching the streams grow thin.",50
"Summer skies stayed empty of rain. The tribe endured a drought and set aside what little moisture remained.",51
"Days passed with no relief, and the camp felt the weight of drought. The elders warned that the dry season might worsen before it breaks."52
];53
54
$this->story = $variations[array_rand($variations)];55
}56
}@@ -82,6 +82,11 @@ 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)) {
86
$totalFood = (int) floor($totalFood / 2);
87
$this->story .= "The heat sapped the harvest, cutting it down.";
88
}
89
85
90
$this->tribe->addFood($totalFood);
86
91
$this->story .= "Success! The explorers discovered edible plants and small game.\n";
87
92
$this->story .= "The tribe gained " . $this->tribe->foodTimeStr($totalFood) . " of food.\n\n";
@@ -82,6 +82,11 @@ class ExplorationEvent extends Event82
$foodBonus = intval($avgIntelligence / 20); // Max +5 food from intelligence82
$foodBonus = intval($avgIntelligence / 20); // Max +5 food from intelligence83
$totalFood = $baseFood + $foodBonus;83
$totalFood = $baseFood + $foodBonus;84
84
85
if (!empty($this->tribe->dataStore->heatWaveActive)) {86
$totalFood = (int) floor($totalFood / 2);87
$this->story .= "The heat sapped the harvest, cutting it down.";88
}89
85
$this->tribe->addFood($totalFood);90
$this->tribe->addFood($totalFood);86
$this->story .= "Success! The explorers discovered edible plants and small game.\n";91
$this->story .= "Success! The explorers discovered edible plants and small game.\n";87
$this->story .= "The tribe gained " . $this->tribe->foodTimeStr($totalFood) . " of food.\n\n";92
$this->story .= "The tribe gained " . $this->tribe->foodTimeStr($totalFood) . " of food.\n\n";@@ -174,6 +174,11 @@ class FarmingEvent extends Event
174
174
$this->story .= "Despite {$bestVit->getName()} working the hardest out of everyone, it was {$mostFarmedBy} who harvested the most food for the tribe.\n";
175
175
}
176
176
177
178
if (!empty($this->tribe->dataStore->heatWaveActive)) {
179
$totalFood = (int) floor($totalFood / 2);
180
$this->story .= "The heat wilted the crops, halving what could be gathered.\n";
181
}
177
182
$months = $this->tribe->foodMonthsLeft($totalFood);
178
183
$this->tribe->addFood($totalFood);
179
184
@@ -174,6 +174,11 @@ class FarmingEvent extends Event174
$this->story .= "Despite {$bestVit->getName()} working the hardest out of everyone, it was {$mostFarmedBy} who harvested the most food for the tribe.\n";174
$this->story .= "Despite {$bestVit->getName()} working the hardest out of everyone, it was {$mostFarmedBy} who harvested the most food for the tribe.\n";175
}175
}176
176
177
178
if (!empty($this->tribe->dataStore->heatWaveActive)) {179
$totalFood = (int) floor($totalFood / 2);180
$this->story .= "The heat wilted the crops, halving what could be gathered.\n";181
}177
$months = $this->tribe->foodMonthsLeft($totalFood);182
$months = $this->tribe->foodMonthsLeft($totalFood);178
$this->tribe->addFood($totalFood);183
$this->tribe->addFood($totalFood);179
184
@@ -0,0 +1,58 @@
1
<?php
2
3
require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4
5
class HeatWaveEvent extends MonthEndEvent
6
{
7
public function getMinAge()
8
{
9
return 0;
10
}
11
12
public function getMinParticipants()
13
{
14
return 0;
15
}
16
17
public function getMaxParticipants()
18
{
19
return 0;
20
}
21
22
public function getCost()
23
{
24
return 50;
25
}
26
27
public function isAvailable()
28
{
29
return $this->tribe->getCurrentSeason() === 'summer';
30
}
31
32
public function execute()
33
{
34
if (!isset($this->tribe->dataStore)) {
35
$this->tribe->dataStore = new stdClass();
36
}
37
38
$this->tribe->dataStore->heatWaveActive = true;
39
40
$affected = 0;
41
foreach ($this->tribe->getKobolds() as $kobold) {
42
$vitality = (int) ($kobold->getStat('vitality') ?? 0);
43
$fatigue = (int) ceil($vitality * 0.25);
44
if ($fatigue > 0) {
45
$kobold->addFatigue($fatigue);
46
$affected++;
47
}
48
}
49
50
$variations = [
51
"A punishing heat wave settled over the camp and left everyone drained. The tribe moved slowly under the sun, and their fatigue deepened.",
52
"The air shimmered with heat for days. Kobolds labored through it, and the whole tribe felt the heavy exhaustion.",
53
"Summer's worst heat arrived, and even simple tasks became burdens. The tribe endured the wave with sore limbs and weary eyes."
54
];
55
56
$this->story = $variations[array_rand($variations)];
57
}
58
}
@@ -0,0 +1,58 @@1
<?php2
3
require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';4
5
class HeatWaveEvent extends MonthEndEvent6
{7
public function getMinAge()8
{9
return 0;10
}11
12
public function getMinParticipants()13
{14
return 0;15
}16
17
public function getMaxParticipants()18
{19
return 0;20
}21
22
public function getCost()23
{24
return 50;25
}26
27
public function isAvailable()28
{29
return $this->tribe->getCurrentSeason() === 'summer';30
}31
32
public function execute()33
{34
if (!isset($this->tribe->dataStore)) {35
$this->tribe->dataStore = new stdClass();36
}37
38
$this->tribe->dataStore->heatWaveActive = true;39
40
$affected = 0;41
foreach ($this->tribe->getKobolds() as $kobold) {42
$vitality = (int) ($kobold->getStat('vitality') ?? 0);43
$fatigue = (int) ceil($vitality * 0.25);44
if ($fatigue > 0) {45
$kobold->addFatigue($fatigue);46
$affected++;47
}48
}49
50
$variations = [51
"A punishing heat wave settled over the camp and left everyone drained. The tribe moved slowly under the sun, and their fatigue deepened.",52
"The air shimmered with heat for days. Kobolds labored through it, and the whole tribe felt the heavy exhaustion.",53
"Summer's worst heat arrived, and even simple tasks became burdens. The tribe endured the wave with sore limbs and weary eyes."54
];55
56
$this->story = $variations[array_rand($variations)];57
}58
}@@ -195,6 +195,11 @@ class HuntingEvent extends Event
195
195
}
196
196
197
197
if ($totalFood > 0) {
198
if (!empty($this->tribe->dataStore->heatWaveActive)) {
199
$totalFood = (int) floor($totalFood / 2);
200
$this->story .= "The heat slowed the hunters, cutting the haul in half.
201
";
202
}
198
203
$months = $this->tribe->foodMonthsLeft($totalFood);
199
204
$this->tribe->addFood($totalFood);
200
205
@@ -195,6 +195,11 @@ class HuntingEvent extends Event195
}195
}196
196
197
if ($totalFood > 0) {197
if ($totalFood > 0) {198
if (!empty($this->tribe->dataStore->heatWaveActive)) {199
$totalFood = (int) floor($totalFood / 2);200
$this->story .= "The heat slowed the hunters, cutting the haul in half.201
";202
}198
$months = $this->tribe->foodMonthsLeft($totalFood);203
$months = $this->tribe->foodMonthsLeft($totalFood);199
$this->tribe->addFood($totalFood);204
$this->tribe->addFood($totalFood);200
205
@@ -0,0 +1,97 @@
1
<?php
2
3
require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4
5
class IncompetenceFrustrationEvent extends MonthEndEvent
6
{
7
public function getMinAge()
8
{
9
return 10;
10
}
11
12
public function getMinParticipants()
13
{
14
return 2;
15
}
16
17
public function getMaxParticipants()
18
{
19
return 2;
20
}
21
22
public function getCost()
23
{
24
return 20;
25
}
26
27
public function isAvailable()
28
{
29
$eligible = array_filter($this->tribe->getKobolds(), function ($kobold) {
30
return $kobold->getAge() >= $this->getMinAge();
31
});
32
33
if (count($eligible) < 2) {
34
return false;
35
}
36
37
foreach ($eligible as $kobold) {
38
$statName = $kobold->getHighestStatName();
39
$statValue = $statName ? $kobold->getStat($statName) : null;
40
if ($statValue !== null && $statValue >= 50 && $statValue <= 60) {
41
return true;
42
}
43
}
44
45
return false;
46
}
47
48
private function ensureLikes($kobold)
49
{
50
if (!isset($kobold->dataStore)) {
51
$kobold->dataStore = new stdClass();
52
}
53
if (!isset($kobold->dataStore->likes) || !is_array($kobold->dataStore->likes)) {
54
$kobold->dataStore->likes = [];
55
}
56
}
57
58
public function execute()
59
{
60
$kobolds = array_values($this->tribe->getKobolds());
61
if (count($kobolds) < 2) {
62
return;
63
}
64
65
$targets = array_values(array_filter($kobolds, function ($kobold) {
66
$statName = $kobold->getHighestStatName();
67
$statValue = $statName ? $kobold->getStat($statName) : null;
68
return $statValue !== null && $statValue >= 50 && $statValue <= 60;
69
}));
70
71
if (empty($targets)) {
72
return;
73
}
74
75
$target = $targets[array_rand($targets)];
76
$others = array_values(array_filter($kobolds, fn($k) => $k->getId() !== $target->getId()));
77
if (empty($others)) {
78
return;
79
}
80
81
$frustrated = $others[array_rand($others)];
82
$statName = $target->getHighestStatName();
83
84
$this->ensureLikes($frustrated);
85
$current = $frustrated->dataStore->likes[$target->getId()] ?? 0;
86
$frustrated->dataStore->likes[$target->getId()] = $current - 2;
87
88
$variations = [
89
"{$frustrated->getName()} grew frustrated with {$target->getName()}'s shaky {$statName} skills. The strain left a colder feeling between them.",
90
"After another mistake from {$target->getName()}, {$frustrated->getName()} lost patience with {$target->getName()}'s {$statName} work.",
91
"{$frustrated->getName()} watched {$target->getName()} struggle at {$statName} tasks and felt irritation build, dampening their goodwill."
92
];
93
94
$this->story = $variations[array_rand($variations)];
95
$frustrated->save();
96
}
97
}
@@ -0,0 +1,97 @@1
<?php2
3
require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';4
5
class IncompetenceFrustrationEvent extends MonthEndEvent6
{7
public function getMinAge()8
{9
return 10;10
}11
12
public function getMinParticipants()13
{14
return 2;15
}16
17
public function getMaxParticipants()18
{19
return 2;20
}21
22
public function getCost()23
{24
return 20;25
}26
27
public function isAvailable()28
{29
$eligible = array_filter($this->tribe->getKobolds(), function ($kobold) {30
return $kobold->getAge() >= $this->getMinAge();31
});32
33
if (count($eligible) < 2) {34
return false;35
}36
37
foreach ($eligible as $kobold) {38
$statName = $kobold->getHighestStatName();39
$statValue = $statName ? $kobold->getStat($statName) : null;40
if ($statValue !== null && $statValue >= 50 && $statValue <= 60) {41
return true;42
}43
}44
45
return false;46
}47
48
private function ensureLikes($kobold)49
{50
if (!isset($kobold->dataStore)) {51
$kobold->dataStore = new stdClass();52
}53
if (!isset($kobold->dataStore->likes) || !is_array($kobold->dataStore->likes)) {54
$kobold->dataStore->likes = [];55
}56
}57
58
public function execute()59
{60
$kobolds = array_values($this->tribe->getKobolds());61
if (count($kobolds) < 2) {62
return;63
}64
65
$targets = array_values(array_filter($kobolds, function ($kobold) {66
$statName = $kobold->getHighestStatName();67
$statValue = $statName ? $kobold->getStat($statName) : null;68
return $statValue !== null && $statValue >= 50 && $statValue <= 60;69
}));70
71
if (empty($targets)) {72
return;73
}74
75
$target = $targets[array_rand($targets)];76
$others = array_values(array_filter($kobolds, fn($k) => $k->getId() !== $target->getId()));77
if (empty($others)) {78
return;79
}80
81
$frustrated = $others[array_rand($others)];82
$statName = $target->getHighestStatName();83
84
$this->ensureLikes($frustrated);85
$current = $frustrated->dataStore->likes[$target->getId()] ?? 0;86
$frustrated->dataStore->likes[$target->getId()] = $current - 2;87
88
$variations = [89
"{$frustrated->getName()} grew frustrated with {$target->getName()}'s shaky {$statName} skills. The strain left a colder feeling between them.",90
"After another mistake from {$target->getName()}, {$frustrated->getName()} lost patience with {$target->getName()}'s {$statName} work.",91
"{$frustrated->getName()} watched {$target->getName()} struggle at {$statName} tasks and felt irritation build, dampening their goodwill."92
];93
94
$this->story = $variations[array_rand($variations)];95
$frustrated->save();96
}97
}@@ -0,0 +1,97 @@
1
<?php
2
3
require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4
5
class JealousItemEvent extends MonthEndEvent
6
{
7
public function getMinAge()
8
{
9
return 10;
10
}
11
12
public function getMinParticipants()
13
{
14
return 2;
15
}
16
17
public function getMaxParticipants()
18
{
19
return 2;
20
}
21
22
public function getCost()
23
{
24
return 10;
25
}
26
27
public function isAvailable()
28
{
29
$eligible = array_filter($this->tribe->getKobolds(), function ($kobold) {
30
return $kobold->getAge() >= $this->getMinAge();
31
});
32
33
if (count($eligible) < 2) {
34
return false;
35
}
36
37
foreach ($eligible as $kobold) {
38
$items = $kobold->getItems() ?? [];
39
if (!empty($items)) {
40
return true;
41
}
42
}
43
44
return false;
45
}
46
47
private function ensureLikes($kobold)
48
{
49
if (!isset($kobold->dataStore)) {
50
$kobold->dataStore = new stdClass();
51
}
52
if (!isset($kobold->dataStore->likes) || !is_array($kobold->dataStore->likes)) {
53
$kobold->dataStore->likes = [];
54
}
55
}
56
57
public function execute()
58
{
59
$kobolds = array_values($this->tribe->getKobolds());
60
if (count($kobolds) < 2) {
61
return;
62
}
63
64
$targets = array_values(array_filter($kobolds, function ($kobold) {
65
$items = $kobold->getItems() ?? [];
66
return !empty($items);
67
}));
68
69
if (empty($targets)) {
70
return;
71
}
72
73
$target = $targets[array_rand($targets)];
74
$jealousOptions = array_values(array_filter($kobolds, fn($k) => $k->getId() !== $target->getId()));
75
if (empty($jealousOptions)) {
76
return;
77
}
78
79
$jealous = $jealousOptions[array_rand($jealousOptions)];
80
$items = $target->getItems() ?? [];
81
$item = $items[array_rand($items)];
82
$itemName = is_array($item) ? ($item['name'] ?? $item['id'] ?? 'an item') : (is_object($item) && method_exists($item, 'getName') ? $item->getName() : 'an item');
83
84
$this->ensureLikes($jealous);
85
$current = $jealous->dataStore->likes[$target->getId()] ?? 0;
86
$jealous->dataStore->likes[$target->getId()] = $current - 2;
87
88
$variations = [
89
"{$jealous->getName()} grew jealous of {$target->getName()}'s {$itemName}. The envy lingered, souring their opinion.",
90
"Seeing {$target->getName()} with {$itemName} stirred jealousy in {$jealous->getName()}. Their feelings toward {$target->getName()} cooled.",
91
"{$jealous->getName()} fixated on {$target->getName()}'s {$itemName} and felt a sharp pang of envy, weakening the bond between them."
92
];
93
94
$this->story = $variations[array_rand($variations)];
95
$jealous->save();
96
}
97
}
@@ -0,0 +1,97 @@1
<?php2
3
require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';4
5
class JealousItemEvent extends MonthEndEvent6
{7
public function getMinAge()8
{9
return 10;10
}11
12
public function getMinParticipants()13
{14
return 2;15
}16
17
public function getMaxParticipants()18
{19
return 2;20
}21
22
public function getCost()23
{24
return 10;25
}26
27
public function isAvailable()28
{29
$eligible = array_filter($this->tribe->getKobolds(), function ($kobold) {30
return $kobold->getAge() >= $this->getMinAge();31
});32
33
if (count($eligible) < 2) {34
return false;35
}36
37
foreach ($eligible as $kobold) {38
$items = $kobold->getItems() ?? [];39
if (!empty($items)) {40
return true;41
}42
}43
44
return false;45
}46
47
private function ensureLikes($kobold)48
{49
if (!isset($kobold->dataStore)) {50
$kobold->dataStore = new stdClass();51
}52
if (!isset($kobold->dataStore->likes) || !is_array($kobold->dataStore->likes)) {53
$kobold->dataStore->likes = [];54
}55
}56
57
public function execute()58
{59
$kobolds = array_values($this->tribe->getKobolds());60
if (count($kobolds) < 2) {61
return;62
}63
64
$targets = array_values(array_filter($kobolds, function ($kobold) {65
$items = $kobold->getItems() ?? [];66
return !empty($items);67
}));68
69
if (empty($targets)) {70
return;71
}72
73
$target = $targets[array_rand($targets)];74
$jealousOptions = array_values(array_filter($kobolds, fn($k) => $k->getId() !== $target->getId()));75
if (empty($jealousOptions)) {76
return;77
}78
79
$jealous = $jealousOptions[array_rand($jealousOptions)];80
$items = $target->getItems() ?? [];81
$item = $items[array_rand($items)];82
$itemName = is_array($item) ? ($item['name'] ?? $item['id'] ?? 'an item') : (is_object($item) && method_exists($item, 'getName') ? $item->getName() : 'an item');83
84
$this->ensureLikes($jealous);85
$current = $jealous->dataStore->likes[$target->getId()] ?? 0;86
$jealous->dataStore->likes[$target->getId()] = $current - 2;87
88
$variations = [89
"{$jealous->getName()} grew jealous of {$target->getName()}'s {$itemName}. The envy lingered, souring their opinion.",90
"Seeing {$target->getName()} with {$itemName} stirred jealousy in {$jealous->getName()}. Their feelings toward {$target->getName()} cooled.",91
"{$jealous->getName()} fixated on {$target->getName()}'s {$itemName} and felt a sharp pang of envy, weakening the bond between them."92
];93
94
$this->story = $variations[array_rand($variations)];95
$jealous->save();96
}97
}@@ -0,0 +1,77 @@
1
<?php
2
3
require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4
5
class LargeFloodEvent extends MonthEndEvent
6
{
7
public function getMinAge()
8
{
9
return 0;
10
}
11
12
public function getMinParticipants()
13
{
14
return 0;
15
}
16
17
public function getMaxParticipants()
18
{
19
return 0;
20
}
21
22
public function getCost()
23
{
24
return 85;
25
}
26
27
public function isAvailable()
28
{
29
return $this->tribe->getCurrentSeason() === 'autumn';
30
}
31
32
public function execute()
33
{
34
if (!isset($this->tribe->dataStore)) {
35
$this->tribe->dataStore = new stdClass();
36
}
37
$this->tribe->dataStore->floodedThisMonth = true;
38
39
$currentFood = $this->tribe->getFoodCount();
40
$foodLost = 0;
41
if ($currentFood > 0) {
42
$percent = rand(30, 60);
43
$foodLost = (int) floor($currentFood * ($percent / 100));
44
if ($foodLost > 0) {
45
$this->tribe->removeFood($foodLost);
46
}
47
}
48
49
$alive = array_values($this->tribe->getAliveKobolds());
50
$drowned = [];
51
if (!empty($alive)) {
52
$percent = rand(10, 50);
53
$count = (int) floor(count($alive) * ($percent / 100));
54
if ($count > 0) {
55
shuffle($alive);
56
$drowned = array_slice($alive, 0, $count);
57
foreach ($drowned as $kobold) {
58
$kobold->die();
59
}
60
}
61
}
62
63
$drownedNames = array_map(fn($k) => $k->getName(), $drowned);
64
$lossText = $foodLost > 0 ? "The flood ruined {$this->tribe->foodTimeStr($foodLost)} of food." : "Food stores were battered but not fully ruined.";
65
$drownText = empty($drownedNames)
66
? "Miraculously, no one was swept away."
67
: "The waters took " . implode(', ', $drownedNames) . ", and the tribe grieved as the flood passed.";
68
69
$variations = [
70
"Autumn rains swelled into a massive flood that tore through the camp. {$lossText} {$drownText}",
71
"The river burst its banks and swallowed the lower dens. {$lossText} {$drownText}",
72
"A roaring flood swept across the tribe's ground and left ruin behind. {$lossText} {$drownText}"
73
];
74
75
$this->story = $variations[array_rand($variations)];
76
}
77
}
@@ -0,0 +1,77 @@1
<?php2
3
require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';4
5
class LargeFloodEvent extends MonthEndEvent6
{7
public function getMinAge()8
{9
return 0;10
}11
12
public function getMinParticipants()13
{14
return 0;15
}16
17
public function getMaxParticipants()18
{19
return 0;20
}21
22
public function getCost()23
{24
return 85;25
}26
27
public function isAvailable()28
{29
return $this->tribe->getCurrentSeason() === 'autumn';30
}31
32
public function execute()33
{34
if (!isset($this->tribe->dataStore)) {35
$this->tribe->dataStore = new stdClass();36
}37
$this->tribe->dataStore->floodedThisMonth = true;38
39
$currentFood = $this->tribe->getFoodCount();40
$foodLost = 0;41
if ($currentFood > 0) {42
$percent = rand(30, 60);43
$foodLost = (int) floor($currentFood * ($percent / 100));44
if ($foodLost > 0) {45
$this->tribe->removeFood($foodLost);46
}47
}48
49
$alive = array_values($this->tribe->getAliveKobolds());50
$drowned = [];51
if (!empty($alive)) {52
$percent = rand(10, 50);53
$count = (int) floor(count($alive) * ($percent / 100));54
if ($count > 0) {55
shuffle($alive);56
$drowned = array_slice($alive, 0, $count);57
foreach ($drowned as $kobold) {58
$kobold->die();59
}60
}61
}62
63
$drownedNames = array_map(fn($k) => $k->getName(), $drowned);64
$lossText = $foodLost > 0 ? "The flood ruined {$this->tribe->foodTimeStr($foodLost)} of food." : "Food stores were battered but not fully ruined.";65
$drownText = empty($drownedNames)66
? "Miraculously, no one was swept away."67
: "The waters took " . implode(', ', $drownedNames) . ", and the tribe grieved as the flood passed.";68
69
$variations = [70
"Autumn rains swelled into a massive flood that tore through the camp. {$lossText} {$drownText}",71
"The river burst its banks and swallowed the lower dens. {$lossText} {$drownText}",72
"A roaring flood swept across the tribe's ground and left ruin behind. {$lossText} {$drownText}"73
];74
75
$this->story = $variations[array_rand($variations)];76
}77
}@@ -0,0 +1,88 @@
1
<?php
2
3
require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4
5
class SmallFloodEvent extends MonthEndEvent
6
{
7
public function getMinAge()
8
{
9
return 0;
10
}
11
12
public function getMinParticipants()
13
{
14
return 0;
15
}
16
17
public function getMaxParticipants()
18
{
19
return 0;
20
}
21
22
public function getCost()
23
{
24
return 35;
25
}
26
27
public function isAvailable()
28
{
29
$season = $this->tribe->getCurrentSeason();
30
return $season === 'spring' || $season === 'autumn';
31
}
32
33
private function setStorage(array $storage)
34
{
35
$ref = new ReflectionClass($this->tribe);
36
if ($ref->hasProperty('storage')) {
37
$prop = $ref->getProperty('storage');
38
$prop->setValue($this->tribe, array_values($storage));
39
}
40
}
41
42
public function execute()
43
{
44
if (!isset($this->tribe->dataStore)) {
45
$this->tribe->dataStore = new stdClass();
46
}
47
$this->tribe->dataStore->floodedThisMonth = true;
48
49
$storage = $this->tribe->getStorage() ?? [];
50
$lostItems = [];
51
if (!empty($storage)) {
52
shuffle($storage);
53
$count = rand(1, min(3, count($storage)));
54
$lostItems = array_splice($storage, 0, $count);
55
$this->setStorage($storage);
56
}
57
58
$currentFood = $this->tribe->getFoodCount();
59
$foodLost = 0;
60
if ($currentFood > 0) {
61
$percent = rand(5, 20);
62
$foodLost = (int) floor($currentFood * ($percent / 100));
63
if ($foodLost > 0) {
64
$this->tribe->removeFood($foodLost);
65
}
66
}
67
68
$itemNames = [];
69
foreach ($lostItems as $item) {
70
if (is_array($item)) {
71
$itemNames[] = $item['name'] ?? ($item['id'] ?? 'item');
72
} elseif (is_object($item) && method_exists($item, 'getName')) {
73
$itemNames[] = $item->getName();
74
}
75
}
76
77
$itemsText = empty($itemNames) ? "No stored items were swept away." : "The flood carried off " . implode(', ', $itemNames) . ".";
78
$foodText = $foodLost > 0 ? "Some food was lost, about {$this->tribe->foodTimeStr($foodLost)}." : "Food stores stayed mostly intact.";
79
80
$variations = [
81
"A small flood crept into the camp and left the ground slick and heavy. {$itemsText} {$foodText}",
82
"Spring waters rose and lapped at the camp, leaving mud and scattered supplies behind. {$itemsText} {$foodText}",
83
"A shallow flood swept through the tribe's stores before the waters receded. {$itemsText} {$foodText}"
84
];
85
86
$this->story = $variations[array_rand($variations)];
87
}
88
}
@@ -0,0 +1,88 @@1
<?php2
3
require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';4
5
class SmallFloodEvent extends MonthEndEvent6
{7
public function getMinAge()8
{9
return 0;10
}11
12
public function getMinParticipants()13
{14
return 0;15
}16
17
public function getMaxParticipants()18
{19
return 0;20
}21
22
public function getCost()23
{24
return 35;25
}26
27
public function isAvailable()28
{29
$season = $this->tribe->getCurrentSeason();30
return $season === 'spring' || $season === 'autumn';31
}32
33
private function setStorage(array $storage)34
{35
$ref = new ReflectionClass($this->tribe);36
if ($ref->hasProperty('storage')) {37
$prop = $ref->getProperty('storage');38
$prop->setValue($this->tribe, array_values($storage));39
}40
}41
42
public function execute()43
{44
if (!isset($this->tribe->dataStore)) {45
$this->tribe->dataStore = new stdClass();46
}47
$this->tribe->dataStore->floodedThisMonth = true;48
49
$storage = $this->tribe->getStorage() ?? [];50
$lostItems = [];51
if (!empty($storage)) {52
shuffle($storage);53
$count = rand(1, min(3, count($storage)));54
$lostItems = array_splice($storage, 0, $count);55
$this->setStorage($storage);56
}57
58
$currentFood = $this->tribe->getFoodCount();59
$foodLost = 0;60
if ($currentFood > 0) {61
$percent = rand(5, 20);62
$foodLost = (int) floor($currentFood * ($percent / 100));63
if ($foodLost > 0) {64
$this->tribe->removeFood($foodLost);65
}66
}67
68
$itemNames = [];69
foreach ($lostItems as $item) {70
if (is_array($item)) {71
$itemNames[] = $item['name'] ?? ($item['id'] ?? 'item');72
} elseif (is_object($item) && method_exists($item, 'getName')) {73
$itemNames[] = $item->getName();74
}75
}76
77
$itemsText = empty($itemNames) ? "No stored items were swept away." : "The flood carried off " . implode(', ', $itemNames) . ".";78
$foodText = $foodLost > 0 ? "Some food was lost, about {$this->tribe->foodTimeStr($foodLost)}." : "Food stores stayed mostly intact.";79
80
$variations = [81
"A small flood crept into the camp and left the ground slick and heavy. {$itemsText} {$foodText}",82
"Spring waters rose and lapped at the camp, leaving mud and scattered supplies behind. {$itemsText} {$foodText}",83
"A shallow flood swept through the tribe's stores before the waters receded. {$itemsText} {$foodText}"84
];85
86
$this->story = $variations[array_rand($variations)];87
}88
}@@ -52,6 +52,13 @@ class WalkDiscoveryEvent extends MonthEndEvent
52
52
if ($roll <= 60) {
53
53
// Food discovery
54
54
$foodAmount = rand(3, 8);
55
56
if (!empty($this->tribe->dataStore->heatWaveActive)) {
57
$foodAmount = (int) floor($foodAmount / 2);
58
if ($foodAmount < 1) {
59
$foodAmount = 1;
60
}
61
}
55
62
$this->tribe->addFood($foodAmount);
56
63
57
64
$foodStr = $this->tribe->foodTimeStr($foodAmount);
@@ -67,6 +74,9 @@ class WalkDiscoveryEvent extends MonthEndEvent
67
74
];
68
75
69
76
$this->story = $foodVariations[array_rand($foodVariations)];
77
if (!empty($this->tribe->dataStore->heatWaveActive)) {
78
$this->story .= " The heat kept the find small.";
79
}
70
80
} else {
71
81
// Item discovery
72
82
$items = [
@@ -52,6 +52,13 @@ class WalkDiscoveryEvent extends MonthEndEvent52
if ($roll <= 60) {52
if ($roll <= 60) {53
// Food discovery53
// Food discovery54
$foodAmount = rand(3, 8);54
$foodAmount = rand(3, 8);55
56
if (!empty($this->tribe->dataStore->heatWaveActive)) {57
$foodAmount = (int) floor($foodAmount / 2);58
if ($foodAmount < 1) {59
$foodAmount = 1;60
}61
}55
$this->tribe->addFood($foodAmount);62
$this->tribe->addFood($foodAmount);56
63
57
$foodStr = $this->tribe->foodTimeStr($foodAmount);64
$foodStr = $this->tribe->foodTimeStr($foodAmount);@@ -67,6 +74,9 @@ class WalkDiscoveryEvent extends MonthEndEvent67
];74
];68
75
69
$this->story = $foodVariations[array_rand($foodVariations)];76
$this->story = $foodVariations[array_rand($foodVariations)];77
if (!empty($this->tribe->dataStore->heatWaveActive)) {78
$this->story .= " The heat kept the find small.";79
}70
} else {80
} else {71
// Item discovery81
// Item discovery72
$items = [82
$items = [