| 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 | } |