Show AC on each tracker row

Combatant snapshots armor_class from the enemy when added (like maxHp),
shown as an "AC n" pill next to the name for quick hit checks. Migration
backfills existing combatants from their enemy.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Frank
2026-09-06 19:34:24 +02:00
co-authored by Claude Sonnet 5
parent 2ed169fc78
commit cb23d5b9ac
4 changed files with 48 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
<?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 Version20260906173325 extends AbstractMigration
{
public function getDescription(): string
{
return 'Snapshot armor class onto each combatant';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE combatant ADD armor_class SMALLINT DEFAULT 10 NOT NULL');
$this->addSql('UPDATE combatant c JOIN enemy e ON c.enemy_id = e.id SET c.armor_class = e.armor_class');
$this->addSql('ALTER TABLE combatant ALTER armor_class DROP DEFAULT');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE combatant DROP armor_class');
}
}