BlueGit

blue-star tribegen

Files

tribegen / web / src / Events / Event.php

Event.php

test
timfa Tim Falken · pushed by timfa · 9 months ago
6b0cd665 History
Event.php 1.2 KiB Download Raw
1<?php
2
3require_once __DIR__ . '/../../src/Classes/Tribe.php';
4
5abstract class Event
6{
7 protected $tribe;
8 protected $story = '';
9 protected $participants = []; // array of kobold ids
10 protected $reportedDeaths = [];
11
12 public function isEndOfMonth()
13 {
14 return false;
15 }
16
17 public function __construct(Tribe $tribe)
18 {
19 $this->tribe = $tribe;
20 }
21
22 abstract public function execute();
23
24 abstract public function getCost();
25
26 public function isAvailable()
27 {
28 return true;
29 }
30
31 public function setParticipants(array $koboldIds)
32 {
33 $this->participants = $koboldIds;
34 }
35
36 public function getParticipants()
37 {
38 return $this->participants;
39 }
40
41 abstract function getMinParticipants();
42
43 abstract function getMaxParticipants();
44
45 abstract function getMinAge();
46
47 public function getStory()
48 {
49 return $this->story;
50 }
51
52 public function getReportedDeaths(): array
53 {
54 return array_keys($this->reportedDeaths);
55 }
56
57 protected function reportDeath($kobold)
58 {
59 if ($kobold && method_exists($kobold, 'getId')) {
60 $this->reportedDeaths[$kobold->getId()] = true;
61 }
62 }
63}