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