- one running tracker (Combatant rows); no encounters to manage - Enemies list gets a "Track" column (checkbox + count) and an "Add to tracker" button; picking N of an enemy makes "Goblin 1..N", numbering continues if some are already on the tracker - /tracker: per-combatant current/max HP with an HP bar, Damage / Heal by amount, remove one, "Clear all". HP is clamped to [0, max]; 0 HP shows a "Down" badge. Stats are snapshotted from the Enemy on add. - "Tracker" nav item; tracker_picker Stimulus controller; app.js gains a data-format="pick" cell renderer Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
32 lines
1.1 KiB
PHP
32 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DoctrineMigrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
/**
|
|
* Auto-generated Migration: Please modify to your needs!
|
|
*/
|
|
final class Version20260906171352 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return 'Create combatant table (running HP tracker)';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
$this->addSql('CREATE TABLE combatant (id INT AUTO_INCREMENT NOT NULL, label VARCHAR(120) NOT NULL, max_hp SMALLINT NOT NULL, current_hp SMALLINT NOT NULL, position SMALLINT NOT NULL, added_at DATETIME NOT NULL, enemy_id INT DEFAULT NULL, INDEX IDX_807DA381900C982F (enemy_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4 ENGINE = InnoDB');
|
|
$this->addSql('ALTER TABLE combatant ADD CONSTRAINT FK_807DA381900C982F FOREIGN KEY (enemy_id) REFERENCES enemy (id) ON DELETE SET NULL');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$this->addSql('ALTER TABLE combatant DROP FOREIGN KEY FK_807DA381900C982F');
|
|
$this->addSql('DROP TABLE combatant');
|
|
}
|
|
}
|