-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Final finishes and release candidate
- Loading branch information
1 parent
d50419d
commit e6ec990
Showing
7 changed files
with
140 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Message; | ||
|
||
use App\Model\Player\PlayerInterface; | ||
|
||
class PrayAtTheAltarMessage implements MessageInterface | ||
{ | ||
protected PlayerInterface $player; | ||
|
||
public function getPlayer(): PlayerInterface | ||
{ | ||
return $this->player; | ||
} | ||
|
||
public function setPlayer(PlayerInterface $player): PrayAtTheAltarMessage | ||
{ | ||
$this->player = $player; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\MessageHandler; | ||
|
||
use App\Message\GameEffectMessage; | ||
use App\Message\PrayAtTheAltarMessage; | ||
use App\Model\RandomEvent\AltarPrayerGameEvent; | ||
use Symfony\Component\Messenger\Handler\MessageHandlerInterface; | ||
use Symfony\Component\Messenger\MessageBusInterface; | ||
|
||
class PrayAtTheAltarHandler implements MessageHandlerInterface | ||
{ | ||
protected MessageBusInterface $messageBus; | ||
|
||
public function __construct(MessageBusInterface $messageBus) | ||
{ | ||
$this->messageBus = $messageBus; | ||
} | ||
|
||
public function __invoke(PrayAtTheAltarMessage $message): void | ||
{ | ||
// TODO add multiple events based on luck of player | ||
// do this as a strategy, because this service is 100% DI ready | ||
$player = $message->getPlayer(); | ||
// FIXME this is just an example how to fire a event in event loop ("tick's" in ClockService) | ||
$event = new AltarPrayerGameEvent($player); | ||
$this->messageBus->dispatch(new GameEffectMessage($event)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Model\Dialogue\City; | ||
|
||
use App\Message\MessageInterface; | ||
use App\Message\PrayAtTheAltarMessage; | ||
use App\Message\WrongDialogueOptionMessage; | ||
use App\Model\Dialogue\DialogueInterface; | ||
|
||
class AltarDialogue implements DialogueInterface | ||
{ | ||
public const DIALOGUE_ENTITY = '𝕲𝖔𝖉𝖘'; | ||
public const DIALOGUE_TEXT = '𝕯𝖔 𝖞𝖔𝖚 𝖜𝖆𝖓𝖙 𝖙𝖔 𝖕𝖗𝖆𝖞 𝖆𝖙 𝖙𝖍𝖊 𝖆𝖑𝖙𝖆𝖗?'; | ||
public const DIALOGUE_OPTIONS = ['YES', 'no']; | ||
|
||
public function getEntity(): string | ||
{ | ||
return self::DIALOGUE_ENTITY; | ||
} | ||
|
||
public function getText(): string | ||
{ | ||
return self::DIALOGUE_TEXT; | ||
} | ||
|
||
public function getOptions(): array | ||
{ | ||
return self::DIALOGUE_OPTIONS; | ||
} | ||
|
||
public function print(): string | ||
{ | ||
return sprintf('[%s] %s [%s | %s]', self::DIALOGUE_ENTITY, self::DIALOGUE_TEXT, self::DIALOGUE_OPTIONS[0], self::DIALOGUE_OPTIONS[1]); | ||
} | ||
|
||
public function handleButtonPress(string $buttonPressed): ?MessageInterface | ||
{ | ||
switch ($buttonPressed) { | ||
case '1': | ||
return new PrayAtTheAltarMessage(); | ||
default: | ||
return new WrongDialogueOptionMessage(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace App\Model\Tile\TileInteraction; | ||
|
||
use App\Model\Dialogue\City\AltarDialogue; | ||
use App\Model\Dialogue\DialogueInterface; | ||
|
||
class AltarTileInteraction implements TileInteractionInterface | ||
{ | ||
protected DialogueInterface $dialogue; | ||
|
||
public function __construct() | ||
{ | ||
$this->dialogue = new AltarDialogue(); | ||
} | ||
|
||
public function getDialogue(): DialogueInterface | ||
{ | ||
return $this->dialogue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters