tribe->getCurrentSeason() !== 'summer') { return false; } if (!empty($this->tribe->dataStore->draught)) { return false; } if (isset($this->tribe->dataStore) && isset($this->tribe->dataStore->floodedThisMonth) && $this->tribe->dataStore->floodedThisMonth) { return false; } return true; } private function getMonthsUntilNextSeason() { $monthOfYear = (($this->tribe->getCurrentMonth() - 1) % 12) + 1; $monthInSeason = (($monthOfYear - 1) % 3) + 1; return max(1, 3 - $monthInSeason + 1); } public function execute() { if (!isset($this->tribe->dataStore)) { $this->tribe->dataStore = new stdClass(); } $this->tribe->dataStore->draught = rand(1, $this->getMonthsUntilNextSeason()); $variations = [ "The heat lingered and the land cracked. No rain came, and the tribe marked the month as a drought, watching the streams grow thin.", "Summer skies stayed empty of rain. The tribe endured a drought and set aside what little moisture remained.", "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." ]; $this->story = $variations[array_rand($variations)]; } }