diff --git a/5e_artisanal_database/tools/combat_tracker/index.html b/5e_artisanal_database/tools/combat_tracker/index.html
index 03f56e198..9707adf4a 100644
--- a/5e_artisanal_database/tools/combat_tracker/index.html
+++ b/5e_artisanal_database/tools/combat_tracker/index.html
@@ -321,6 +321,7 @@
Combat Tracker
+ | Conditions |
Init |
Name |
AC |
@@ -339,6 +340,80 @@ Combat Tracker
let monsterSources = [];
let selectedSource = '';
+// Conditions system
+const CONDITIONS = {
+ 'Blinded': 'π',
+ 'Charmed': 'π',
+ 'Deafened': 'π',
+ 'Exhaustion': 'π₯΅',
+ 'Frightened': 'π±',
+ 'Grappled': 'βοΈ',
+ 'Incapacitated': 'π«',
+ 'Invisible': 'π«οΈ',
+ 'Paralyzed': 'π₯Ά',
+ 'Petrified': 'πͺ¨',
+ 'Poisoned': 'π€’',
+ 'Prone': 'π',
+ 'Restrained': 'πΈοΈ',
+ 'Stunned': 'π«',
+ 'Unconscious': 'π΄'
+};
+
+// Function to sync data to player view
+function syncToPlayerView() {
+ const syncData = {
+ combatants: combatants.map(c => ({
+ name: c.name,
+ initiative: c.initiative,
+ id: c.id,
+ currentHp: c.currentHp,
+ maxHp: c.maxHp,
+ conditions: c.conditions || []
+ })),
+ currentTurnIndex: currentTurnIndex,
+ timestamp: Date.now()
+ };
+
+ localStorage.setItem('combatTrackerSync', JSON.stringify(syncData));
+ console.log('Synced to player view:', syncData);
+}
+
+// Add condition to combatant
+function addCondition(combatantId, condition) {
+ const combatant = combatants.find(c => c.id === combatantId);
+ if (combatant) {
+ if (!combatant.conditions) combatant.conditions = [];
+ if (!combatant.conditions.includes(condition)) {
+ combatant.conditions.push(condition);
+ renderCombatTable();
+ syncToPlayerView();
+ }
+ }
+}
+
+// Remove condition from combatant
+function removeCondition(combatantId, condition) {
+ const combatant = combatants.find(c => c.id === combatantId);
+ if (combatant && combatant.conditions) {
+ combatant.conditions = combatant.conditions.filter(c => c !== condition);
+ renderCombatTable();
+ syncToPlayerView();
+ }
+}
+
+// Generate conditions display HTML
+function getConditionsDisplay(combatant) {
+ if (!combatant.conditions || combatant.conditions.length === 0) {
+ return '';
+ }
+
+ return combatant.conditions.map(condition =>
+ `${CONDITIONS[condition]}`
+ ).join('');
+}
+
// Load monster data from included JavaScript
function loadMonstersFromJS() {
try {
@@ -652,21 +727,34 @@ Combat Tracker
function renderCombatTable() {
const tbody = document.getElementById('combatBody');
tbody.innerHTML = '';
-
+
combatants.forEach((combatant, index) => {
const row = document.createElement('tr');
-
+
// Add current turn highlighting
if (index === currentTurnIndex && combatants.length > 0) {
row.classList.add('current-turn');
}
-
+
+ // Create conditions dropdown
+ const conditionsDropdown = `
+
+ `;
+
row.innerHTML = `
+ ${conditionsDropdown} |
|
-
+ ${getConditionsDisplay(combatant)}
+
${getMonsterLink(combatant)}
@@ -684,9 +772,12 @@ Combat Tracker
| ` : '- | '}
`;
-
+
tbody.appendChild(row);
});
+
+ // Sync to player view after rendering
+ syncToPlayerView();
}
function modifyHp(id, amount) {
@@ -1001,4 +1092,4 @@ Combat Tracker