BlueGit

blue-star tribegen

more events, rivals

timfa Tim Falken · pushed by timfa

Authored 2026-02-03 · 9 months ago

Hash
52fdcbf623cbe312f10c1058601fbe8d3a9f1a4f
Parent
e2c972c8
8 files changed +626 −24
web/src/Classes/Kobold.php +8 −2
@@ -29,6 +29,8 @@ class Kobold
29 29 private $male;
30 30 public $dataStore;
31 31
32 public $isRival = false;
33
32 34 private static $statNames = [
33 35 'vitality',
34 36 'intelligence',
@@ -108,7 +110,7 @@ class Kobold
108 110 return $this->isLeader;
109 111 }
110 112
111 public static function generate($userId, $saveId, $age = null)
113 public static function generate($userId, $saveId, $age = null, $rival = false)
112 114 {
113 115 if ($age === null) {
114 116 $age = rand(5, 50);
@@ -118,6 +120,8 @@ class Kobold
118 120 $name = self::generateRandomName();
119 121 $kobold = new self(uniqid('kob_' . $saveId . '_'), $userId, $saveId, $name, $age, $spriteMorph);
120 122
123 $kobold->isRival = $rival;
124
121 125 return $kobold;
122 126 }
123 127
@@ -236,6 +240,7 @@ class Kobold
236 240 $kobold->colourSecondary = $data['colour_secondary'] ?? '#FFFFFF';
237 241 $kobold->colourTertiary = $data['colour_tertiary'] ?? '#FFFFFF';
238 242 $kobold->dataStore = $data['data_store'] ?? new stdClass();
243 $kobold->isRival = $data['is_rival'] ?? false;
239 244
240 245 if (is_array($kobold->dataStore)) {
241 246 $kobold->dataStore = (object) $kobold->dataStore;
@@ -266,7 +271,8 @@ class Kobold
266 271 'colour_secondary' => $this->colourSecondary,
267 272 'colour_tertiary' => $this->colourTertiary,
268 273 'male' => $this->male,
269 'data_store' => $this->dataStore ?? new stdClass()
274 'data_store' => $this->dataStore ?? new stdClass(),
275 'is_rival' => $this->isRival ?? false
270 276 ];
271 277 }
272 278
@@ -29,6 +29,8 @@ class Kobold
29 private $male;
29 private $male;
30 public $dataStore;
30 public $dataStore;
31
31
32 public $isRival = false;
33
32 private static $statNames = [
34 private static $statNames = [
33 'vitality',
35 'vitality',
34 'intelligence',
36 'intelligence',
@@ -108,7 +110,7 @@ class Kobold
108 return $this->isLeader;
110 return $this->isLeader;
109 }
111 }
110
112
111 public static function generate($userId, $saveId, $age = null)
113 public static function generate($userId, $saveId, $age = null, $rival = false)
112 {
114 {
113 if ($age === null) {
115 if ($age === null) {
114 $age = rand(5, 50);
116 $age = rand(5, 50);
@@ -118,6 +120,8 @@ class Kobold
118 $name = self::generateRandomName();
120 $name = self::generateRandomName();
119 $kobold = new self(uniqid('kob_' . $saveId . '_'), $userId, $saveId, $name, $age, $spriteMorph);
121 $kobold = new self(uniqid('kob_' . $saveId . '_'), $userId, $saveId, $name, $age, $spriteMorph);
120
122
123 $kobold->isRival = $rival;
124
121 return $kobold;
125 return $kobold;
122 }
126 }
123
127
@@ -236,6 +240,7 @@ class Kobold
236 $kobold->colourSecondary = $data['colour_secondary'] ?? '#FFFFFF';
240 $kobold->colourSecondary = $data['colour_secondary'] ?? '#FFFFFF';
237 $kobold->colourTertiary = $data['colour_tertiary'] ?? '#FFFFFF';
241 $kobold->colourTertiary = $data['colour_tertiary'] ?? '#FFFFFF';
238 $kobold->dataStore = $data['data_store'] ?? new stdClass();
242 $kobold->dataStore = $data['data_store'] ?? new stdClass();
243 $kobold->isRival = $data['is_rival'] ?? false;
239
244
240 if (is_array($kobold->dataStore)) {
245 if (is_array($kobold->dataStore)) {
241 $kobold->dataStore = (object) $kobold->dataStore;
246 $kobold->dataStore = (object) $kobold->dataStore;
@@ -266,7 +271,8 @@ class Kobold
266 'colour_secondary' => $this->colourSecondary,
271 'colour_secondary' => $this->colourSecondary,
267 'colour_tertiary' => $this->colourTertiary,
272 'colour_tertiary' => $this->colourTertiary,
268 'male' => $this->male,
273 'male' => $this->male,
269 'data_store' => $this->dataStore ?? new stdClass()
274 'data_store' => $this->dataStore ?? new stdClass(),
275 'is_rival' => $this->isRival ?? false
270 ];
276 ];
271 }
277 }
272
278
web/src/Classes/Tribe.php +43 −22
@@ -9,6 +9,7 @@ class Tribe
9 9 private $saveId;
10 10 private $name;
11 11 public $kobolds = [];
12 public $rivals = [];
12 13 private $storage = [];
13 14 private $currentMonth = 0;
14 15 private $currentSeason = 'spring';
@@ -97,7 +98,10 @@ class Tribe
97 98 foreach ($data as $koboldData) {
98 99 $kobold = Kobold::fromArray($koboldData, $this->userId, $this->saveId);
99 100 if ($kobold) {
100 $this->kobolds[$kobold->getId()] = $kobold;
101 if ($kobold->isRival)
102 $this->rivals[$kobold->getId()] = $kobold;
103 else
104 $this->kobolds[$kobold->getId()] = $kobold;
101 105 }
102 106 }
103 107 }
@@ -145,6 +149,12 @@ class Tribe
145 149 $koboldsData[] = $kobold->toArray();
146 150 }
147 151 }
152 foreach ($this->rivals as $kobold) {
153 if (!$kobold->isDead()) {
154 $kobold->save();
155 $koboldsData[] = $kobold->toArray();
156 }
157 }
148 158
149 159 $this->saveManager->saveJson($savePath . '/kobolds.json', $koboldsData);
150 160
@@ -853,28 +863,11 @@ class Tribe
853 863 $foodStory .= "\nA new year begins.\n";
854 864
855 865 foreach ($this->kobolds as $kobold) {
856 if ($kobold->getAge() >= 0) {
857 $kobold->incrementAge();
858
859 // Check for old-age injuries
860 if ($kobold->getAge() >= 35 && $this->shouldAddOldAgeInjury($kobold)) {
861 $oldAgeInjuries = ['bad_back', 'bad_liver', 'poor_eyesight', 'dementia', 'limp', 'poor_hearing', 'chronic_fatigue'];
862 $injury = $oldAgeInjuries[array_rand($oldAgeInjuries)];
863 $kobold->addInjury($injury);
864 }
865
866 // Old-age death roll: if roll < (age + total injury severity), kobold dies
867 if ($kobold->getAge() >= 35) {
868 $roll = rand(1, 100);
869 $totalSeverity = $kobold->getTotalInjurySeverity();
870 if ($roll < ($kobold->getAge() + $totalSeverity)) {
871 $foodStory .= $kobold->getName() . " dies of old age.\n";
872 $kobold->die();
873 }
874 }
866 $foodStory .= $this->ageKobold($kobold);
867 }
875 868
876 $kobold->save();
877 }
869 foreach ($this->rivals as $kobold) {
870 $this->ageKobold($kobold); //we don't log these
878 871 }
879 872 }
880 873 $foodStory .= "\n" . $this->tryMate();
@@ -891,6 +884,34 @@ class Tribe
891 884 return $foodStory;
892 885 }
893 886
887 function ageKobold($kobold)
888 {
889 $foodStory = "";
890 if ($kobold->getAge() >= 0) {
891 $kobold->incrementAge();
892
893 // Check for old-age injuries
894 if ($kobold->getAge() >= 35 && $this->shouldAddOldAgeInjury($kobold)) {
895 $oldAgeInjuries = ['bad_back', 'bad_liver', 'poor_eyesight', 'dementia', 'limp', 'poor_hearing', 'chronic_fatigue'];
896 $injury = $oldAgeInjuries[array_rand($oldAgeInjuries)];
897 $kobold->addInjury($injury);
898 }
899
900 // Old-age death roll: if roll < (age + total injury severity), kobold dies
901 if ($kobold->getAge() >= 35) {
902 $roll = rand(1, 100);
903 $totalSeverity = $kobold->getTotalInjurySeverity();
904 if ($roll < ($kobold->getAge() + $totalSeverity)) {
905 $foodStory .= $kobold->getName() . " dies of old age.\n";
906 $kobold->die();
907 }
908 }
909
910 $kobold->save();
911 }
912 return $foodStory;
913 }
914
894 915 private function shouldAddOldAgeInjury(Kobold $kobold)
895 916 {
896 917 // 1d100 roll under age starting at 35
@@ -9,6 +9,7 @@ class Tribe
9 private $saveId;
9 private $saveId;
10 private $name;
10 private $name;
11 public $kobolds = [];
11 public $kobolds = [];
12 public $rivals = [];
12 private $storage = [];
13 private $storage = [];
13 private $currentMonth = 0;
14 private $currentMonth = 0;
14 private $currentSeason = 'spring';
15 private $currentSeason = 'spring';
@@ -97,7 +98,10 @@ class Tribe
97 foreach ($data as $koboldData) {
98 foreach ($data as $koboldData) {
98 $kobold = Kobold::fromArray($koboldData, $this->userId, $this->saveId);
99 $kobold = Kobold::fromArray($koboldData, $this->userId, $this->saveId);
99 if ($kobold) {
100 if ($kobold) {
100 $this->kobolds[$kobold->getId()] = $kobold;
101 if ($kobold->isRival)
102 $this->rivals[$kobold->getId()] = $kobold;
103 else
104 $this->kobolds[$kobold->getId()] = $kobold;
101 }
105 }
102 }
106 }
103 }
107 }
@@ -145,6 +149,12 @@ class Tribe
145 $koboldsData[] = $kobold->toArray();
149 $koboldsData[] = $kobold->toArray();
146 }
150 }
147 }
151 }
152 foreach ($this->rivals as $kobold) {
153 if (!$kobold->isDead()) {
154 $kobold->save();
155 $koboldsData[] = $kobold->toArray();
156 }
157 }
148
158
149 $this->saveManager->saveJson($savePath . '/kobolds.json', $koboldsData);
159 $this->saveManager->saveJson($savePath . '/kobolds.json', $koboldsData);
150
160
@@ -853,28 +863,11 @@ class Tribe
853 $foodStory .= "\nA new year begins.\n";
863 $foodStory .= "\nA new year begins.\n";
854
864
855 foreach ($this->kobolds as $kobold) {
865 foreach ($this->kobolds as $kobold) {
856 if ($kobold->getAge() >= 0) {
866 $foodStory .= $this->ageKobold($kobold);
857 $kobold->incrementAge();
867 }
858
859 // Check for old-age injuries
860 if ($kobold->getAge() >= 35 && $this->shouldAddOldAgeInjury($kobold)) {
861 $oldAgeInjuries = ['bad_back', 'bad_liver', 'poor_eyesight', 'dementia', 'limp', 'poor_hearing', 'chronic_fatigue'];
862 $injury = $oldAgeInjuries[array_rand($oldAgeInjuries)];
863 $kobold->addInjury($injury);
864 }
865
866 // Old-age death roll: if roll < (age + total injury severity), kobold dies
867 if ($kobold->getAge() >= 35) {
868 $roll = rand(1, 100);
869 $totalSeverity = $kobold->getTotalInjurySeverity();
870 if ($roll < ($kobold->getAge() + $totalSeverity)) {
871 $foodStory .= $kobold->getName() . " dies of old age.\n";
872 $kobold->die();
873 }
874 }
875
868
876 $kobold->save();
869 foreach ($this->rivals as $kobold) {
877 }
870 $this->ageKobold($kobold); //we don't log these
878 }
871 }
879 }
872 }
880 $foodStory .= "\n" . $this->tryMate();
873 $foodStory .= "\n" . $this->tryMate();
@@ -891,6 +884,34 @@ class Tribe
891 return $foodStory;
884 return $foodStory;
892 }
885 }
893
886
887 function ageKobold($kobold)
888 {
889 $foodStory = "";
890 if ($kobold->getAge() >= 0) {
891 $kobold->incrementAge();
892
893 // Check for old-age injuries
894 if ($kobold->getAge() >= 35 && $this->shouldAddOldAgeInjury($kobold)) {
895 $oldAgeInjuries = ['bad_back', 'bad_liver', 'poor_eyesight', 'dementia', 'limp', 'poor_hearing', 'chronic_fatigue'];
896 $injury = $oldAgeInjuries[array_rand($oldAgeInjuries)];
897 $kobold->addInjury($injury);
898 }
899
900 // Old-age death roll: if roll < (age + total injury severity), kobold dies
901 if ($kobold->getAge() >= 35) {
902 $roll = rand(1, 100);
903 $totalSeverity = $kobold->getTotalInjurySeverity();
904 if ($roll < ($kobold->getAge() + $totalSeverity)) {
905 $foodStory .= $kobold->getName() . " dies of old age.\n";
906 $kobold->die();
907 }
908 }
909
910 $kobold->save();
911 }
912 return $foodStory;
913 }
914
894 private function shouldAddOldAgeInjury(Kobold $kobold)
915 private function shouldAddOldAgeInjury(Kobold $kobold)
895 {
916 {
896 // 1d100 roll under age starting at 35
917 // 1d100 roll under age starting at 35
web/src/Events/ActivityInjuryEvent.php added +86 −0
@@ -0,0 +1,86 @@
1 <?php
2
3 require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4 require_once __DIR__ . '/../../src/Classes/Kobold.php';
5
6 class ActivityInjuryEvent extends MonthEndEvent
7 {
8 public function getMinAge()
9 {
10 return 5;
11 }
12
13 public function getMinParticipants()
14 {
15 return 2;
16 }
17
18 public function getMaxParticipants()
19 {
20 return 5;
21 }
22
23 public function getCost()
24 {
25 return 30;
26 }
27
28 public function isAvailable()
29 {
30 return true;
31 }
32
33 public function execute()
34 {
35 $this->story = '';
36
37 $eligible = array_filter($this->tribe->getAliveKobolds(), fn($k) => $k->getAge() >= $this->getMinAge());
38 $eligible = array_values($eligible);
39
40 if (count($eligible) < $this->getMinParticipants()) {
41 return;
42 }
43
44 // Randomly select 2-5 participants
45 shuffle($eligible);
46 $count = rand($this->getMinParticipants(), min($this->getMaxParticipants(), count($eligible)));
47 $participants = array_slice($eligible, 0, $count);
48
49 $participantNames = array_map(fn($k) => $k->getName(), $participants);
50
51 $activities = [
52 'gathering expedition',
53 'hunting trip',
54 'exploration mission',
55 'water crossing',
56 'climbing exercise',
57 ];
58
59 $activity = $activities[array_rand($activities)];
60
61 $injuryTypes = ['smallCut', 'sunburn', 'brokenLeg'];
62
63 // Randomly injure 1-2 participants
64 $injuredCount = rand(1, min(2, count($participants)));
65 for ($i = 0; $i < $injuredCount; $i++) {
66 $injured = $participants[array_rand($participants)];
67 $injuryType = $injuryTypes[array_rand($injuryTypes)];
68 $injured->addInjury($injuryType);
69 $injured->save();
70 }
71
72 $namesStr = implode(' and ', $participantNames);
73
74 $variations = [
75 "During a {$activity}, {$namesStr} had a rough time, with some coming away injured.",
76 "Things went awry during the {$activity}. Not all of the group made it back unscathed.",
77 "The {$activity} was more treacherous than expected, and several members returned hurt.",
78 "Accidents happened during the {$activity}, leaving some of the participants bruised.",
79 "The {$activity} was poorly executed, resulting in injuries for some participants.",
80 "{$namesStr} engaged in a {$activity} that did not go as planned, with injuries sustained.",
81 "A {$activity} left several of the participants nursing wounds they received.",
82 ];
83
84 $this->story = $variations[array_rand($variations)];
85 }
86 }
@@ -0,0 +1,86 @@
1<?php
2
3require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4require_once __DIR__ . '/../../src/Classes/Kobold.php';
5
6class ActivityInjuryEvent extends MonthEndEvent
7{
8 public function getMinAge()
9 {
10 return 5;
11 }
12
13 public function getMinParticipants()
14 {
15 return 2;
16 }
17
18 public function getMaxParticipants()
19 {
20 return 5;
21 }
22
23 public function getCost()
24 {
25 return 30;
26 }
27
28 public function isAvailable()
29 {
30 return true;
31 }
32
33 public function execute()
34 {
35 $this->story = '';
36
37 $eligible = array_filter($this->tribe->getAliveKobolds(), fn($k) => $k->getAge() >= $this->getMinAge());
38 $eligible = array_values($eligible);
39
40 if (count($eligible) < $this->getMinParticipants()) {
41 return;
42 }
43
44 // Randomly select 2-5 participants
45 shuffle($eligible);
46 $count = rand($this->getMinParticipants(), min($this->getMaxParticipants(), count($eligible)));
47 $participants = array_slice($eligible, 0, $count);
48
49 $participantNames = array_map(fn($k) => $k->getName(), $participants);
50
51 $activities = [
52 'gathering expedition',
53 'hunting trip',
54 'exploration mission',
55 'water crossing',
56 'climbing exercise',
57 ];
58
59 $activity = $activities[array_rand($activities)];
60
61 $injuryTypes = ['smallCut', 'sunburn', 'brokenLeg'];
62
63 // Randomly injure 1-2 participants
64 $injuredCount = rand(1, min(2, count($participants)));
65 for ($i = 0; $i < $injuredCount; $i++) {
66 $injured = $participants[array_rand($participants)];
67 $injuryType = $injuryTypes[array_rand($injuryTypes)];
68 $injured->addInjury($injuryType);
69 $injured->save();
70 }
71
72 $namesStr = implode(' and ', $participantNames);
73
74 $variations = [
75 "During a {$activity}, {$namesStr} had a rough time, with some coming away injured.",
76 "Things went awry during the {$activity}. Not all of the group made it back unscathed.",
77 "The {$activity} was more treacherous than expected, and several members returned hurt.",
78 "Accidents happened during the {$activity}, leaving some of the participants bruised.",
79 "The {$activity} was poorly executed, resulting in injuries for some participants.",
80 "{$namesStr} engaged in a {$activity} that did not go as planned, with injuries sustained.",
81 "A {$activity} left several of the participants nursing wounds they received.",
82 ];
83
84 $this->story = $variations[array_rand($variations)];
85 }
86}
web/src/Events/IllnessEvent.php added +70 −0
@@ -0,0 +1,70 @@
1 <?php
2
3 require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4 require_once __DIR__ . '/../../src/Classes/Kobold.php';
5
6 class IllnessEvent extends MonthEndEvent
7 {
8 public function getMinAge()
9 {
10 return 0;
11 }
12
13 public function getMinParticipants()
14 {
15 return 1;
16 }
17
18 public function getMaxParticipants()
19 {
20 return 1;
21 }
22
23 public function getCost()
24 {
25 return 10;
26 }
27
28 public function isAvailable()
29 {
30 return true;
31 }
32
33 public function execute()
34 {
35 $this->story = '';
36
37 $eligible = $this->tribe->getAliveKobolds();
38 if (empty($eligible)) {
39 return;
40 }
41
42 $kobold = $eligible[array_rand($eligible)];
43
44 // Disease types that can be randomly acquired
45 $diseases = [
46 ['type' => 'smallCut', 'name' => 'small cut'],
47 ['type' => 'sunburn', 'name' => 'sunburn'],
48 ];
49
50 $disease = $diseases[array_rand($diseases)];
51
52 $kobold->addInjury($disease['type']);
53
54 $nameA = $kobold->getName();
55
56 $illnessVariations = [
57 "{$nameA} developed a {$disease['name']} this month and is feeling poorly.",
58 "Misfortune struck {$nameA}, who came down with a {$disease['name']}.",
59 "{$nameA} is suffering from a {$disease['name']} and needs rest.",
60 "A {$disease['name']} has plagued {$nameA} throughout the month.",
61 "{$nameA} was afflicted with a {$disease['name']} and is quite uncomfortable.",
62 "The elements were unkind to {$nameA}, leaving {$kobold->him()} with a {$disease['name']}.",
63 "{$nameA} has been dealing with a {$disease['name']} that emerged this month.",
64 ];
65
66 $this->story = $illnessVariations[array_rand($illnessVariations)];
67
68 $kobold->save();
69 }
70 }
@@ -0,0 +1,70 @@
1<?php
2
3require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4require_once __DIR__ . '/../../src/Classes/Kobold.php';
5
6class IllnessEvent extends MonthEndEvent
7{
8 public function getMinAge()
9 {
10 return 0;
11 }
12
13 public function getMinParticipants()
14 {
15 return 1;
16 }
17
18 public function getMaxParticipants()
19 {
20 return 1;
21 }
22
23 public function getCost()
24 {
25 return 10;
26 }
27
28 public function isAvailable()
29 {
30 return true;
31 }
32
33 public function execute()
34 {
35 $this->story = '';
36
37 $eligible = $this->tribe->getAliveKobolds();
38 if (empty($eligible)) {
39 return;
40 }
41
42 $kobold = $eligible[array_rand($eligible)];
43
44 // Disease types that can be randomly acquired
45 $diseases = [
46 ['type' => 'smallCut', 'name' => 'small cut'],
47 ['type' => 'sunburn', 'name' => 'sunburn'],
48 ];
49
50 $disease = $diseases[array_rand($diseases)];
51
52 $kobold->addInjury($disease['type']);
53
54 $nameA = $kobold->getName();
55
56 $illnessVariations = [
57 "{$nameA} developed a {$disease['name']} this month and is feeling poorly.",
58 "Misfortune struck {$nameA}, who came down with a {$disease['name']}.",
59 "{$nameA} is suffering from a {$disease['name']} and needs rest.",
60 "A {$disease['name']} has plagued {$nameA} throughout the month.",
61 "{$nameA} was afflicted with a {$disease['name']} and is quite uncomfortable.",
62 "The elements were unkind to {$nameA}, leaving {$kobold->him()} with a {$disease['name']}.",
63 "{$nameA} has been dealing with a {$disease['name']} that emerged this month.",
64 ];
65
66 $this->story = $illnessVariations[array_rand($illnessVariations)];
67
68 $kobold->save();
69 }
70}
web/src/Events/IncreaseConsumptionEvent.php added +73 −0
@@ -0,0 +1,73 @@
1 <?php
2
3 require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4 require_once __DIR__ . '/../../src/Classes/Kobold.php';
5
6 class IncreaseConsumptionEvent extends MonthEndEvent
7 {
8 public function getMinAge()
9 {
10 return 10;
11 }
12
13 public function getMinParticipants()
14 {
15 return 1;
16 }
17
18 public function getMaxParticipants()
19 {
20 return 1;
21 }
22
23 public function getCost()
24 {
25 return 15;
26 }
27
28 public function isAvailable()
29 {
30 return true;
31 }
32
33 public function execute()
34 {
35 $this->story = '';
36
37 $eligible = array_filter($this->tribe->getAliveKobolds(), fn($k) => $k->getAge() >= $this->getMinAge());
38 $eligible = array_values($eligible);
39
40 if (empty($eligible)) {
41 return;
42 }
43
44 $kobold = $eligible[array_rand($eligible)];
45
46 $foodCost = rand(2, 5);
47 $this->tribe->removeFood($foodCost);
48
49 $nameA = $kobold->getName();
50
51 $reasons = [
52 'grew a significant appetite',
53 'had a growth spurt',
54 'was always hungry',
55 'consumed extra food',
56 'had an insatiable appetite this month',
57 'seemed particularly famished',
58 'ate with vigor',
59 ];
60
61 $reason = $reasons[array_rand($reasons)];
62
63 $variations = [
64 "{$nameA} {$reason}, consuming more food than usual.",
65 "This month, {$nameA} {$reason} and the food stores are diminished.",
66 "{$nameA} {$reason}, putting extra strain on the tribe's resources.",
67 "The tribe noticed {$nameA} {$reason}, draining more of their supplies.",
68 "{$nameA} {$reason}, and the food situation became slightly more dire.",
69 ];
70
71 $this->story = $variations[array_rand($variations)];
72 }
73 }
@@ -0,0 +1,73 @@
1<?php
2
3require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4require_once __DIR__ . '/../../src/Classes/Kobold.php';
5
6class IncreaseConsumptionEvent extends MonthEndEvent
7{
8 public function getMinAge()
9 {
10 return 10;
11 }
12
13 public function getMinParticipants()
14 {
15 return 1;
16 }
17
18 public function getMaxParticipants()
19 {
20 return 1;
21 }
22
23 public function getCost()
24 {
25 return 15;
26 }
27
28 public function isAvailable()
29 {
30 return true;
31 }
32
33 public function execute()
34 {
35 $this->story = '';
36
37 $eligible = array_filter($this->tribe->getAliveKobolds(), fn($k) => $k->getAge() >= $this->getMinAge());
38 $eligible = array_values($eligible);
39
40 if (empty($eligible)) {
41 return;
42 }
43
44 $kobold = $eligible[array_rand($eligible)];
45
46 $foodCost = rand(2, 5);
47 $this->tribe->removeFood($foodCost);
48
49 $nameA = $kobold->getName();
50
51 $reasons = [
52 'grew a significant appetite',
53 'had a growth spurt',
54 'was always hungry',
55 'consumed extra food',
56 'had an insatiable appetite this month',
57 'seemed particularly famished',
58 'ate with vigor',
59 ];
60
61 $reason = $reasons[array_rand($reasons)];
62
63 $variations = [
64 "{$nameA} {$reason}, consuming more food than usual.",
65 "This month, {$nameA} {$reason} and the food stores are diminished.",
66 "{$nameA} {$reason}, putting extra strain on the tribe's resources.",
67 "The tribe noticed {$nameA} {$reason}, draining more of their supplies.",
68 "{$nameA} {$reason}, and the food situation became slightly more dire.",
69 ];
70
71 $this->story = $variations[array_rand($variations)];
72 }
73}
web/src/Events/InjuryRecoveryEvent.php added +92 −0
@@ -0,0 +1,92 @@
1 <?php
2
3 require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4 require_once __DIR__ . '/../../src/Classes/Kobold.php';
5
6 class InjuryRecoveryEvent extends MonthEndEvent
7 {
8 public function getMinAge()
9 {
10 return 0;
11 }
12
13 public function getMinParticipants()
14 {
15 return 1;
16 }
17
18 public function getMaxParticipants()
19 {
20 return 1;
21 }
22
23 public function getCost()
24 {
25 return 5;
26 }
27
28 public function isAvailable()
29 {
30 return true;
31 }
32
33 public function execute()
34 {
35 $this->story = '';
36
37 // Find a kobold with injuries that can heal naturally
38 $eligible = array_filter($this->tribe->getAliveKobolds(), function ($k) {
39 $injuries = $k->getInjuries() ?? [];
40 foreach ($injuries as $inj) {
41 $category = $inj['category'] ?? null;
42 // Only these categories can heal naturally
43 if (in_array($category, ['cut', 'bruise', 'burn'])) {
44 return true;
45 }
46 }
47 return false;
48 });
49
50 $eligible = array_values($eligible);
51
52 if (empty($eligible)) {
53 return;
54 }
55
56 $kobold = $eligible[array_rand($eligible)];
57 $injuries = $kobold->getInjuries() ?? [];
58
59 // Find first healable injury
60 $healableInjuries = [];
61 foreach ($injuries as $inj) {
62 $category = $inj['category'] ?? null;
63 if (in_array($category, ['cut', 'bruise', 'burn'])) {
64 $healableInjuries[] = $inj;
65 }
66 }
67
68 if (empty($healableInjuries)) {
69 return;
70 }
71
72 $toHeal = $healableInjuries[array_rand($healableInjuries)];
73 $kobold->removeInjury($toHeal['id']);
74
75 $nameA = $kobold->getName();
76 $injuryName = $toHeal['injury_type'] ?? $toHeal['injuryType'] ?? 'injury';
77
78 $recoveryVariations = [
79 "{$nameA} has healed from the {$injuryName} and is feeling much better.",
80 "Time and rest worked wonders for {$nameA}, who has recovered from the {$injuryName}.",
81 "{$nameA}'s {$injuryName} finally healed after a month of careful rest.",
82 "The tribe is relieved to see {$nameA}'s {$injuryName} finally resolved.",
83 "{$nameA} is back to full strength, the {$injuryName} now a fading memory.",
84 "A period of quiet recovery allowed {$nameA} to heal from the {$injuryName}.",
85 "{$nameA} has made a full recovery from the {$injuryName}.",
86 ];
87
88 $this->story = $recoveryVariations[array_rand($recoveryVariations)];
89
90 $kobold->save();
91 }
92 }
@@ -0,0 +1,92 @@
1<?php
2
3require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4require_once __DIR__ . '/../../src/Classes/Kobold.php';
5
6class InjuryRecoveryEvent extends MonthEndEvent
7{
8 public function getMinAge()
9 {
10 return 0;
11 }
12
13 public function getMinParticipants()
14 {
15 return 1;
16 }
17
18 public function getMaxParticipants()
19 {
20 return 1;
21 }
22
23 public function getCost()
24 {
25 return 5;
26 }
27
28 public function isAvailable()
29 {
30 return true;
31 }
32
33 public function execute()
34 {
35 $this->story = '';
36
37 // Find a kobold with injuries that can heal naturally
38 $eligible = array_filter($this->tribe->getAliveKobolds(), function ($k) {
39 $injuries = $k->getInjuries() ?? [];
40 foreach ($injuries as $inj) {
41 $category = $inj['category'] ?? null;
42 // Only these categories can heal naturally
43 if (in_array($category, ['cut', 'bruise', 'burn'])) {
44 return true;
45 }
46 }
47 return false;
48 });
49
50 $eligible = array_values($eligible);
51
52 if (empty($eligible)) {
53 return;
54 }
55
56 $kobold = $eligible[array_rand($eligible)];
57 $injuries = $kobold->getInjuries() ?? [];
58
59 // Find first healable injury
60 $healableInjuries = [];
61 foreach ($injuries as $inj) {
62 $category = $inj['category'] ?? null;
63 if (in_array($category, ['cut', 'bruise', 'burn'])) {
64 $healableInjuries[] = $inj;
65 }
66 }
67
68 if (empty($healableInjuries)) {
69 return;
70 }
71
72 $toHeal = $healableInjuries[array_rand($healableInjuries)];
73 $kobold->removeInjury($toHeal['id']);
74
75 $nameA = $kobold->getName();
76 $injuryName = $toHeal['injury_type'] ?? $toHeal['injuryType'] ?? 'injury';
77
78 $recoveryVariations = [
79 "{$nameA} has healed from the {$injuryName} and is feeling much better.",
80 "Time and rest worked wonders for {$nameA}, who has recovered from the {$injuryName}.",
81 "{$nameA}'s {$injuryName} finally healed after a month of careful rest.",
82 "The tribe is relieved to see {$nameA}'s {$injuryName} finally resolved.",
83 "{$nameA} is back to full strength, the {$injuryName} now a fading memory.",
84 "A period of quiet recovery allowed {$nameA} to heal from the {$injuryName}.",
85 "{$nameA} has made a full recovery from the {$injuryName}.",
86 ];
87
88 $this->story = $recoveryVariations[array_rand($recoveryVariations)];
89
90 $kobold->save();
91 }
92}
web/src/Events/RivalEncounterEvent.php added +154 −0
@@ -0,0 +1,154 @@
1 <?php
2
3 require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4 require_once __DIR__ . '/../../src/Classes/Kobold.php';
5 require_once __DIR__ . '/../../src/Classes/NPC.php';
6
7 class RivalEncounterEvent extends MonthEndEvent
8 {
9 public function getMinAge()
10 {
11 return 15;
12 }
13
14 public function getMinParticipants()
15 {
16 return 1;
17 }
18
19 public function getMaxParticipants()
20 {
21 return 1;
22 }
23
24 public function getCost()
25 {
26 return 25;
27 }
28
29 public function isAvailable()
30 {
31 return true;
32 }
33
34 public function execute()
35 {
36 $this->story = '';
37
38 $eligible = array_filter($this->tribe->getAliveKobolds(), fn($k) => $k->getAge() >= $this->getMinAge());
39 $eligible = array_values($eligible);
40
41 if (empty($eligible)) {
42 return;
43 }
44
45 $kobold = $eligible[array_rand($eligible)];
46
47 // Initialize rivals if not present
48 if (!isset($this->tribe->dataStore->rivals)) {
49 $this->tribe->dataStore->rivals = [];
50 }
51
52 $rivals = $this->tribe->dataStore->rivals;
53
54 // Generate or pick a rival
55 $rival = null;
56
57 if (count($rivals) < 10 && rand(1, 100) <= 40) {
58 // Generate a new rival
59 $rivalNames = ['Gruk', 'Zag', 'Mog', 'Drog', 'Bik', 'Kra', 'Nik', 'Tug', 'Vox', 'Warg'];
60 $rivalName = $rivalNames[array_rand($rivalNames)];
61 $rival = NPC::create($this->tribe->getSaveId(), $rivalName, 'individual', true);
62 $this->tribe->dataStore->rivals[] = $rival->toArray();
63 } elseif (!empty($rivals)) {
64 // Pick an existing rival
65 $rivalData = $rivals[array_rand($rivals)];
66 $rival = NPC::fromArray($rivalData);
67 }
68
69 // If no rival exists, return
70 if (!$rival) {
71 return;
72 }
73
74 $koboldName = $kobold->getName();
75 $rivalName = $rival->getName();
76
77 // Check personality (kobold's perspective toward the rival)
78 $personalityCheck = $kobold->checkStat('personality');
79
80 $injuryTypes = ['smallCut', 'brokenLeg'];
81
82 if ($personalityCheck) {
83 // Positive encounter
84 // Initialize kobold's likes if needed
85 if (!isset($kobold->dataStore)) {
86 $kobold->dataStore = new stdClass();
87 }
88 if (!isset($kobold->dataStore->likes)) {
89 $kobold->dataStore->likes = [];
90 }
91
92 // Like the rival
93 $currentLike = $kobold->dataStore->likes[$rival->getId()] ?? 0;
94 $kobold->dataStore->likes[$rival->getId()] = $currentLike + 3;
95
96 $positiveVariations = [
97 "{$koboldName} encountered {$rivalName} and the two exchanged pleasantries. Relations improved slightly.",
98 "When {$koboldName} met {$rivalName}, the encounter was surprisingly cordial.",
99 "{$koboldName} and {$rivalName} ran into each other and found common ground.",
100 "A chance meeting between {$koboldName} and {$rivalName} resulted in friendly conversation.",
101 "{$koboldName} discovered that {$rivalName} might not be such a bad sort after all.",
102 ];
103
104 // Chance of receiving a gift
105 if (rand(1, 100) <= 40) {
106 $gifts = ['bone-setting', 'healing-herbs', 'book'];
107 $giftName = $gifts[array_rand($gifts)];
108
109 $giftVariations = [
110 $positiveVariations[array_rand($positiveVariations)] . " {$rivalName} even gifted {$koboldName} with a {$giftName}.",
111 $positiveVariations[array_rand($positiveVariations)] . " The encounter ended with {$rivalName} generously offering {$koboldName} a {$giftName}.",
112 ];
113
114 $this->story = $giftVariations[array_rand($giftVariations)];
115
116 // Try to add gift to storage (if item loading available)
117 if (class_exists('GameHelper')) {
118 $itemData = GameHelper::loadItem($giftName);
119 if ($itemData) {
120 $this->tribe->addToStorage($itemData);
121 }
122 }
123 } else {
124 $this->story = $positiveVariations[array_rand($positiveVariations)];
125 }
126 } else {
127 // Negative encounter - they fight
128 $negativeVariations = [
129 "{$koboldName} and {$rivalName} clashed bitterly when they met.",
130 "An encounter between {$koboldName} and {$rivalName} quickly escalated into violence.",
131 "{$koboldName} and {$rivalName} came to blows, leaving both wounded.",
132 "When {$koboldName} crossed paths with {$rivalName}, tempers flared into a fight.",
133 "{$koboldName} and {$rivalName} settled their differences through combat.",
134 ];
135
136 // Randomly injure the kobold
137 if (rand(1, 100) <= 70) {
138 $injury = $injuryTypes[array_rand($injuryTypes)];
139 $kobold->addInjury($injury);
140
141 $injuredVariations = [
142 $negativeVariations[array_rand($negativeVariations)] . " {$koboldName} came away with an injury.",
143 $negativeVariations[array_rand($negativeVariations)] . " {$koboldName} was hurt in the confrontation.",
144 ];
145
146 $this->story = $injuredVariations[array_rand($injuredVariations)];
147 } else {
148 $this->story = $negativeVariations[array_rand($negativeVariations)];
149 }
150 }
151
152 $kobold->save();
153 }
154 }
@@ -0,0 +1,154 @@
1<?php
2
3require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4require_once __DIR__ . '/../../src/Classes/Kobold.php';
5require_once __DIR__ . '/../../src/Classes/NPC.php';
6
7class RivalEncounterEvent extends MonthEndEvent
8{
9 public function getMinAge()
10 {
11 return 15;
12 }
13
14 public function getMinParticipants()
15 {
16 return 1;
17 }
18
19 public function getMaxParticipants()
20 {
21 return 1;
22 }
23
24 public function getCost()
25 {
26 return 25;
27 }
28
29 public function isAvailable()
30 {
31 return true;
32 }
33
34 public function execute()
35 {
36 $this->story = '';
37
38 $eligible = array_filter($this->tribe->getAliveKobolds(), fn($k) => $k->getAge() >= $this->getMinAge());
39 $eligible = array_values($eligible);
40
41 if (empty($eligible)) {
42 return;
43 }
44
45 $kobold = $eligible[array_rand($eligible)];
46
47 // Initialize rivals if not present
48 if (!isset($this->tribe->dataStore->rivals)) {
49 $this->tribe->dataStore->rivals = [];
50 }
51
52 $rivals = $this->tribe->dataStore->rivals;
53
54 // Generate or pick a rival
55 $rival = null;
56
57 if (count($rivals) < 10 && rand(1, 100) <= 40) {
58 // Generate a new rival
59 $rivalNames = ['Gruk', 'Zag', 'Mog', 'Drog', 'Bik', 'Kra', 'Nik', 'Tug', 'Vox', 'Warg'];
60 $rivalName = $rivalNames[array_rand($rivalNames)];
61 $rival = NPC::create($this->tribe->getSaveId(), $rivalName, 'individual', true);
62 $this->tribe->dataStore->rivals[] = $rival->toArray();
63 } elseif (!empty($rivals)) {
64 // Pick an existing rival
65 $rivalData = $rivals[array_rand($rivals)];
66 $rival = NPC::fromArray($rivalData);
67 }
68
69 // If no rival exists, return
70 if (!$rival) {
71 return;
72 }
73
74 $koboldName = $kobold->getName();
75 $rivalName = $rival->getName();
76
77 // Check personality (kobold's perspective toward the rival)
78 $personalityCheck = $kobold->checkStat('personality');
79
80 $injuryTypes = ['smallCut', 'brokenLeg'];
81
82 if ($personalityCheck) {
83 // Positive encounter
84 // Initialize kobold's likes if needed
85 if (!isset($kobold->dataStore)) {
86 $kobold->dataStore = new stdClass();
87 }
88 if (!isset($kobold->dataStore->likes)) {
89 $kobold->dataStore->likes = [];
90 }
91
92 // Like the rival
93 $currentLike = $kobold->dataStore->likes[$rival->getId()] ?? 0;
94 $kobold->dataStore->likes[$rival->getId()] = $currentLike + 3;
95
96 $positiveVariations = [
97 "{$koboldName} encountered {$rivalName} and the two exchanged pleasantries. Relations improved slightly.",
98 "When {$koboldName} met {$rivalName}, the encounter was surprisingly cordial.",
99 "{$koboldName} and {$rivalName} ran into each other and found common ground.",
100 "A chance meeting between {$koboldName} and {$rivalName} resulted in friendly conversation.",
101 "{$koboldName} discovered that {$rivalName} might not be such a bad sort after all.",
102 ];
103
104 // Chance of receiving a gift
105 if (rand(1, 100) <= 40) {
106 $gifts = ['bone-setting', 'healing-herbs', 'book'];
107 $giftName = $gifts[array_rand($gifts)];
108
109 $giftVariations = [
110 $positiveVariations[array_rand($positiveVariations)] . " {$rivalName} even gifted {$koboldName} with a {$giftName}.",
111 $positiveVariations[array_rand($positiveVariations)] . " The encounter ended with {$rivalName} generously offering {$koboldName} a {$giftName}.",
112 ];
113
114 $this->story = $giftVariations[array_rand($giftVariations)];
115
116 // Try to add gift to storage (if item loading available)
117 if (class_exists('GameHelper')) {
118 $itemData = GameHelper::loadItem($giftName);
119 if ($itemData) {
120 $this->tribe->addToStorage($itemData);
121 }
122 }
123 } else {
124 $this->story = $positiveVariations[array_rand($positiveVariations)];
125 }
126 } else {
127 // Negative encounter - they fight
128 $negativeVariations = [
129 "{$koboldName} and {$rivalName} clashed bitterly when they met.",
130 "An encounter between {$koboldName} and {$rivalName} quickly escalated into violence.",
131 "{$koboldName} and {$rivalName} came to blows, leaving both wounded.",
132 "When {$koboldName} crossed paths with {$rivalName}, tempers flared into a fight.",
133 "{$koboldName} and {$rivalName} settled their differences through combat.",
134 ];
135
136 // Randomly injure the kobold
137 if (rand(1, 100) <= 70) {
138 $injury = $injuryTypes[array_rand($injuryTypes)];
139 $kobold->addInjury($injury);
140
141 $injuredVariations = [
142 $negativeVariations[array_rand($negativeVariations)] . " {$koboldName} came away with an injury.",
143 $negativeVariations[array_rand($negativeVariations)] . " {$koboldName} was hurt in the confrontation.",
144 ];
145
146 $this->story = $injuredVariations[array_rand($injuredVariations)];
147 } else {
148 $this->story = $negativeVariations[array_rand($negativeVariations)];
149 }
150 }
151
152 $kobold->save();
153 }
154}
web/src/Events/WalkDiscoveryEvent.php added +100 −0
@@ -0,0 +1,100 @@
1 <?php
2
3 require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4 require_once __DIR__ . '/../../src/Classes/Kobold.php';
5 require_once __DIR__ . '/../../src/Utilities/GameHelper.php';
6
7 class WalkDiscoveryEvent extends MonthEndEvent
8 {
9 public function getMinAge()
10 {
11 return 8;
12 }
13
14 public function getMinParticipants()
15 {
16 return 1;
17 }
18
19 public function getMaxParticipants()
20 {
21 return 1;
22 }
23
24 public function getCost()
25 {
26 return 20;
27 }
28
29 public function isAvailable()
30 {
31 return true;
32 }
33
34 public function execute()
35 {
36 $this->story = '';
37
38 $eligible = array_filter($this->tribe->getAliveKobolds(), fn($k) => $k->getAge() >= $this->getMinAge());
39 $eligible = array_values($eligible);
40
41 if (empty($eligible)) {
42 return;
43 }
44
45 $kobold = $eligible[array_rand($eligible)];
46
47 // Determine what was found
48 $roll = rand(1, 100);
49
50 $nameA = $kobold->getName();
51
52 if ($roll <= 60) {
53 // Food discovery
54 $foodAmount = rand(3, 8);
55 $this->tribe->addFood($foodAmount);
56
57 $foodVariations = [
58 "{$nameA} found some edible plants during a walk and brought back {$foodAmount} food.",
59 "While exploring, {$nameA} discovered a cache of berries and returned with {$foodAmount} food.",
60 "{$nameA}'s keen eye spotted food sources, adding {$foodAmount} to the tribe's stores.",
61 "A fortunate walk led {$nameA} to gather {$foodAmount} food for the tribe.",
62 "{$nameA} returned from a walk with {$foodAmount} food, a welcome find.",
63 "During a solitary walk, {$nameA} found edible resources and collected {$foodAmount} food.",
64 "{$nameA} stumbled upon a food source during a walk, bringing back {$foodAmount}.",
65 ];
66
67 $this->story = $foodVariations[array_rand($foodVariations)];
68 } else {
69 // Item discovery
70 $items = [
71 ['name' => 'bone-setting', 'displayName' => 'bone-setting kit'],
72 ['name' => 'healing-herbs', 'displayName' => 'healing herbs'],
73 ['name' => 'book', 'displayName' => 'old book'],
74 ];
75
76 $item = $items[array_rand($items)];
77
78 // Load item template
79 $itemData = GameHelper::loadItem($item['name']);
80 if ($itemData) {
81 $this->tribe->addToStorage($itemData);
82
83 $itemVariations = [
84 "{$nameA} discovered an old {$item['displayName']} during a walk.",
85 "While wandering, {$nameA} found a {$item['displayName']} and brought it back.",
86 "{$nameA}'s sharp eyes spotted a {$item['displayName']} lying in the wilderness.",
87 "A lucky find—{$nameA} returned with a {$item['displayName']}.",
88 "{$nameA} came back from a walk carrying a {$item['displayName']}.",
89 "The tribe is pleased that {$nameA} found a {$item['displayName']} on a recent walk.",
90 "{$nameA} stumbled upon a {$item['displayName']} and wisely brought it to the tribe.",
91 ];
92
93 $this->story = $itemVariations[array_rand($itemVariations)];
94 } else {
95 // Fallback if item loading fails
96 $this->story = "{$nameA} returned from a walk with interesting findings.";
97 }
98 }
99 }
100 }
@@ -0,0 +1,100 @@
1<?php
2
3require_once __DIR__ . '/../../src/Events/MonthEndEvent.php';
4require_once __DIR__ . '/../../src/Classes/Kobold.php';
5require_once __DIR__ . '/../../src/Utilities/GameHelper.php';
6
7class WalkDiscoveryEvent extends MonthEndEvent
8{
9 public function getMinAge()
10 {
11 return 8;
12 }
13
14 public function getMinParticipants()
15 {
16 return 1;
17 }
18
19 public function getMaxParticipants()
20 {
21 return 1;
22 }
23
24 public function getCost()
25 {
26 return 20;
27 }
28
29 public function isAvailable()
30 {
31 return true;
32 }
33
34 public function execute()
35 {
36 $this->story = '';
37
38 $eligible = array_filter($this->tribe->getAliveKobolds(), fn($k) => $k->getAge() >= $this->getMinAge());
39 $eligible = array_values($eligible);
40
41 if (empty($eligible)) {
42 return;
43 }
44
45 $kobold = $eligible[array_rand($eligible)];
46
47 // Determine what was found
48 $roll = rand(1, 100);
49
50 $nameA = $kobold->getName();
51
52 if ($roll <= 60) {
53 // Food discovery
54 $foodAmount = rand(3, 8);
55 $this->tribe->addFood($foodAmount);
56
57 $foodVariations = [
58 "{$nameA} found some edible plants during a walk and brought back {$foodAmount} food.",
59 "While exploring, {$nameA} discovered a cache of berries and returned with {$foodAmount} food.",
60 "{$nameA}'s keen eye spotted food sources, adding {$foodAmount} to the tribe's stores.",
61 "A fortunate walk led {$nameA} to gather {$foodAmount} food for the tribe.",
62 "{$nameA} returned from a walk with {$foodAmount} food, a welcome find.",
63 "During a solitary walk, {$nameA} found edible resources and collected {$foodAmount} food.",
64 "{$nameA} stumbled upon a food source during a walk, bringing back {$foodAmount}.",
65 ];
66
67 $this->story = $foodVariations[array_rand($foodVariations)];
68 } else {
69 // Item discovery
70 $items = [
71 ['name' => 'bone-setting', 'displayName' => 'bone-setting kit'],
72 ['name' => 'healing-herbs', 'displayName' => 'healing herbs'],
73 ['name' => 'book', 'displayName' => 'old book'],
74 ];
75
76 $item = $items[array_rand($items)];
77
78 // Load item template
79 $itemData = GameHelper::loadItem($item['name']);
80 if ($itemData) {
81 $this->tribe->addToStorage($itemData);
82
83 $itemVariations = [
84 "{$nameA} discovered an old {$item['displayName']} during a walk.",
85 "While wandering, {$nameA} found a {$item['displayName']} and brought it back.",
86 "{$nameA}'s sharp eyes spotted a {$item['displayName']} lying in the wilderness.",
87 "A lucky find—{$nameA} returned with a {$item['displayName']}.",
88 "{$nameA} came back from a walk carrying a {$item['displayName']}.",
89 "The tribe is pleased that {$nameA} found a {$item['displayName']} on a recent walk.",
90 "{$nameA} stumbled upon a {$item['displayName']} and wisely brought it to the tribe.",
91 ];
92
93 $this->story = $itemVariations[array_rand($itemVariations)];
94 } else {
95 // Fallback if item loading fails
96 $this->story = "{$nameA} returned from a walk with interesting findings.";
97 }
98 }
99 }
100}