Skip to content

Commit e6ec990

Browse files
Final finishes and release candidate
1 parent d50419d commit e6ec990

File tree

7 files changed

+140
-3
lines changed

7 files changed

+140
-3
lines changed

resources/levels/Rivermouth_city.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,31 @@ places:
1616
size: [ 9, 9 ]
1717
starting_point: [ 3, 6 ]
1818

19+
# TBD of scope and shape and purpose
1920
stables:
2021
generation_class: App\Generator\Level\DefaultBoxRoomGenerator
2122
size: [ 9, 9 ]
2223
starting_point: [ 2, 49 ]
2324

25+
# TBD of scope and shape and purpose
26+
# - buy health potions?
27+
# - take quests? <---- I LIKE IT
2428
tavern:
2529
generation_class: App\Generator\Level\DefaultBoxRoomGenerator
2630
size: [ 9, 9 ]
2731
starting_point: [ 21, 12 ]
2832

33+
# TBD of scope and shape and purpose
34+
# - Change allignment ?
35+
# - get rid of curses <--- I LIKE IT
2936
cathedral:
3037
generation_class: App\Generator\Level\DefaultBoxRoomGenerator
3138
size: [ 9, 9 ]
3239
starting_point: [ 11, 82 ]
40+
41+
# Just an idea, could be good
42+
#river:
43+
# generation_class: App\Generator\Level\RiverGenerator
44+
# size: 10
45+
# starting_point: [ 0, 60 ]
46+
# fluctuation: 4
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Message;
6+
7+
use App\Model\Player\PlayerInterface;
8+
9+
class PrayAtTheAltarMessage implements MessageInterface
10+
{
11+
protected PlayerInterface $player;
12+
13+
public function getPlayer(): PlayerInterface
14+
{
15+
return $this->player;
16+
}
17+
18+
public function setPlayer(PlayerInterface $player): PrayAtTheAltarMessage
19+
{
20+
$this->player = $player;
21+
22+
return $this;
23+
}
24+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\MessageHandler;
6+
7+
use App\Message\GameEffectMessage;
8+
use App\Message\PrayAtTheAltarMessage;
9+
use App\Model\RandomEvent\AltarPrayerGameEvent;
10+
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
11+
use Symfony\Component\Messenger\MessageBusInterface;
12+
13+
class PrayAtTheAltarHandler implements MessageHandlerInterface
14+
{
15+
protected MessageBusInterface $messageBus;
16+
17+
public function __construct(MessageBusInterface $messageBus)
18+
{
19+
$this->messageBus = $messageBus;
20+
}
21+
22+
public function __invoke(PrayAtTheAltarMessage $message): void
23+
{
24+
// TODO add multiple events based on luck of player
25+
// do this as a strategy, because this service is 100% DI ready
26+
$player = $message->getPlayer();
27+
// FIXME this is just an example how to fire a event in event loop ("tick's" in ClockService)
28+
$event = new AltarPrayerGameEvent($player);
29+
$this->messageBus->dispatch(new GameEffectMessage($event));
30+
}
31+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Model\Dialogue\City;
6+
7+
use App\Message\MessageInterface;
8+
use App\Message\PrayAtTheAltarMessage;
9+
use App\Message\WrongDialogueOptionMessage;
10+
use App\Model\Dialogue\DialogueInterface;
11+
12+
class AltarDialogue implements DialogueInterface
13+
{
14+
public const DIALOGUE_ENTITY = '𝕲𝖔𝖉𝖘';
15+
public const DIALOGUE_TEXT = '𝕯𝖔 𝖞𝖔𝖚 𝖜𝖆𝖓𝖙 𝖙𝖔 𝖕𝖗𝖆𝖞 𝖆𝖙 𝖙𝖍𝖊 𝖆𝖑𝖙𝖆𝖗?';
16+
public const DIALOGUE_OPTIONS = ['YES', 'no'];
17+
18+
public function getEntity(): string
19+
{
20+
return self::DIALOGUE_ENTITY;
21+
}
22+
23+
public function getText(): string
24+
{
25+
return self::DIALOGUE_TEXT;
26+
}
27+
28+
public function getOptions(): array
29+
{
30+
return self::DIALOGUE_OPTIONS;
31+
}
32+
33+
public function print(): string
34+
{
35+
return sprintf('[%s] %s [%s | %s]', self::DIALOGUE_ENTITY, self::DIALOGUE_TEXT, self::DIALOGUE_OPTIONS[0], self::DIALOGUE_OPTIONS[1]);
36+
}
37+
38+
public function handleButtonPress(string $buttonPressed): ?MessageInterface
39+
{
40+
switch ($buttonPressed) {
41+
case '1':
42+
return new PrayAtTheAltarMessage();
43+
default:
44+
return new WrongDialogueOptionMessage();
45+
}
46+
}
47+
}

src/Model/Tile/City/AltarTile.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use App\Model\Player\PlayerInterface;
66
use App\Model\Stats\StatsInterface;
77
use App\Model\Tile\AbstractTile;
8-
use App\Model\Tile\TileInteraction\EmptyTileInteraction;
8+
use App\Model\Tile\TileInteraction\AltarTileInteraction;
99
use App\Model\Tile\TileInteraction\TileInteractionInterface;
1010
use App\Model\Tile\TileLogic\NoLogic;
1111
use App\Model\Tile\TileLogic\TileLogicInterface;
@@ -42,7 +42,7 @@ public function handleLogic(int $scale, StatsInterface $stats): TileLogicInterfa
4242

4343
public function handleInteraction(PlayerInterface $player): TileInteractionInterface
4444
{
45-
return new EmptyTileInteraction();
45+
return new AltarTileInteraction();
4646
}
4747

4848
public function draw(): string
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace App\Model\Tile\TileInteraction;
4+
5+
use App\Model\Dialogue\City\AltarDialogue;
6+
use App\Model\Dialogue\DialogueInterface;
7+
8+
class AltarTileInteraction implements TileInteractionInterface
9+
{
10+
protected DialogueInterface $dialogue;
11+
12+
public function __construct()
13+
{
14+
$this->dialogue = new AltarDialogue();
15+
}
16+
17+
public function getDialogue(): DialogueInterface
18+
{
19+
return $this->dialogue;
20+
}
21+
}

src/Model/Tile/TileLogic/BossRoomTileLogic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function process(PlayerInterface $player): void
4343
// FIXME scale is not fine, maybe should be higher or affected by something more?
4444
/* @var CreatureInterface $boss */
4545
$boss = new $bossRolled(ScaleHelper::bossEncounterScale($this->scale, 1.2));
46-
if ($boss instanceof CreatureInterface && $boss instanceof AbstractBossCreature) {
46+
if ($boss instanceof AbstractBossCreature) {
4747
$this->creature = $boss;
4848
} else {
4949
throw new \LogicException('BossRoomTileLogic can spawn only Boss creatures');

0 commit comments

Comments
 (0)